hashable 1.1.2.2 → 1.1.2.3
raw patch · 2 files changed
+26/−2 lines, 2 filesdep ~basedep ~test-frameworkPVP: minor bump suggested
API additions: PVP suggests at least a minor version bump
Dependency ranges changed: base, test-framework
API changes (from Hackage documentation)
+ Data.Hashable: instance Hashable TypeRep
Files
- Data/Hashable.hs +24/−0
- hashable.cabal +2/−2
Data/Hashable.hs view
@@ -80,6 +80,12 @@ import System.Mem.StableName #endif +import Data.Typeable+#if __GLASGOW_HASKELL__ >= 702+import GHC.Fingerprint.Type(Fingerprint(..))+import Data.Typeable.Internal(TypeRep(..))+#endif+ #include "MachDeps.h" infixl 0 `combine`, `hashWithSalt`@@ -288,6 +294,24 @@ instance Hashable LT.Text where hash = hashWithSalt stringSalt hashWithSalt = LT.foldlChunks hashWithSalt+++-- | Compute the hash of a TypeRep, in various GHC versions we can do this quickly.+hashTypeRep :: TypeRep -> Int+{-# INLINE hashTypeRep #-}+#if __GLASGOW_HASKELL__ >= 702+-- Fingerprint is just the MD5, so taking any Int from it is fine+hashTypeRep (TypeRep (Fingerprint x _) _ _) = fromIntegral x+#elif __GLASGOW_HASKELL__ >= 606+hashTypeRep = B.inlinePerformIO . typeRepKey+#else+hashTypeRep = hash . show+#endif++instance Hashable TypeRep where+ hash = hashTypeRep+ {-# INLINE hash #-}+ ------------------------------------------------------------------------ -- * Creating new instances
hashable.cabal view
@@ -1,5 +1,5 @@ Name: hashable-Version: 1.1.2.2+Version: 1.1.2.3 Synopsis: A class for types that can be converted to a hash value Description: This package defines a class, 'Hashable', for types that can be converted to a hash value. This class@@ -41,7 +41,7 @@ Main-is: Properties.hs Build-depends: base >= 4.0 && < 5, hashable,- test-framework >= 0.3.3 && < 0.5,+ test-framework >= 0.3.3 && < 0.6, test-framework-quickcheck2 >= 0.2.9 && < 0.3, QuickCheck >= 2.4.0.1, random == 1.0.*,