instance Hashable Key for bloomfilter

This commit is contained in:
Joey Hess 2015-06-16 18:37:41 -04:00
parent 8b74aec3ea
commit a0a8127956
4 changed files with 13 additions and 8 deletions

View file

@ -26,6 +26,7 @@ import System.Posix.Types
import Common
import Utility.QuickCheck
import Utility.Bloom
{- A Key has a unique name, which is derived from a particular backend,
- and may contain other optional metadata. -}
@ -130,6 +131,10 @@ instance Arbitrary Key where
<*> ((abs <$>) <$> arbitrary) -- chunksize cannot be negative
<*> ((succ . abs <$>) <$> arbitrary) -- chunknum cannot be 0 or negative
instance Hashable Key where
hashIO32 = hashIO32 . show
hashIO64 = hashIO64 . show
prop_idempotent_key_encode :: Key -> Bool
prop_idempotent_key_encode k = Just k == (file2key . key2file) k