packages feed

bloomfilter-redis 0.1.0.3 → 0.1.0.4

raw patch · 4 files changed

+42/−32 lines, 4 filesdep ~QuickCheckdep ~arithmoidep ~basePVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: QuickCheck, arithmoi, base, criterion, hashable, hedis, tasty, tasty-hunit, tasty-quickcheck

API changes (from Hackage documentation)

- Data.RedisBloom: addBF :: (RedisCtx m f) => Bloom a -> a -> m ()
+ Data.RedisBloom: addBF :: RedisCtx m f => Bloom a -> a -> m ()
- Data.RedisBloom: createBF :: (RedisCtx m (Either Reply)) => Bloom a -> m (Either Reply Status)
+ Data.RedisBloom: createBF :: RedisCtx m (Either Reply) => Bloom a -> m (Either Reply Status)
- Data.RedisBloom: createIfNewBF :: (RedisCtx m (Either Reply)) => Bloom a -> m (Either Reply Bool)
+ Data.RedisBloom: createIfNewBF :: RedisCtx m (Either Reply) => Bloom a -> m (Either Reply Bool)
- Data.RedisBloom.Hash.Families: type HashFamily a = a -> [Hash]
+ Data.RedisBloom.Hash.Families: type HashFamily a = (a -> [Hash])
- Data.RedisBloom.Hash.Families: type HashFunction a = Index -> a -> Hash
+ Data.RedisBloom.Hash.Families: type HashFunction a = (Index -> a -> Hash)
- Data.RedisBloom.Hash.Families: type RawHashFunction a = a -> RawHash
+ Data.RedisBloom.Hash.Families: type RawHashFunction a = (a -> RawHash)
- Data.RedisBloom.Suggestions: suggestHashCount :: forall a. (Integral a) => a -> Capacity -> HashCount
+ Data.RedisBloom.Suggestions: suggestHashCount :: forall a. Integral a => a -> Capacity -> HashCount

Files

