packages feed

hashable-generics 1.1.7 → 1.1.8

raw patch · 4 files changed

+46/−15 lines, 4 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

Data/Hashable/Generic.hs view
@@ -1,7 +1,12 @@ {-# LANGUAGE TypeOperators, FlexibleContexts, BangPatterns #-} {-# OPTIONS_GHC -Wall #-}--- | Stability:   stable---   Portability: GHC+-- |+-- Module:      Data.Hashable.Generic+-- Copyright:   (c) Clark Gaebel 2012+-- License:     BSD-style+-- Maintainer:  cgaebel@uwaterloo.ca+-- Stability:   stable+-- Portability: GHC module Data.Hashable.Generic ( gHashWithSalt                              , Hashable(..)                              ) where@@ -67,10 +72,6 @@ -- > instance Hashable a => Hashable (Bar a) where -- >     hashWithSalt s x = gHashWithSalt s x -- >     {-# INLINEABLE hashWithSalt #-}------ I intend for 'gHashWithSalt' to be just as fast as a hand-rolled--- implementation. Benchmarks are currently showing a 1.3x slowdown. Patches--- to improve performance are welcome! -- -- Note: The 'GHashable' type-class showing up in the type-signature is --       used internally and not exported on purpose.
bench/Bench.hs view
@@ -56,15 +56,40 @@                       zb = HR2 za za                       zc = HR2 zb zb                       zd = HR2 zc zc-                      ze = HR2 zd zd-                   in ze+                   in zd  bigGenericRolledDS :: GenericRolled-bigGenericRolledDS = f bigHandRolledDS-    where-        f HR0       = GR0-        f (HR1 x)   = GR1 x-        f (HR2 x y) = GR2 (f x) (f y)+bigGenericRolledDS = let a = GR0+                         b = GR1 $ Just 1+                         c = GR1 $ Nothing+                         d = GR1 $ Just 3+                         e = GR2 a b+                         f = GR2 c d+                         g = GR2 e e+                         h = GR2 f f+                         i = GR2 e f+                         j = GR2 g h+                         k = GR2 i j+                         l = GR2 k k+                         m = GR2 l l+                         n = GR2 m m+                         o = GR2 n n+                         p = GR2 o o+                         q = GR2 p p+                         r = GR2 q q+                         s = GR2 r r+                         t = GR2 s s+                         u = GR2 t t+                         v = GR2 u u+                         w = GR2 v v+                         x = GR2 w w+                         y = GR2 x x+                         z = GR2 y y+                         za = GR2 z z+                         zb = GR2 za za+                         zc = GR2 zb zb+                         zd = GR2 zc zc+                      in zd  main :: IO () main = defaultMain [ bcompare [ bench "handrolled" $ whnf hash bigHandRolledDS
hashable-generics.cabal view
@@ -1,5 +1,5 @@ name:                hashable-generics-version:             1.1.7+version:             1.1.8 synopsis:            Automatically generates Hashable instances with GHC.Generics. description:     This package provides a "GHC.Generics"-based 'Data.Hashable.Generic.gHashWithSalt'
test/Suite.hs view
@@ -21,6 +21,8 @@             [ testProperty "Simple Record" simpleRecord             , testProperty "Recursive Type" recursiveType             , testProperty "Parametric and Recursive Type" paraRecursive+            , testProperty "Different values => different hash. This can fail rarely, but not usually."+                $ \x y -> x /= y ==> not (haveSameHash x y)             ]         ] @@ -97,7 +99,7 @@                    in hash a == hash b  data BarA a = BarA0 | BarA1 a | BarA2 (BarA a)-    deriving (Generic, Show)+    deriving (Generic, Show, Eq)  data BarB a = BarB0 | BarB1 a | BarB2 (BarB a) @@ -124,3 +126,6 @@ paraRecursive :: BarA Int -> Bool paraRecursive a = let b = barA2B a                    in hash a == hash b++haveSameHash :: BarA Int -> BarA Int -> Bool+haveSameHash x y = hash x == hash y