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 /Annex | |
parent | 87ba1abc7cd1b199b0f7d778d9f27375b50de709 (diff) |
instance Hashable Key for bloomfilter
Diffstat (limited to 'Annex')
-rw-r--r-- | Annex/BloomFilter.hs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Annex/BloomFilter.hs b/Annex/BloomFilter.hs index 3dcd8140b..3ac81fa58 100644 --- a/Annex/BloomFilter.hs +++ b/Annex/BloomFilter.hs @@ -40,14 +40,14 @@ bloomBitsHashes = do - Once the action completes, the mutable filter is frozen - for later use. -} -genBloomFilter :: Hashable t => (v -> t) -> ((v -> Annex ()) -> Annex b) -> Annex (Bloom t) -genBloomFilter convert populate = do +genBloomFilter :: Hashable v => ((v -> Annex ()) -> Annex b) -> Annex (Bloom v) +genBloomFilter populate = do (numbits, numhashes) <- bloomBitsHashes bloom <- lift $ newMB (cheapHashes numhashes) numbits - _ <- populate $ \v -> lift $ insertMB bloom (convert v) + _ <- populate $ \v -> lift $ insertMB bloom v lift $ unsafeFreezeMB bloom where lift = liftIO . stToIO -bloomFilter :: Hashable t => (v -> t) -> [v] -> Bloom t -> [v] -bloomFilter convert l bloom = filter (\k -> convert k `notElemB` bloom) l +bloomFilter :: Hashable v => [v] -> Bloom v -> [v] +bloomFilter l bloom = filter (\v -> v `notElemB` bloom) l |