diff options
Diffstat (limited to 'compiler/utils')
-rw-r--r-- | compiler/utils/Binary.hs | 26 | ||||
-rw-r--r-- | compiler/utils/UniqFM.hs | 10 | ||||
-rw-r--r-- | compiler/utils/UniqMap.hs | 3 |
3 files changed, 2 insertions, 37 deletions
diff --git a/compiler/utils/Binary.hs b/compiler/utils/Binary.hs index c3c8ae3ab7..447317ca47 100644 --- a/compiler/utils/Binary.hs +++ b/compiler/utils/Binary.hs @@ -79,14 +79,10 @@ import qualified Data.ByteString.Unsafe as BS import Data.IORef import Data.Char ( ord, chr ) import Data.Time -#if MIN_VERSION_base(4,10,0) import Type.Reflection import Type.Reflection.Unsafe import Data.Kind (Type) import GHC.Exts (TYPE, RuntimeRep(..), VecCount(..), VecElem(..)) -#else -import Data.Typeable -#endif import Control.Monad ( when ) import System.IO as IO import System.IO.Unsafe ( unsafeInterleaveIO ) @@ -610,7 +606,6 @@ instance Binary (Bin a) where -- ----------------------------------------------------------------------------- -- Instances for Data.Typeable stuff -#if MIN_VERSION_base(4,10,0) instance Binary TyCon where put_ bh tc = do put_ bh (tyConPackage tc) @@ -620,17 +615,7 @@ instance Binary TyCon where put_ bh (tyConKindRep tc) get bh = mkTyCon <$> get bh <*> get bh <*> get bh <*> get bh <*> get bh -#else -instance Binary TyCon where - put_ bh tc = do - put_ bh (tyConPackage tc) - put_ bh (tyConModule tc) - put_ bh (tyConName tc) - get bh = - mkTyCon3 <$> get bh <*> get bh <*> get bh -#endif -#if MIN_VERSION_base(4,10,0) instance Binary VecCount where put_ bh = putByte bh . fromIntegral . fromEnum get bh = toEnum . fromIntegral <$> getByte bh @@ -781,17 +766,6 @@ instance Typeable a => Binary (TypeRep (a :: k)) where instance Binary SomeTypeRep where put_ bh (SomeTypeRep rep) = putTypeRep bh rep get = getSomeTypeRep -#else -instance Binary TypeRep where - put_ bh type_rep = do - let (ty_con, child_type_reps) = splitTyConApp type_rep - put_ bh ty_con - put_ bh child_type_reps - get bh = do - ty_con <- get bh - child_type_reps <- get bh - return (mkTyConApp ty_con child_type_reps) -#endif -- ----------------------------------------------------------------------------- -- Lazy reading/writing diff --git a/compiler/utils/UniqFM.hs b/compiler/utils/UniqFM.hs index f0cc197b71..2a9b806178 100644 --- a/compiler/utils/UniqFM.hs +++ b/compiler/utils/UniqFM.hs @@ -20,7 +20,6 @@ and ``addToUFM\_C'' and ``Data.IntMap.insertWith'' differ in the order of arguments of combining function. -} -{-# LANGUAGE CPP #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# OPTIONS_GHC -Wall #-} @@ -79,19 +78,16 @@ import Outputable import Data.List (foldl') import qualified Data.IntMap as M -#if MIN_VERSION_containers(0,5,9) import qualified Data.IntMap.Merge.Lazy as M import Control.Applicative (Const (..)) import qualified Data.Monoid as Mon -#endif import qualified Data.IntSet as S -import Data.Typeable import Data.Data import qualified Data.Semigroup as Semi newtype UniqFM ele = UFM (M.IntMap ele) - deriving (Data, Eq, Functor, Typeable) + deriving (Data, Eq, Functor) -- We used to derive Traversable and Foldable, but they were nondeterministic -- and not obvious at the call site. You can use explicit nonDetEltsUFM -- and fold a list if needed. @@ -346,14 +342,10 @@ ufmToIntMap (UFM m) = m -- Determines whether two 'UniqFm's contain the same keys. equalKeysUFM :: UniqFM a -> UniqFM b -> Bool -#if MIN_VERSION_containers(0,5,9) equalKeysUFM (UFM m1) (UFM m2) = Mon.getAll $ getConst $ M.mergeA (M.traverseMissing (\_ _ -> Const (Mon.All False))) (M.traverseMissing (\_ _ -> Const (Mon.All False))) (M.zipWithAMatched (\_ _ _ -> Const (Mon.All True))) m1 m2 -#else -equalKeysUFM (UFM m1) (UFM m2) = M.keys m1 == M.keys m2 -#endif -- Instances diff --git a/compiler/utils/UniqMap.hs b/compiler/utils/UniqMap.hs index 2dd3cd57ea..1bd51c2b38 100644 --- a/compiler/utils/UniqMap.hs +++ b/compiler/utils/UniqMap.hs @@ -54,12 +54,11 @@ import Outputable import Data.Semigroup as Semi ( Semigroup(..) ) import Data.Coerce import Data.Maybe -import Data.Typeable import Data.Data -- | Maps indexed by 'Uniquable' keys newtype UniqMap k a = UniqMap (UniqFM (k, a)) - deriving (Data, Eq, Functor, Typeable) + deriving (Data, Eq, Functor) type role UniqMap nominal representational instance Semigroup (UniqMap k a) where |