diff options
author | Joey Hess <joeyh@joeyh.name> | 2015-06-16 18:37:41 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2015-06-16 18:37:41 -0400 |
commit | e3da28295e11972bcb14749ef294d1f39fb03efa (patch) | |
tree | 3d30dde99abd43c739395f8ef943ad6129693a9c /Types | |
parent | 87ba1abc7cd1b199b0f7d778d9f27375b50de709 (diff) |
instance Hashable Key for bloomfilter
Diffstat (limited to 'Types')
-rw-r--r-- | Types/Key.hs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Types/Key.hs b/Types/Key.hs index 553fd8f3d..7f9f514c7 100644 --- a/Types/Key.hs +++ b/Types/Key.hs @@ -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 |