Skip to content

Commit 4b2de72

Browse files
committed
Remove unused imports, dead code, and unused deps
The test suite dependency on ghc-prim has been removed. An import of Data.Ord in the test suite has been removed. All shims for GHC 8.0 have been removed.
1 parent 75c5365 commit 4b2de72

File tree

7 files changed

+0
-36
lines changed

7 files changed

+0
-36
lines changed

Data/Primitive/Array.hs

-10
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,6 @@ import qualified GHC.ST as GHCST
5252
import qualified Data.Foldable as F
5353
import Data.Semigroup
5454
import Data.Functor.Identity
55-
#if !MIN_VERSION_base(4,10,0)
56-
import GHC.Base (runRW#)
57-
#endif
5855

5956
import Text.Read (Read (..), parens, prec)
6057
import Text.ParserCombinators.ReadPrec (ReadPrec)
@@ -799,14 +796,7 @@ instance Read a => Read (Array a) where
799796

800797
-- | @since 0.6.4.0
801798
instance Read1 Array where
802-
#if MIN_VERSION_base(4,10,0)
803799
liftReadPrec = arrayLiftReadPrec
804-
#else
805-
-- This is just the default implementation of liftReadsPrec, but
806-
-- it is not present in older versions of base.
807-
liftReadsPrec rp rl = RdPrc.readPrec_to_S $
808-
arrayLiftReadPrec (RdPrc.readS_to_Prec rp) (RdPrc.readS_to_Prec (const rl))
809-
#endif
810800

811801
-- Note [Forgiving Array Read Instance]
812802
-- We're really forgiving here. We accept

Data/Primitive/ByteArray.hs

-6
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,7 @@ import Control.Monad.ST
7575
import Data.Primitive.Types
7676
import Data.Proxy
7777

78-
#if MIN_VERSION_base(4,10,0)
7978
import qualified GHC.ST as GHCST
80-
#endif
8179

8280
import Data.Word ( Word8 )
8381
#if __GLASGOW_HASKELL__ >= 802
@@ -640,7 +638,6 @@ cloneMutableByteArray src off n = do
640638
runByteArray
641639
:: (forall s. ST s (MutableByteArray s))
642640
-> ByteArray
643-
#if MIN_VERSION_base(4,10,0) /* In new GHCs, runRW# is available. */
644641
runByteArray m = ByteArray (runByteArray# m)
645642

646643
runByteArray#
@@ -652,9 +649,6 @@ runByteArray# m = case runRW# $ \s ->
652649

653650
unST :: ST s a -> State# s -> (# State# s, a #)
654651
unST (GHCST.ST f) = f
655-
#else /* In older GHCs, runRW# is not available. */
656-
runByteArray m = runST $ m >>= unsafeFreezeByteArray
657-
#endif
658652

659653
-- Create an uninitialized array of the given size in bytes, apply the function
660654
-- to it, and freeze the result.

Data/Primitive/PrimArray.hs

-6
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,7 @@ import Control.Monad.ST
125125
import qualified Data.List as L
126126
import qualified Data.Primitive.ByteArray as PB
127127
import qualified Data.Primitive.Types as PT
128-
#if MIN_VERSION_base(4,10,0)
129128
import qualified GHC.ST as GHCST
130-
#endif
131129
import Language.Haskell.TH.Syntax (Lift (..))
132130

133131
import Data.Semigroup
@@ -1144,7 +1142,6 @@ cloneMutablePrimArray src off n = do
11441142
runPrimArray
11451143
:: (forall s. ST s (MutablePrimArray s a))
11461144
-> PrimArray a
1147-
#if MIN_VERSION_base(4,10,0) /* In new GHCs, runRW# is available. */
11481145
runPrimArray m = PrimArray (runPrimArray# m)
11491146

11501147
runPrimArray#
@@ -1156,9 +1153,6 @@ runPrimArray# m = case runRW# $ \s ->
11561153

11571154
unST :: ST s a -> State# s -> (# State# s, a #)
11581155
unST (GHCST.ST f) = f
1159-
#else /* In older GHCs, runRW# is not available. */
1160-
runPrimArray m = runST $ m >>= unsafeFreezePrimArray
1161-
#endif
11621156

11631157
-- | Create an uninitialized array of the given length, apply the function to
11641158
-- it, and freeze the result.

Data/Primitive/SmallArray.hs

-10
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,6 @@ import Data.Semigroup
8888
import Text.ParserCombinators.ReadP
8989
import Text.ParserCombinators.ReadPrec (ReadPrec)
9090
import qualified Text.ParserCombinators.ReadPrec as RdPrc
91-
#if !MIN_VERSION_base(4,10,0)
92-
import GHC.Base (runRW#)
93-
#endif
9491

9592
import Data.Functor.Classes (Eq1(..), Ord1(..), Show1(..), Read1(..))
9693
import Language.Haskell.TH.Syntax (Lift(..))
@@ -892,14 +889,7 @@ instance Read a => Read (SmallArray a) where
892889

893890
-- | @since 0.6.4.0
894891
instance Read1 SmallArray where
895-
#if MIN_VERSION_base(4,10,0)
896892
liftReadPrec = smallArrayLiftReadPrec
897-
#else
898-
-- This is just the default implementation of liftReadsPrec, but
899-
-- it is not present in older versions of base.
900-
liftReadsPrec rp rl = RdPrc.readPrec_to_S $
901-
smallArrayLiftReadPrec (RdPrc.readS_to_Prec rp) (RdPrc.readS_to_Prec (const rl))
902-
#endif
903893

904894
smallArrayDataType :: DataType
905895
smallArrayDataType =

Data/Primitive/Types.hs

-2
Original file line numberDiff line numberDiff line change
@@ -410,9 +410,7 @@ deriving instance Prim CWchar
410410
deriving instance Prim CSigAtomic
411411
deriving instance Prim CLLong
412412
deriving instance Prim CULLong
413-
#if MIN_VERSION_base(4,10,0)
414413
deriving instance Prim CBool
415-
#endif
416414
deriving instance Prim CIntPtr
417415
deriving instance Prim CUIntPtr
418416
deriving instance Prim CIntMax

primitive.cabal

-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ test-suite test-qc
8787
type: exitcode-stdio-1.0
8888
build-depends: base
8989
, base-orphans
90-
, ghc-prim
9190
, primitive
9291
, quickcheck-classes-base >= 0.6 && <0.7
9392
, QuickCheck >= 2.13 && < 2.16

test/Main.hs

-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ import PrimLaws (primLaws)
3232

3333
import Data.Functor.Identity (Identity(..))
3434
import qualified Data.Monoid as Monoid
35-
import Data.Ord (Down(..))
3635
import Data.Semigroup (stimes, stimesMonoid)
3736
import qualified Data.Semigroup as Semigroup
3837
#if !(MIN_VERSION_base(4,11,0))

0 commit comments

Comments
 (0)