CHANGELOG.md view
@@ -1,3 +1,7 @@+0.1.0.4+------+* Compatibility with GHC 8.6/base-4.12+ 0.1.0.3 ------ * Compatibility with GHC 8.0/base-4.9
bloomfilter-redis.cabal view
@@ -1,5 +1,5 @@ name:                bloomfilter-redis-version:             0.1.0.3+version:             0.1.0.4 synopsis:            Distributed bloom filters on Redis (using the Hedis client). description:   Distributed bloom filters on Redis (using the Hedis client).@@ -11,10 +11,10 @@ license-file:        LICENSE author:              Tobias Markus <tobias AT miglix DOT eu> maintainer:          Tobias Markus <tobias AT miglix DOT eu>-copyright:           Copyright 2016 Tobias Markus <tobias AT miglix DOT eu>+copyright:           Copyright 2016-2019 Tobias Markus <tobias AT miglix DOT eu> category:            Data build-type:          Simple-cabal-version:       >=1.14+cabal-version:       1.14 stability:           Experimental  source-repository head@@ -39,12 +39,12 @@                    , BangPatterns                    , Safe                    , CPP-  build-depends:     base       >= 4.7 && < 4.10+  build-depends:     base       >= 4.7 && < 4.13                    , bytestring >= 0.9 && < 0.11                    , binary     >= 0.7 && < 0.9-                   , hashable   >= 1.2 && < 1.3-                   , hedis      >= 0.5 && < 0.10-                   , arithmoi   >= 0.3 && < 0.5+                   , hashable   >= 1.2 && < 1.4+                   , hedis      >= 0.5 && < 0.13+                   , arithmoi   >= 0.3 && < 0.10   hs-source-dirs:    src  test-suite test-bloomfilter-redis@@ -56,13 +56,13 @@   build-depends:     base                    , bloomfilter-redis                    , bytestring       >= 0.9 && < 0.11-                   , hashable         >= 1.2 && < 1.3-                   , hedis            >= 0.5 && < 0.10-                   , tasty            >= 0.8 && < 0.12+                   , hashable         >= 1.2 && < 1.4+                   , hedis            >= 0.5 && < 0.13+                   , tasty            >= 0.8 && < 1.3                    , tasty-rerun      >= 1.1 && < 1.2-                   , tasty-quickcheck >= 0.8 && < 0.9-                   , QuickCheck       >= 2.8 && < 2.9-                   , tasty-hunit      >= 0.9 && < 0.10+                   , tasty-quickcheck >= 0.8 && < 0.11+                   , QuickCheck       >= 2.8 && < 2.13+                   , tasty-hunit      >= 0.9 && < 0.11  benchmark bench-bloomfilter-redis   ghc-options:       -O2@@ -73,4 +73,4 @@   build-depends:     base                    , bloomfilter-redis                    , random    >= 1.1 && < 1.2-                   , criterion >= 1.1 && < 1.2+                   , criterion >= 1.1 && < 1.6
src/Data/RedisBloom/Hash/FNV.hs view
@@ -16,7 +16,7 @@      -- ** Historical      fnv0,      -- * Auxiliary constants-     fnvPrime, fnvOffsetBasis+     fnvPrime, fnvOffsetBasis,     ) where @@ -26,7 +26,6 @@  import Math.NumberTheory.Primes.Testing (isPrime) -import qualified Data.ByteString as B import qualified Data.ByteString.Lazy as BL  {-# INLINE twoPwr #-}@@ -61,13 +60,13 @@       primes = filter isPrime candidates  fnvPrime32 :: Word32-fnvPrime32 = $( [| fromInteger $ findPrime (32::Word32) |] )+fnvPrime32 = 16777619 fnvPrime64 :: Word64-fnvPrime64 = $( [| fromInteger $ findPrime (64::Word64) |] )-{-# INLINE [1] fnvPrime #-}+fnvPrime64 = 1099511628211+{-# INLINE [2] fnvPrime #-} {-# RULES-  "prime/32" [2] fnvPrime = fnvPrime32;-  "prime/64" [2] fnvPrime = fnvPrime64;+  "prime/32" [3] fnvPrime = fnvPrime32;+  "prime/64" [3] fnvPrime = fnvPrime64;   #-} -- | The FNV prime. The prime is calculated -- automatically based on the number of bits@@ -80,23 +79,26 @@ fnvPrime :: forall a. (Num a, FiniteBits a) => a fnvPrime = fromInteger . findPrime . finiteBitSize $ (undefined :: a) -{-# INLINE fnvFold #-}+{-# INLINE [1] fnvFold #-}+{-# SPECIALIZE fnvFold :: Bool -> Word8 -> Word32 -> Word32 #-}+{-# SPECIALIZE fnvFold :: Bool -> Word8 -> Word64 -> Word64 #-} fnvFold :: (Num a, FiniteBits a) => Bool -> Word8 -> a -> a fnvFold False !x !h = (fnvPrime * h) `xor` fromIntegral x fnvFold True  !x !h = fnvPrime * (h  `xor` fromIntegral x) +{-# INLINEABLE fnv0 #-} -- | Variant 0 is historical and should not be used directly. -- Rather, it is used to calculate the offset basis ('fnvOffsetBasis') -- of the algorithm ('fnv1' and 'fnv1a'). -- -- <http://www.isthe.com/chongo/tech/comp/fnv/#FNV-0> fnv0 :: (Binary a, Num b, FiniteBits b) => a -> b-fnv0 = B.foldr' (fnvFold False) 0 . BL.toStrict . encode+fnv0 = BL.foldr (fnvFold False) 0 . encode  fnvOffsetBasis32 :: Word32-fnvOffsetBasis32 = $( [| fnvOffsetBasis |] )+fnvOffsetBasis32 = 2936991659 fnvOffsetBasis64 :: Word64-fnvOffsetBasis64 = $( [| fnvOffsetBasis |] )+fnvOffsetBasis64 = 12134123147076137451 {-# INLINE [1] fnvOffsetBasis #-} {-# RULES   "offset/32" [2] fnvOffsetBasis = fnvOffsetBasis32;@@ -108,19 +110,23 @@ fnvOffsetBasis :: (FiniteBits a, Num a) => a fnvOffsetBasis = fnv0 constant     where-      constant = "chongo <Landon Curt Noll> /\\../\\" :: B.ByteString+      constant = "chongo <Landon Curt Noll> /\\../\\" :: BL.ByteString --- These lead to infinite loops (why?)---{-# INLINABLE fnv1  #-}---{-# INLINABLE fnv1a #-}+{-# INLINABLE fnv1  #-}+{-# INLINABLE fnv1a #-}+{-# SPECIALIZE fnv1  :: Binary a => a -> Word32 #-}+{-# SPECIALIZE fnv1  :: Binary a => a -> Word64 #-}+{-# SPECIALIZE fnv1a :: Binary a => a -> Word32 #-}+{-# SPECIALIZE fnv1a :: Binary a => a -> Word64 #-} fnv1, fnv1a  :: (Binary a, FiniteBits b, Num b) => a -> b -- | Variant 1 of the FNV hash function. -- The hash is first multiplied with the 'fnvPrime' and then 'xor'ed with the octet. -- -- <http://www.isthe.com/chongo/tech/comp/fnv/#FNV-1>-fnv1  = B.foldr' (fnvFold False) fnvOffsetBasis . BL.toStrict . encode+fnv1  = BL.foldr (fnvFold False) fnvOffsetBasis . encode -- | Variant 1a of the FNV hash function. -- The hash is first 'xor'ed with the octet and then multiplied with the 'fnvPrime'. -- -- <http://www.isthe.com/chongo/tech/comp/fnv/#FNV-1a>-fnv1a = B.foldr' (fnvFold True)  fnvOffsetBasis . BL.toStrict . encode+fnv1a = BL.foldr (fnvFold True)  fnvOffsetBasis . encode+
src/Data/RedisBloom/Hash/Families.hs view
@@ -47,7 +47,7 @@ -- Just like the original bloom filter package, a variant of -- Kirsch and Mitzenmacher's technique from \"Less -- Hashing, Same Performance: Building a Better Bloom Filter\",--- <http://www.eecs.harvard.edu/~kirsch/pubs/bbbf/esa06.pdf> is used here.+-- <https://www.eecs.harvard.edu/~michaelm/postscripts/tr-02-05.pdf> is used here. -- -- Quoting from the non-Redis bloomfilter package: -- "Where Kirsch and Mitzenmacher multiply the second hash by a