Skip to content

Commit 60ed4f0

Browse files
committed
Tidy up extensions and CPP handling
We don't have the means anymore to properly test GHC 6.12 anymore and code has bitrotten to the point where it makes no sense to even advertise support for GHC 6.12 anymore. Starting with this commit `text` now explicitly requires a Haskell2010+ compiler and the CPP and compiler dependency specification is updated to reflect this.
1 parent 5bc4e08 commit 60ed4f0

File tree

10 files changed

+57
-32
lines changed

10 files changed

+57
-32
lines changed

Data/Text.hs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
{-# LANGUAGE BangPatterns, CPP, MagicHash, Rank2Types, UnboxedTuples #-}
1+
{-# LANGUAGE BangPatterns, CPP, MagicHash, Rank2Types, UnboxedTuples, TypeFamilies #-}
22
{-# OPTIONS_GHC -fno-warn-orphans #-}
33
#if __GLASGOW_HASKELL__ >= 702
44
{-# LANGUAGE Trustworthy #-}
55
#endif
6-
#if __GLASGOW_HASKELL__ >= 708
7-
{-# LANGUAGE TypeFamilies #-}
8-
#endif
96
-- Using TemplateHaskell in text unconditionally is unacceptable, as
107
-- it's a GHC boot library. TemplateHaskellQuotes was added in 8.0, so
118
-- this would seem to be a problem. However, GHC's policy of only
@@ -252,7 +249,7 @@ import qualified Data.Text.Lazy as L
252249
import Data.Int (Int64)
253250
#endif
254251
import GHC.Base (eqInt, neInt, gtInt, geInt, ltInt, leInt)
255-
#if __GLASGOW_HASKELL__ >= 708
252+
#if MIN_VERSION_base(4,7,0)
256253
import qualified GHC.Exts as Exts
257254
#endif
258255
import qualified Language.Haskell.TH.Lib as TH
@@ -384,7 +381,7 @@ instance Monoid Text where
384381
instance IsString Text where
385382
fromString = pack
386383

387-
#if __GLASGOW_HASKELL__ >= 708
384+
#if MIN_VERSION_base(4,7,0)
388385
-- | @since 1.2.0.0
389386
instance Exts.IsList Text where
390387
type Item Text = Char

Data/Text/Array.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{-# LANGUAGE BangPatterns, CPP, ForeignFunctionInterface, MagicHash, Rank2Types,
1+
{-# LANGUAGE BangPatterns, CPP, MagicHash, Rank2Types,
22
RecordWildCards, UnboxedTuples, UnliftedFFITypes #-}
33
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
44
-- |
@@ -58,15 +58,15 @@ if (_k_) < 0 || (_k_) >= (_len_) then error ("Data.Text.Array." ++ (_func_) ++ "
5858
#if defined(ASSERTS)
5959
import Control.Exception (assert)
6060
#endif
61-
#if __GLASGOW_HASKELL__ >= 702
61+
#if MIN_VERSION_base(4,4,0)
6262
import Control.Monad.ST.Unsafe (unsafeIOToST)
6363
#else
6464
import Control.Monad.ST (unsafeIOToST)
6565
#endif
6666
import Data.Bits ((.&.), xor)
6767
import Data.Text.Internal.Unsafe (inlinePerformIO)
6868
import Data.Text.Internal.Unsafe.Shift (shiftL, shiftR)
69-
#if __GLASGOW_HASKELL__ >= 703
69+
#if MIN_VERSION_base(4,5,0)
7070
import Foreign.C.Types (CInt(CInt), CSize(CSize))
7171
#else
7272
import Foreign.C.Types (CInt, CSize)

Data/Text/Encoding.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{-# LANGUAGE BangPatterns, CPP, ForeignFunctionInterface, GeneralizedNewtypeDeriving, MagicHash,
1+
{-# LANGUAGE BangPatterns, CPP, GeneralizedNewtypeDeriving, MagicHash,
22
UnliftedFFITypes #-}
33
#if __GLASGOW_HASKELL__ >= 702
44
{-# LANGUAGE Trustworthy #-}
@@ -59,7 +59,7 @@ module Data.Text.Encoding
5959
, encodeUtf8BuilderEscaped
6060
) where
6161

62-
#if __GLASGOW_HASKELL__ >= 702
62+
#if MIN_VERSION_base(4,4,0)
6363
import Control.Monad.ST.Unsafe (unsafeIOToST, unsafeSTToIO)
6464
#else
6565
import Control.Monad.ST (unsafeIOToST, unsafeSTToIO)
@@ -78,7 +78,7 @@ import Data.Text.Internal.Unsafe.Shift (shiftR)
7878
import Data.Text.Show ()
7979
import Data.Text.Unsafe (unsafeDupablePerformIO)
8080
import Data.Word (Word8, Word32)
81-
#if __GLASGOW_HASKELL__ >= 703
81+
#if MIN_VERSION_base(4,5,0)
8282
import Foreign.C.Types (CSize(CSize))
8383
#else
8484
import Foreign.C.Types (CSize)

Data/Text/Foreign.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ module Data.Text.Foreign
3434
#if defined(ASSERTS)
3535
import Control.Exception (assert)
3636
#endif
37-
#if __GLASGOW_HASKELL__ >= 702
37+
#if MIN_VERSION_base(4,4,0)
3838
import Control.Monad.ST.Unsafe (unsafeIOToST)
3939
#else
4040
import Control.Monad.ST (unsafeIOToST)

Data/Text/Internal/Functions.hs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
{-# LANGUAGE CPP, DeriveDataTypeable #-}
2-
31
-- |
42
-- Module : Data.Text.Internal.Functions
53
-- Copyright : 2010 Bryan O'Sullivan

Data/Text/Internal/Fusion/Common.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{-# LANGUAGE PatternGuards, BangPatterns, MagicHash, Rank2Types #-}
1+
{-# LANGUAGE BangPatterns, MagicHash, Rank2Types #-}
22
-- |
33
-- Module : Data.Text.Internal.Fusion.Common
44
-- Copyright : (c) Bryan O'Sullivan 2009, 2012

Data/Text/Internal/Fusion/Size.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{-# LANGUAGE CPP, PatternGuards #-}
1+
{-# LANGUAGE CPP #-}
22
{-# OPTIONS_GHC -fno-warn-missing-methods #-}
33
-- |
44
-- Module : Data.Text.Internal.Fusion.Internal

Data/Text/Internal/IO.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{-# LANGUAGE BangPatterns, CPP, RecordWildCards #-}
1+
{-# LANGUAGE BangPatterns, RecordWildCards #-}
22
-- |
33
-- Module : Data.Text.Internal.IO
44
-- Copyright : (c) 2009, 2010 Bryan O'Sullivan,

Data/Text/Lazy.hs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
{-# OPTIONS_GHC -fno-warn-orphans #-}
2-
{-# LANGUAGE BangPatterns, MagicHash, CPP #-}
2+
{-# LANGUAGE BangPatterns, MagicHash, CPP, TypeFamilies #-}
33
#if __GLASGOW_HASKELL__ >= 702
44
{-# LANGUAGE Trustworthy #-}
55
#endif
6-
#if __GLASGOW_HASKELL__ >= 708
7-
{-# LANGUAGE TypeFamilies #-}
8-
#endif
96
-- Using TemplateHaskell in text unconditionally is unacceptable, as
107
-- it's a GHC boot library. TemplateHaskellQuotes was added in 8.0, so
118
-- this would seem to be a problem. However, GHC's policy of only
@@ -246,7 +243,7 @@ import qualified GHC.CString as GHC
246243
#else
247244
import qualified GHC.Base as GHC
248245
#endif
249-
#if __GLASGOW_HASKELL__ >= 708
246+
#if MIN_VERSION_base(4,7,0)
250247
import qualified GHC.Exts as Exts
251248
#endif
252249
import GHC.Prim (Addr#)
@@ -378,7 +375,7 @@ instance Monoid Text where
378375
instance IsString Text where
379376
fromString = pack
380377

381-
#if __GLASGOW_HASKELL__ >= 708
378+
#if MIN_VERSION_base(4,7,0)
382379
-- | @since 1.2.0.0
383380
instance Exts.IsList Text where
384381
type Item Text = Char

text.cabal

Lines changed: 41 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cabal-version: >= 1.8
1+
cabal-version: >= 1.10
22
name: text
33
version: 1.2.4.0
44

@@ -143,16 +143,16 @@ library
143143
Data.Text.Show
144144

145145
build-depends:
146-
array >= 0.3,
147-
base >= 4.2 && < 5,
148-
binary,
149-
deepseq >= 1.1.0.0,
150-
ghc-prim >= 0.2,
151-
template-haskell
146+
array >= 0.3 && < 0.6,
147+
base >= 4.3 && < 5,
148+
binary >= 0.5 && < 0.9,
149+
deepseq >= 1.1 && < 1.5,
150+
ghc-prim >= 0.2 && < 0.6,
151+
template-haskell >= 2.5 && < 2.16
152152

153153
if flag(bytestring-builder)
154154
build-depends: bytestring >= 0.9 && < 0.10.4,
155-
bytestring-builder >= 0.10.4.0.2
155+
bytestring-builder >= 0.10.4.0.2 && < 0.11
156156
else
157157
build-depends: bytestring >= 0.10.4 && < 0.11
158158

@@ -169,6 +169,36 @@ library
169169
cpp-options: -DINTEGER_GMP
170170
build-depends: integer-gmp >= 0.2 && < 1.1
171171

172+
-- compiler specification
173+
default-language: Haskell2010
174+
default-extensions:
175+
NondecreasingIndentation
176+
other-extensions:
177+
BangPatterns
178+
CPP
179+
DeriveDataTypeable
180+
ExistentialQuantification
181+
ForeignFunctionInterface
182+
GeneralizedNewtypeDeriving
183+
MagicHash
184+
OverloadedStrings
185+
Rank2Types
186+
RankNTypes
187+
RecordWildCards
188+
ScopedTypeVariables
189+
TypeFamilies
190+
UnboxedTuples
191+
UnliftedFFITypes
192+
193+
if impl(ghc >= 7.2)
194+
other-extensions: Trustworthy
195+
if impl(ghc >= 7.4)
196+
other-extensions: Safe
197+
if impl(ghc >= 8.0)
198+
other-extensions: TemplateHaskellQuotes
199+
else
200+
other-extensions: TemplateHaskell
201+
172202
test-suite tests
173203
type: exitcode-stdio-1.0
174204
c-sources: cbits/cbits.c
@@ -274,6 +304,9 @@ test-suite tests
274304
cpp-options: -DINTEGER_GMP
275305
build-depends: integer-gmp >= 0.2
276306

307+
default-language: Haskell2010
308+
default-extensions: NondecreasingIndentation
309+
277310
source-repository head
278311
type: git
279312
location: https://github.com/haskell/text

0 commit comments

Comments
 (0)