packages feed

mmsyn2-array 0.2.1.1 → 0.2.2.0

raw patch · 3 files changed

+54/−12 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Case.Hashable.Cuckoo: getBFstLArr' :: (Hashable k, Ix i, Eq k) => b -> [(k, b)] -> Array i k -> Array i b
+ Case.Hashable.Cuckoo: getBFstLArrSized' :: (Hashable k, Ix i, Eq k) => Int -> b -> [(k, b)] -> Array i k -> Array i b
+ Case.Hashable.Cuckoo: getBFstLL' :: (Eq k, Hashable k) => b -> [(k, b)] -> [k] -> [b]
+ Case.Hashable.Cuckoo: getBFstLLSized' :: (Eq k, Hashable k) => Int -> b -> [(k, b)] -> [k] -> [b]
+ Case.Hashable.Cuckoo: getBFstLSized' :: (Eq k, Hashable k) => Int -> v -> [(k, v)] -> k -> v
+ Case.Hashable.Cuckoo: lookup2 :: (Eq k, Hashable k) => [(k, v)] -> k -> ST s (Maybe v)
+ Case.Hashable.Cuckoo: lookup2Sized :: (Eq k, Hashable k) => Int -> [(k, v)] -> k -> ST s (Maybe v)
+ Case.Hashable.Cuckoo: lookupL :: (Eq k, Hashable k, Traversable t) => [(k, v)] -> t k -> ST s (t (Maybe v))
+ Case.Hashable.Cuckoo: lookupLSized :: (Eq k, Hashable k, Traversable t) => Int -> [(k, v)] -> t k -> ST s (t (Maybe v))

Files

CHANGELOG.md view
@@ -18,17 +18,21 @@  ## 0.1.3.0 -- 2021-03-29 -* First version revised D. Fixed issues with being not compiled for GHC < 8.0* series. +* First version revised D. Fixed issues with being not compiled for GHC < 8.0* series.  ## 0.2.0.0 -- 2021-10-30 -* Second version. Added the module Case.Hashable.Cuckoo variant based on the Hashtable (cuckoo hash) usage. -Added the respective dependency. +* Second version. Added the module Case.Hashable.Cuckoo variant based on the Hashtable (cuckoo hash) usage.+Added the respective dependency.  ## 0.2.1.0 -- 2021-10-30 -* Second version revised A. Discontinued the base < 4.9 versions. +* Second version revised A. Discontinued the base < 4.9 versions.  ## 0.2.1.1 -- 2021-10-30  * Second version revised B. Added inlining of the Case.Hashable.Cuckoo.getBFstL' function.++## 0.2.2.0 -- 2021-10-30++* Second version revised C. Added new functions to work with lists and arrays to the Case.Hashable.Cuckoo module.
Case/Hashable/Cuckoo.hs view
@@ -12,22 +12,60 @@  {-# LANGUAGE MagicHash, UnboxedTuples #-} -module Case.Hashable.Cuckoo (-  getBFstL'-) where+module Case.Hashable.Cuckoo where  import qualified Data.HashTable.ST.Cuckoo as C-import qualified Data.HashTable.Class as H (fromList)+import qualified Data.HashTable.Class as H (fromList, fromListWithSizeHint) import GHC.ST import GHC.Magic (runRW# ) import Data.Maybe (fromMaybe) import Data.Hashable (Hashable(..))+import GHC.Arr  getBFstL' :: (Eq k, Hashable k) => v -> [(k, v)] -> k -> v-getBFstL' def pairs key = fromMaybe def-  ((\(ST st_rep) -> case runRW# st_rep of (# _, a #) -> a) . -- Actually is rewritten from the GHC.ST.runST to remove the forall constraint-    lookup2 pairs $ key)+getBFstL' def pairs key = fromMaybe def .+  (\(ST st_rep) -> case runRW# st_rep of (# _, a #) -> a) . -- Actually is rewritten from the GHC.ST.runST to remove the forall constraint+    lookup2 pairs $ key {-# INLINE getBFstL' #-}  lookup2 pairs key = H.fromList pairs >>= \ht -> C.lookup ht key {-# INLINE lookup2 #-}++lookup2Sized n pairs key = H.fromListWithSizeHint n pairs >>= \ht -> C.lookup ht key+{-# INLINE lookup2Sized #-}++lookupL pairs keys = H.fromList pairs >>= \ht -> mapM (C.lookup ht) keys+{-# INLINE lookupL #-}++lookupLSized n pairs keys = H.fromListWithSizeHint n pairs >>= \ht -> mapM (C.lookup ht) keys+{-# INLINE lookupLSized #-}++getBFstLL' :: (Eq k, Hashable k) => b -> [(k, b)] -> [k] -> [b]+getBFstLL' def pairs keys =+ (\(ST st_rep) -> case runRW# st_rep of (# _, a #) -> map (\x -> case x of { Just y -> y; ~rr -> def }) a)+   (lookupL pairs keys)+{-# INLINE getBFstLL' #-}++getBFstLArr' :: (Hashable k, Ix i, Eq k) => b -> [(k, b)] -> Array i k -> Array i b+getBFstLArr' def pairs keysArr =+ (\(ST st_rep) -> case runRW# st_rep of (# _, a #) -> amap (\x -> case x of { Just y -> y; ~rr -> def }) a)+   (lookupL pairs keysArr)+{-# INLINE getBFstLArr' #-}++getBFstLSized' :: (Eq k, Hashable k) => Int -> v -> [(k, v)] -> k -> v+getBFstLSized' n def pairs key = fromMaybe def .+  (\(ST st_rep) -> case runRW# st_rep of (# _, a #) -> a) . -- Actually is rewritten from the GHC.ST.runST to remove the forall constraint+    lookup2Sized n pairs $ key+{-# INLINE getBFstLSized' #-}++getBFstLLSized' :: (Eq k, Hashable k) => Int -> b -> [(k, b)] -> [k] -> [b]+getBFstLLSized' n def pairs keys =+ (\(ST st_rep) -> case runRW# st_rep of (# _, a #) -> map (\x -> case x of { Just y -> y; ~rr -> def }) a)+   (lookupLSized n pairs keys)+{-# INLINE getBFstLLSized' #-}++getBFstLArrSized' :: (Hashable k, Ix i, Eq k) => Int -> b -> [(k, b)] -> Array i k -> Array i b+getBFstLArrSized' n def pairs keysArr =+ (\(ST st_rep) -> case runRW# st_rep of (# _, a #) -> amap (\x -> case x of { Just y -> y; ~rr -> def }) a)+   (lookupLSized n pairs keysArr)+{-# INLINE getBFstLArrSized' #-}
mmsyn2-array.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/  name:                mmsyn2-array-version:             0.2.1.1+version:             0.2.2.0 synopsis:            A library that can be used for multiple Ord a => a -> b transformations. description:         A library that can be used as a @case ... of@ construction replacement for various cases. Since the 0.2.0.0 version also uses the cuckoo hashtables in the respective module. homepage:            https://hackage.haskell.org/package/mmsyn2-array