Skip to content

Commit 8d1b6ff

Browse files
authored
Drop support of GHC < 8 (#336)
* Support only GHC >= 8.0 * Fix a build warning * Make integer-simple flag redundant
1 parent 2a12940 commit 8d1b6ff

File tree

32 files changed

+41
-397
lines changed

32 files changed

+41
-397
lines changed

.github/workflows/haskell-ci.yml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,6 @@ jobs:
4444
allow-failure: false
4545
- compiler: ghc-8.0.2
4646
allow-failure: false
47-
- compiler: ghc-7.10.3
48-
allow-failure: false
49-
- compiler: ghc-7.8.4
50-
allow-failure: false
51-
- compiler: ghc-7.6.3
52-
allow-failure: false
53-
- compiler: ghc-7.4.2
54-
allow-failure: false
55-
- compiler: ghc-7.2.2
56-
allow-failure: false
57-
- compiler: ghc-7.0.4
58-
allow-failure: false
5947
fail-fast: false
6048
steps:
6149
- name: apt

benchmarks/haskell/Benchmarks/Builder.hs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ module Benchmarks.Builder
1212
import Test.Tasty.Bench (Benchmark, bgroup, bench, nf)
1313
import Data.Binary.Builder as B
1414
import Data.ByteString.Char8 ()
15-
#if !MIN_VERSION_base(4,8,0)
16-
import Data.Monoid (mconcat, mempty)
17-
#endif
1815
import qualified Data.ByteString.Builder as Blaze
1916
import qualified Data.ByteString as SB
2017
import qualified Data.ByteString.Lazy as LB

benchmarks/haskell/Benchmarks/FileRead.hs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@ module Benchmarks.FileRead
1111
( benchmark
1212
) where
1313

14-
#if !MIN_VERSION_base(4,8,0)
15-
import Control.Applicative ((<$>))
16-
#endif
1714
import Test.Tasty.Bench (Benchmark, bgroup, bench, whnfIO)
1815
import qualified Data.ByteString as SB
1916
import qualified Data.ByteString.Lazy as LB

benchmarks/haskell/Benchmarks/Programs/BigTable.hs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ module Benchmarks.Programs.BigTable
1212
) where
1313

1414
import Test.Tasty.Bench (Benchmark, bench, whnfIO)
15-
#if !MIN_VERSION_base(4,8,0)
16-
import Data.Monoid (mconcat, mempty, mappend)
17-
#endif
1815
import Data.Text.Lazy.Builder (Builder, fromText, toLazyText)
1916
import Data.Text.Lazy.IO (hPutStr)
2017
import System.IO (Handle)

benchmarks/haskell/Benchmarks/Programs/Fold.hs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@ module Benchmarks.Programs.Fold
1919

2020
import Data.List (foldl')
2121
import Data.List (intersperse)
22-
#if !MIN_VERSION_base(4,8,0)
23-
import Data.Monoid (mempty, mappend, mconcat)
24-
#endif
2522
import System.IO (Handle)
2623
import Test.Tasty.Bench (Benchmark, bench, whnfIO)
2724
import qualified Data.Text as T

benchmarks/haskell/Benchmarks/Programs/Sort.hs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@ module Benchmarks.Programs.Sort
1818
) where
1919

2020
import Test.Tasty.Bench (Benchmark, bgroup, bench, whnfIO)
21-
#if !MIN_VERSION_base(4,8,0)
22-
import Data.Monoid (mconcat)
23-
#endif
2421
import System.IO (Handle)
2522
import qualified Data.ByteString as B
2623
import qualified Data.ByteString.Lazy as BL

