Skip to content

Commit

Permalink
Remove unused imports, dead code, and unused deps
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
andrewthad committed Nov 20, 2024
1 parent 75c5365 commit 4b2de72
Show file tree
Hide file tree
Showing 7 changed files with 0 additions and 36 deletions.
10 changes: 0 additions & 10 deletions Data/Primitive/Array.hs
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@ import qualified GHC.ST as GHCST
import qualified Data.Foldable as F
import Data.Semigroup
import Data.Functor.Identity
#if !MIN_VERSION_base(4,10,0)
import GHC.Base (runRW#)
#endif

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

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

-- Note [Forgiving Array Read Instance]
-- We're really forgiving here. We accept
Expand Down
6 changes: 0 additions & 6 deletions Data/Primitive/ByteArray.hs
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,7 @@ import Control.Monad.ST
import Data.Primitive.Types
import Data.Proxy

#if MIN_VERSION_base(4,10,0)
import qualified GHC.ST as GHCST
#endif

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

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

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

-- Create an uninitialized array of the given size in bytes, apply the function
-- to it, and freeze the result.
Expand Down
6 changes: 0 additions & 6 deletions Data/Primitive/PrimArray.hs
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,7 @@ import Control.Monad.ST
import qualified Data.List as L
import qualified Data.Primitive.ByteArray as PB
import qualified Data.Primitive.Types as PT
#if MIN_VERSION_base(4,10,0)
import qualified GHC.ST as GHCST
#endif
import Language.Haskell.TH.Syntax (Lift (..))

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

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

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

-- | Create an uninitialized array of the given length, apply the function to
-- it, and freeze the result.
Expand Down
10 changes: 0 additions & 10 deletions Data/Primitive/SmallArray.hs
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,6 @@ import Data.Semigroup
import Text.ParserCombinators.ReadP
import Text.ParserCombinators.ReadPrec (ReadPrec)
import qualified Text.ParserCombinators.ReadPrec as RdPrc
#if !MIN_VERSION_base(4,10,0)
import GHC.Base (runRW#)
#endif

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

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

smallArrayDataType :: DataType
smallArrayDataType =
Expand Down
2 changes: 0 additions & 2 deletions Data/Primitive/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -410,9 +410,7 @@ deriving instance Prim CWchar
deriving instance Prim CSigAtomic
deriving instance Prim CLLong
deriving instance Prim CULLong
#if MIN_VERSION_base(4,10,0)
deriving instance Prim CBool
#endif
deriving instance Prim CIntPtr
deriving instance Prim CUIntPtr
deriving instance Prim CIntMax
Expand Down
1 change: 0 additions & 1 deletion primitive.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ test-suite test-qc
type: exitcode-stdio-1.0
build-depends: base
, base-orphans
, ghc-prim
, primitive
, quickcheck-classes-base >= 0.6 && <0.7
, QuickCheck >= 2.13 && < 2.16
Expand Down
1 change: 0 additions & 1 deletion test/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import PrimLaws (primLaws)

import Data.Functor.Identity (Identity(..))
import qualified Data.Monoid as Monoid
import Data.Ord (Down(..))
import Data.Semigroup (stimes, stimesMonoid)
import qualified Data.Semigroup as Semigroup
#if !(MIN_VERSION_base(4,11,0))
Expand Down

0 comments on commit 4b2de72

Please sign in to comment.