mmsyn2-array 0.1.3.0 → 0.2.0.0
raw patch · 3 files changed
+42/−5 lines, 3 filesdep +ghc-primdep +hashabledep +hashtablesdep ~basePVP ok
version bump matches the API change (PVP)
Dependencies added: ghc-prim, hashable, hashtables
Dependency ranges changed: base
API changes (from Hackage documentation)
+ Case.Hashable.Cuckoo: getBFstL' :: (Eq k, Hashable k) => v -> [(k, v)] -> k -> v
Files
- CHANGELOG.md +5/−0
- Case/Hashable/Cuckoo.hs +32/−0
- mmsyn2-array.cabal +5/−5
CHANGELOG.md view
@@ -19,3 +19,8 @@ ## 0.1.3.0 -- 2021-03-29 * 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.
+ Case/Hashable/Cuckoo.hs view
@@ -0,0 +1,32 @@+-- |+-- Module : Case.Hashable.Cuckoo+-- Copyright : (c) OleksandrZhabenko 2021+-- License : MIT+-- Stability : Experimental+-- Maintainer : olexandr543@yahoo.com+--+-- A library that can be used as a @case ... of@ constuction analogue for the Hashable keys.+-- For the large lists is expected to be more time efficient than CaseBi.Arr.getBFst' analogue.+-- If you plan to use it together with the former one, please, use qualified import to avoid names ambiguity.+++{-# LANGUAGE MagicHash, UnboxedTuples #-}++module Case.Hashable.Cuckoo (+ getBFstL'+) where++import qualified Data.HashTable.ST.Cuckoo as C+import qualified Data.HashTable.Class as H (fromList)+import GHC.ST+import GHC.Magic (runRW# )+import Data.Maybe (fromMaybe)+import Data.Hashable (Hashable(..))++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)++lookup2 pairs key = H.fromList pairs >>= \ht -> C.lookup ht key+{-# INLINE lookup2 #-}
mmsyn2-array.cabal view
@@ -2,9 +2,9 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: mmsyn2-array-version: 0.1.3.0-synopsis: A library with less dependencies that can be used for multiple Ord a => a -> b transformations.-description: A library that can be used as a @case ... of@ constuction analogue for the multiple @Ord a => a -> b@ transformations and data representation. Uses "GHC.Arr" internally. If you use the module in GHCi, then, please, run the interpreter with the flag -fobject-code.+version: 0.2.0.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 license: MIT license-file: LICENSE@@ -17,10 +17,10 @@ cabal-version: >=1.10 library- exposed-modules: CaseBi.Arr+ exposed-modules: CaseBi.Arr, Case.Hashable.Cuckoo -- other-modules: other-extensions: UnboxedTuples, BangPatterns, FlexibleContexts, MagicHash ghc-options: -funbox-strict-fields- build-depends: base >=4.7 && <4.15+ build-depends: base >=4.8 && <5, hashtables >=1.2.3 && <2, hashable >= 1.2.7 && <2, ghc-prim >=0.4 && <1 -- hs-source-dirs: default-language: Haskell2010