benchmarks/haskell/Benchmarks/Pure.hs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ module Benchmarks.Pure
1515
import Control.DeepSeq (NFData (..))
1616
import Control.Exception (evaluate)
1717
import Test.Tasty.Bench (Benchmark, bgroup, bench, nf)
18-
#if !MIN_VERSION_base(4,8,0)
19-
import Data.Monoid (mappend, mempty)
20-
#endif
2118
import GHC.Base (Char (..), Int (..), chr#, ord#, (+#))
2219
import GHC.Generics (Generic)
2320
import GHC.Int (Int64)
@@ -305,14 +302,6 @@ benchmark kind ~Env{..} =
305302
len l _ = l + (1::Int)
306303
short = T.pack "short"
307304

308-
#if !MIN_VERSION_bytestring(0,10,0)
309-
instance NFData BS.ByteString
310-
311-
instance NFData BL.ByteString where
312-
rnf BL.Empty = ()
313-
rnf (BL.Chunk _ ts) = rnf ts
314-
#endif
315-
316305
data B where
317306
B :: NFData a => a -> B
318307

cabal.project

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
packages: .
22
tests: True
33
benchmarks: True
4-
constraints: semigroups -text -hashable -unordered-containers

src/Data/Text.hs

Lines changed: 6 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,8 @@
11
{-# LANGUAGE BangPatterns, CPP, MagicHash, Rank2Types, UnboxedTuples, TypeFamilies #-}
2-
{-# OPTIONS_GHC -fno-warn-orphans #-}
3-
#if __GLASGOW_HASKELL__ >= 702
4-
{-# LANGUAGE Trustworthy #-}
5-
#endif
6-
-- Using TemplateHaskell in text unconditionally is unacceptable, as
7-
-- it's a GHC boot library. TemplateHaskellQuotes was added in 8.0, so
8-
-- this would seem to be a problem. However, GHC's policy of only
9-
-- needing to be able to compile itself from the last few releases
10-
-- allows us to use full-fat TH on older versions, while using THQ for
11-
-- GHC versions that may be used for bootstrapping.
12-
#if __GLASGOW_HASKELL__ >= 800
132
{-# LANGUAGE TemplateHaskellQuotes #-}
14-
#else
15-
{-# LANGUAGE TemplateHaskell #-}
16-
#endif
3+
{-# LANGUAGE Trustworthy #-}
4+
5+
{-# OPTIONS_GHC -fno-warn-orphans #-}
176

187
-- |
198
-- Module : Data.Text
@@ -226,9 +215,7 @@ import qualified Data.Text.Array as A
226215
import qualified Data.List as L
227216
import Data.Binary (Binary(get, put))
228217
import Data.Monoid (Monoid(..))
229-
#if MIN_VERSION_base(4,9,0)
230218
import Data.Semigroup (Semigroup(..))
231-
#endif
232219
import Data.String (IsString(..))
233220
import qualified Data.Text.Internal.Fusion as S
234221
import qualified Data.Text.Internal.Fusion.Common as S
@@ -251,14 +238,10 @@ import qualified Data.Text.Lazy as L
251238
import Data.Int (Int64)
252239
#endif
253240
import GHC.Base (eqInt, neInt, gtInt, geInt, ltInt, leInt)
254-
#if MIN_VERSION_base(4,7,0)
255241
import qualified GHC.Exts as Exts
256-
#endif
257242
import qualified Language.Haskell.TH.Lib as TH
258243
import qualified Language.Haskell.TH.Syntax as TH
259-
#if MIN_VERSION_base(4,7,0)
260244
import Text.Printf (PrintfArg, formatArg, formatString)
261-
#endif
262245

263246
-- $setup
264247
-- >>> import Data.Text
@@ -364,37 +347,23 @@ instance Ord Text where
364347
instance Read Text where
365348
readsPrec p str = [(pack x,y) | (x,y) <- readsPrec p str]
366349

367-
#if MIN_VERSION_base(4,9,0)
368-
-- | Non-orphan 'Semigroup' instance only defined for
369-
-- @base-4.9.0.0@ and later; orphan instances for older GHCs are
370-
-- provided by
371-
-- the [semigroups](http://hackage.haskell.org/package/semigroups)
372-
-- package
373-
--
374-
-- @since 1.2.2.0
350+
-- | @since 1.2.2.0
375351
instance Semigroup Text where
376352
(<>) = append
377-
#endif
378353

379354
instance Monoid Text where
380355
mempty = empty
381-
#if MIN_VERSION_base(4,9,0)
382-
mappend = (<>) -- future-proof definition
383-
#else
384-
mappend = append
385-
#endif
356+
mappend = (<>)
386357
mconcat = concat
387358

388359
instance IsString Text where
389360
fromString = pack
390361

391-
#if MIN_VERSION_base(4,7,0)
392362
-- | @since 1.2.0.0
393363
instance Exts.IsList Text where
394364
type Item Text = Char
395365
fromList = pack
396366
toList = unpack
397-
#endif
398367

399368
instance NFData Text where rnf !_ = ()
400369

@@ -442,13 +411,9 @@ instance TH.Lift Text where
442411
liftTyped = TH.unsafeTExpCoerce . TH.lift
443412
#endif
444413

445-
#if MIN_VERSION_base(4,7,0)
446-
-- | Only defined for @base-4.7.0.0@ and later
447-
--
448-
-- @since 1.2.2.0
414+
-- | @since 1.2.2.0
449415
instance PrintfArg Text where
450416
formatArg txt = formatString $ unpack txt
451-
#endif
452417

453418
packConstr :: Constr
454419
packConstr = mkConstr textDataType "pack" [] Prefix

src/Data/Text/Array.hs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,23 +42,16 @@ module Data.Text.Array
4242

4343
#if defined(ASSERTS)
4444
import Control.Exception (assert)
45+
import GHC.Base (sizeofByteArray#, sizeofMutableByteArray#)
4546
#endif
46-
#if MIN_VERSION_base(4,4,0)
4747
import Control.Monad.ST.Unsafe (unsafeIOToST)
48-
#else
49-
import Control.Monad.ST (unsafeIOToST)
50-
#endif
5148
import Data.Bits ((.&.), xor)
5249
import Data.Text.Internal.Unsafe (inlinePerformIO)
5350
import Data.Text.Internal.Unsafe.Shift (shiftL, shiftR)
54-
#if MIN_VERSION_base(4,5,0)
5551
import Foreign.C.Types (CInt(CInt), CSize(CSize))
56-
#else
57-
import Foreign.C.Types (CInt, CSize)
58-
#endif
5952
import GHC.Base (ByteArray#, MutableByteArray#, Int(..),
6053
indexWord16Array#, newByteArray#,
61-
unsafeFreezeByteArray#, writeWord16Array#, sizeofByteArray#, sizeofMutableByteArray#)
54+
unsafeFreezeByteArray#, writeWord16Array#)
6255
import GHC.ST (ST(..), runST)
6356
import GHC.Word (Word16(..))
6457
import Prelude hiding (length, read)

0 commit comments

Comments
 (0)