packages feed

hashable 1.2.6.1 → 1.2.7.0

raw patch · 6 files changed

+42/−9 lines, 6 filesdep ~basedep ~deepseqnew-uploaderPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: base, deepseq

API changes (from Hackage documentation)

- Data.Hashable: class Hashable a where hash = hashWithSalt defaultSalt hashWithSalt salt = ghashWithSalt HashArgs0 salt . from
+ Data.Hashable: class Hashable a
- Data.Hashable.Lifted: class Hashable1 t where liftHashWithSalt h salt = ghashWithSalt (HashArgs1 h) salt . from1
+ Data.Hashable.Lifted: class Hashable1 t

Files

CHANGES.md view
@@ -1,3 +1,14 @@+## Version 1.2.7.0++ * Add `Hashable` and `Hashable1` instances for `Complex`++ * Fix undefined behavior in `hashable_fn_hash()` implementation+   due to signed integer overflow (#152)++ * Mark `Data.Hashable.Lifted` as `Trustworthy` (re SafeHaskell)++ * Support GHC 8.4+ ## Version 1.2.6.1   * Use typeRepFingerprint from Type.Reflection.Unsafe
Data/Hashable/Class.hs view
@@ -70,6 +70,7 @@ import qualified Data.ByteString as B import qualified Data.ByteString.Lazy as BL import qualified Data.ByteString.Unsafe as B+import Data.Complex (Complex(..)) import Data.Int (Int8, Int16, Int32, Int64) import Data.List (foldl') import Data.Ratio (Ratio, denominator, numerator)@@ -438,6 +439,14 @@         maxInt = fromIntegral (maxBound :: Int)         inBounds x = x >= fromIntegral (minBound :: Int) && x <= maxInt #endif++instance Hashable a => Hashable (Complex a) where+    {-# SPECIALIZE instance Hashable (Complex Double) #-}+    {-# SPECIALIZE instance Hashable (Complex Float)  #-}+    hash (r :+ i) = hash r `hashWithSalt` i+    hashWithSalt = hashWithSalt1+instance Hashable1 Complex where+    liftHashWithSalt h s (r :+ i) = s `h` r `h` i  #if MIN_VERSION_base(4,9,0) -- Starting with base-4.9, numerator/denominator don't need 'Integral' anymore
Data/Hashable/Generic.hs view
@@ -18,7 +18,6 @@     (     ) where -import Data.Bits (shiftR) import Data.Hashable.Class import GHC.Generics 
Data/Hashable/Lifted.hs view
@@ -1,6 +1,11 @@+{-# LANGUAGE CPP #-}+#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702+{-# LANGUAGE Trustworthy #-}+#endif+ ------------------------------------------------------------------------ -- |--- Module      :  Data.Hashable.Class+-- Module      :  Data.Hashable.Lifted -- Copyright   :  (c) Milan Straka 2010 --                (c) Johan Tibell 2011 --                (c) Bryan O'Sullivan 2011, 2012
cbits/fnv.c view
@@ -36,8 +36,9 @@  * The FNV-1 hash description: http://isthe.com/chongo/tech/comp/fnv/  * The FNV-1 hash is public domain: http://isthe.com/chongo/tech/comp/fnv/#public_domain  */-long hashable_fnv_hash(const unsigned char* str, long len, long hash) {+long hashable_fnv_hash(const unsigned char* str, long len, long salt) { +  unsigned long hash = salt;   while (len--) {     hash = (hash * 16777619) ^ *str++;   }@@ -48,6 +49,6 @@ /* Used for ByteArray#s. We can't treat them like pointers in    native Haskell, but we can in unsafe FFI calls.  */-long hashable_fnv_hash_offset(const unsigned char* str, long offset, long len, long hash) {-  return hashable_fnv_hash(str + offset, len, hash);+long hashable_fnv_hash_offset(const unsigned char* str, long offset, long len, long salt) {+  return hashable_fnv_hash(str + offset, len, salt); }
hashable.cabal view
@@ -1,5 +1,6 @@+Cabal-version:       1.12 Name:                hashable-Version:             1.2.6.1+Version:             1.2.7.0 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@@ -16,9 +17,10 @@ Stability:           Provisional Category:            Data Build-type:          Simple-Cabal-version:       >=1.8 -- tests/Properties.hs shouldn't have to go here, but the source files -- for the test-suite stanzas don't get picked up by `cabal sdist`.+tested-with:         GHC==8.4.1, GHC==8.2.2, GHC==8.0.2, GHC==7.10.3, GHC==7.8.4, GHC==7.6.3, GHC==7.4.2, GHC==7.2.2+ Extra-source-files:   CHANGES.md, README.md, tests/Properties.hs,   benchmarks/Benchmarks.hs, benchmarks/cbits/*.c, benchmarks/cbits/*.h@@ -46,9 +48,9 @@   Exposed-modules:   Data.Hashable                      Data.Hashable.Lifted   Other-modules:     Data.Hashable.Class-  Build-depends:     base >= 4.4 && < 4.11,+  Build-depends:     base >= 4.4 && < 4.12,                      bytestring >= 0.9 && < 0.11,-                     deepseq >= 1.3+                     deepseq >= 1.3 && < 1.5   if impl(ghc)     Build-depends:   ghc-prim,                      text >= 0.11.0.5@@ -71,6 +73,8 @@     if os(windows)       extra-libraries: advapi32 +  Default-Language:  Haskell2010+ Test-suite tests   Type:              exitcode-stdio-1.0   Hs-source-dirs:    tests@@ -96,6 +100,8 @@   if impl(ghc >= 7.2.1)     CPP-Options:     -DGENERICS +  Default-Language:  Haskell2010+ benchmark benchmarks   -- We cannot depend on the hashable library directly as that creates   -- a dependency cycle.@@ -157,6 +163,7 @@     if os(windows)       extra-libraries: advapi32 +  Default-Language:  Haskell2010  Executable hashable-examples   if flag(examples)@@ -165,6 +172,7 @@     buildable: False   hs-source-dirs: examples   main-is: Main.hs+  Default-Language:  Haskell2010  source-repository head   type:     git