1
1
{-# LANGUAGE BangPatterns, CPP, ForeignFunctionInterface, MagicHash,
2
- ScopedTypeVariables, UnliftedFFITypes #-}
2
+ ScopedTypeVariables, UnliftedFFITypes, DeriveDataTypeable #-}
3
3
#ifdef GENERICS
4
4
{-# LANGUAGE DefaultSignatures, FlexibleContexts, GADTs,
5
5
MultiParamTypeClasses, EmptyDataDecls #-}
@@ -68,7 +68,7 @@ import qualified Data.Text as T
68
68
import qualified Data.Text.Array as TA
69
69
import qualified Data.Text.Internal as T
70
70
import qualified Data.Text.Lazy as TL
71
- import Data.Typeable
71
+ import Data.Typeable ( Typeable , TypeRep )
72
72
import Data.Version (Version (.. ))
73
73
import Data.Word (Word8 , Word16 , Word32 , Word64 )
74
74
import Foreign.C (CString )
@@ -82,7 +82,10 @@ import System.IO.Unsafe (unsafePerformIO)
82
82
import System.Mem.StableName
83
83
import Data.Unique (Unique , hashUnique )
84
84
85
- #if !(MIN_VERSION_base(4,7,0))
85
+ -- As we use qualified F.Foldable, we don't get warnings with newer base
86
+ import qualified Data.Foldable as F
87
+
88
+ #if MIN_VERSION_base(4,7,0)
86
89
import Data.Proxy (Proxy )
87
90
#endif
88
91
@@ -92,19 +95,20 @@ import Data.Fixed (Fixed(..))
92
95
93
96
#if MIN_VERSION_base(4,8,0)
94
97
import Data.Functor.Identity (Identity (.. ))
95
- #else
96
- import Data.Foldable (Foldable (.. ))
97
98
#endif
98
99
99
100
#ifdef GENERICS
100
101
import GHC.Generics
101
102
#endif
102
103
103
104
#if __GLASGOW_HASKELL__ >= 710
105
+ import Data.Typeable (typeRepFingerprint )
104
106
import GHC.Fingerprint.Type (Fingerprint (.. ))
105
107
#elif __GLASGOW_HASKELL__ >= 702
106
- import Data.Typeable.Internal (TypeRep (.. ))
108
+ import Data.Typeable (TypeRep (.. ))
107
109
import GHC.Fingerprint.Type (Fingerprint (.. ))
110
+ #elif __GLASGOW_HASKELL__ >= 606
111
+ import Data.Typeable (typeRepKey )
108
112
#endif
109
113
110
114
#if __GLASGOW_HASKELL__ >= 703
@@ -751,12 +755,14 @@ instance Hashable a => Hashable1 (Const a) where
751
755
instance Hashable2 Const where
752
756
liftHashWithSalt2 f _ salt (Const x) = f salt x
753
757
758
+ #if MIN_VERSION_base(4,7,0)
754
759
instance Hashable (Proxy a ) where
755
760
hash _ = 0
756
761
hashWithSalt s _ = s
757
762
758
763
instance Hashable1 Proxy where
759
764
liftHashWithSalt _ s _ = s
765
+ #endif
760
766
761
767
-- instances formerly provided by 'semigroups' package
762
768
#if MIN_VERSION_base(4,9,0)
@@ -846,7 +852,7 @@ instance Hashable1 Hashed where
846
852
instance (IsString a , Hashable a ) => IsString (Hashed a ) where
847
853
fromString s = let r = fromString s in Hashed r (hash r)
848
854
849
- instance Foldable Hashed where
855
+ instance F. Foldable Hashed where
850
856
foldr f acc (Hashed a _) = f a acc
851
857
852
858
-- | 'Hashed' cannot be 'Functor'
0 commit comments