deferred-folds 0.9.5 → 0.9.6
raw patch · 3 files changed
+28/−1 lines, 3 filesdep +hashabledep +unordered-containersPVP ok
version bump matches the API change (PVP)
Dependencies added: hashable, unordered-containers
API changes (from Hackage documentation)
+ DeferredFolds.Unfoldr: hashMapAssocs :: HashMap key value -> Unfoldr (key, value)
+ DeferredFolds.Unfoldr: hashMapValue :: (Hashable key, Eq key) => key -> HashMap key value -> Unfoldr value
+ DeferredFolds.Unfoldr: hashMapValues :: (Hashable key, Eq key) => HashMap key value -> Unfoldr key -> Unfoldr value
Files
- deferred-folds.cabal +3/−1
- library/DeferredFolds/Defs/Unfoldr.hs +17/−0
- library/DeferredFolds/Prelude.hs +8/−0
deferred-folds.cabal view
@@ -1,5 +1,5 @@ name: deferred-folds-version: 0.9.5+version: 0.9.6 category: Folding synopsis: Abstractions over deferred folds description:@@ -41,6 +41,8 @@ bytestring >=0.10 && <0.11, containers >=0.5 && <0.6, foldl >=1 && <2,+ hashable >=1 && <2, primitive >=0.6.4 && <0.7, transformers >=0.5 && <0.6,+ unordered-containers >=0.2 && <0.3, vector >=0.12 && <0.13
library/DeferredFolds/Defs/Unfoldr.hs view
@@ -5,6 +5,7 @@ import DeferredFolds.Types import qualified Data.Map.Strict as Map import qualified Data.IntMap.Strict as IntMap+import qualified Data.HashMap.Strict as HashMap import qualified Data.ByteString as ByteString import qualified Data.ByteString.Short.Internal as ShortByteString import qualified Data.Vector.Generic as GenericVector@@ -109,6 +110,22 @@ intMapAssocs :: IntMap value -> Unfoldr (Int, value) intMapAssocs intMap = Unfoldr (\ step init -> IntMap.foldrWithKey (\ key value state -> step (key, value) state) init intMap)++{-| Associations of a hash-map -}+{-# INLINE hashMapAssocs #-}+hashMapAssocs :: HashMap key value -> Unfoldr (key, value)+hashMapAssocs hashMap =+ Unfoldr (\ step init -> HashMap.foldrWithKey (\ key value state -> step (key, value) state) init hashMap)++{-| Value of a hash-map by key -}+{-# INLINE hashMapValue #-}+hashMapValue :: (Hashable key, Eq key) => key -> HashMap key value -> Unfoldr value+hashMapValue key = foldable . HashMap.lookup key++{-| Values of a hash-map by their keys -}+{-# INLINE hashMapValues #-}+hashMapValues :: (Hashable key, Eq key) => HashMap key value -> Unfoldr key -> Unfoldr value+hashMapValues hashMap keys = keys >>= flip hashMapValue hashMap {-| Bytes of a bytestring -} {-# INLINE byteStringBytes #-}
library/DeferredFolds/Prelude.hs view
@@ -95,3 +95,11 @@ -- primitive ------------------------- import Data.Primitive as Exports++-- unordered-containers+-------------------------+import Data.HashMap.Strict as Exports (HashMap)++-- hashable+-------------------------+import Data.Hashable as Exports (Hashable)