git-annex/Utility/Bloom.hs
Joey Hess 9a5ddda511
remove many old version ifdefs
Drop support for building with ghc older than 8.4.4, and with older
versions of serveral haskell libraries than will be included in Debian 10.

The only remaining version ifdefs in the entire code base are now a couple
for aws!

This commit should only be merged after the Debian 10 release.
And perhaps it will need to wait longer than that; it would make
backporting new versions of  git-annex to Debian 9 (stretch) which
has been actively happening as recently as this year.

This commit was sponsored by Ilya Shlyakhter.
2019-07-05 15:09:37 -04:00

40 lines
855 B
Haskell

{- bloomfilter compatability wrapper
-
- Copyright 2014 Joey Hess <id@joeyh.name>
-
- License: BSD-2-clause
-}
module Utility.Bloom (
Bloom,
safeSuggestSizing,
Hashable(..),
cheapHashes,
elemB,
notElemB,
newMB,
insertMB,
unsafeFreezeMB,
) where
import qualified Data.BloomFilter.Mutable as MBloom
import qualified Data.BloomFilter as Bloom
import Data.BloomFilter.Easy (safeSuggestSizing, Bloom)
import Data.BloomFilter.Hash (Hashable(..), cheapHashes)
import Control.Monad.ST (ST)
notElemB :: a -> Bloom a -> Bool
notElemB = Bloom.notElem
elemB :: a -> Bloom a -> Bool
elemB = Bloom.elem
newMB :: (a -> [Bloom.Hash]) -> Int -> ST s (MBloom.MBloom s a)
newMB = MBloom.new
insertMB :: MBloom.MBloom s a -> a -> ST s ()
insertMB = MBloom.insert
unsafeFreezeMB :: MBloom.MBloom s a -> ST s (Bloom a)
unsafeFreezeMB = Bloom.unsafeFreeze