packages feed

cuckoo 0.3.0 → 0.3.1

raw patch · 3 files changed

+34/−15 lines, 3 filesdep ~hashesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: hashes

API changes (from Hackage documentation)

- Data.Cuckoo: saltedFnv1aPtr :: Int -> Ptr Word8 -> Int -> Word64
+ Data.Cuckoo: saltedFnv1aPtr :: Int -> Ptr Word8 -> Int -> IO Word64
- Data.Cuckoo: saltedSipHashPtr :: Int -> Ptr Word8 -> Int -> Word64
+ Data.Cuckoo: saltedSipHashPtr :: Int -> Ptr Word8 -> Int -> IO Word64
- Data.Cuckoo.Internal.HashFunctions: saltedFnv1aPtr :: Int -> Ptr Word8 -> Int -> Word64
+ Data.Cuckoo.Internal.HashFunctions: saltedFnv1aPtr :: Int -> Ptr Word8 -> Int -> IO Word64
- Data.Cuckoo.Internal.HashFunctions: saltedSipHashPtr :: Int -> Ptr Word8 -> Int -> Word64
+ Data.Cuckoo.Internal.HashFunctions: saltedSipHashPtr :: Int -> Ptr Word8 -> Int -> IO Word64

Files

CHANGELOG.md view
@@ -1,5 +1,12 @@ # Revision history for cuckoo +## 0.3.1 -- 2021-10-20++*   Change signatures of `saltedFnv1aPtr` and `saltedSipHashPtr` to+    run in `IO`.+*   Raise lower bound on hashes package to 0.2.++ ## 0.3.0 -- 2021-09-30  *   Rename hash functions provided hash functions to
cuckoo.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.4 name: cuckoo-version: 0.3.0+version: 0.3.1 synopsis: Haskell Implementation of Cuckoo Filters Description:     Haskell implementation of Cuckoo filters as described in@@ -88,7 +88,7 @@         -- external         , base >=4.11 && <5         , bytestring >=0.10-        , hashes >=0.1+        , hashes >=0.2         , primitive >=0.6.4.0  test-suite tests
src/Data/Cuckoo/Internal/HashFunctions.hs view
@@ -1,6 +1,9 @@+{-# LANGUAGE BangPatterns #-}+{-# LANGUAGE DataKinds #-} {-# LANGUAGE LambdaCase #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TypeApplications #-}  -- | -- Module: Data.Cuckoo.Internal.HashFunctions@@ -26,7 +29,7 @@ ) where  import qualified Data.ByteString as B-import Data.Hash.FNV1+import Data.Hash.FNV1.Salted import Data.Hash.SipHash  import Foreign@@ -48,9 +51,10 @@         -- ^ Bytes that are hashed     -> Int         -- ^ Number of bytes-    -> Word64-saltedFnv1aPtr s p ps = hashPtr_ fnv1a_64_ p ps-    $! hashStorable fnv1a_64 s+    -> IO Word64+saltedFnv1aPtr s p l = do+    Fnv1a64Hash !h <- hashPtr (fromIntegral s) p l+    return h {-# INLINE saltedFnv1aPtr #-}  -- | Computes a 64 bit Fnv1a hash for a value that has an 'Storable' instance.@@ -64,8 +68,8 @@     -> a         -- ^ Value that is hashed     -> Word64-saltedFnv1aStorable s x = hashStorable_ fnv1a_64_ x-    $! hashStorable fnv1a_64 s+saltedFnv1aStorable s b =+    let Fnv1a64Hash !h = hashStorable (fromIntegral s) b in h {-# INLINE saltedFnv1aStorable #-}  saltedFnv1aByteString@@ -74,8 +78,8 @@     -> B.ByteString         -- ^ Bytes that are hashed     -> Word64-saltedFnv1aByteString s b = hashByteString_ fnv1a_64_ b-    $! hashStorable fnv1a_64 s+saltedFnv1aByteString s b =+    let Fnv1a64Hash !h = hashByteString (fromIntegral s) b in h {-# INLINE saltedFnv1aByteString #-}  -- -------------------------------------------------------------------------- --@@ -93,8 +97,10 @@         -- ^ Bytes that is hashed     -> Int         -- ^ Number of bytes-    -> Word64-saltedSipHashPtr s ptr l = hashPtr (sipHash24 (int s) 1043639) ptr l+    -> IO Word64+saltedSipHashPtr s ptr l = do+    SipHash !h <- hashPtr @(SipHash 2 4) (SipHashKey (int s) 1043639) ptr l+    return h {-# INLINE saltedSipHashPtr #-}  -- | Computes a Sip hash for a value that has an 'Storable' instance.@@ -109,7 +115,9 @@     -> a         -- ^ Value that is hashed     -> Word64-saltedSipHashStorable s = hashStorable (sipHash24 (int s) 914279)+saltedSipHashStorable s b =+    let SipHash !h = hashStorable @(SipHash 2 4) (SipHashKey (int s) 914279) b+    in h {-# INLINE saltedSipHashStorable #-}  -- | Computes a Sip hash for a value that has an 'Storable' instance.@@ -123,7 +131,9 @@     -> B.ByteString         -- ^ Value that is hashed     -> Word64-saltedSipHashByteString s = hashByteString (sipHash24 (int s) 914279)+saltedSipHashByteString s b =+    let SipHash !h = hashByteString @(SipHash 2 4) (SipHashKey (int s) 914279) b+    in h {-# INLINE saltedSipHashByteString #-}  -- -------------------------------------------------------------------------- --@@ -134,6 +144,8 @@ -- implementation of instances of 'Data.Cuckoo.CuckooFilterHash'. -- sipHashInternal :: Storable a => Int -> a -> Word64-sipHashInternal s = hashStorable (sipHash24 994559 (int s * 713243))+sipHashInternal s b =+    let SipHash !h = hashStorable @(SipHash 2 4) (SipHashKey 994559 (int s * 713243)) b+    in h {-# INLINE sipHashInternal #-}