deferred-folds 0.9.6 → 0.9.7
raw patch · 5 files changed
+25/−3 lines, 5 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ DeferredFolds.Unfoldr: hashMapAt :: (Hashable key, Eq key) => HashMap key value -> key -> Unfoldr value
Files
- deferred-folds.cabal +1/−1
- library/DeferredFolds/Defs/Unfoldl.hs +6/−0
- library/DeferredFolds/Defs/UnfoldlM.hs +5/−0
- library/DeferredFolds/Defs/Unfoldr.hs +11/−0
- library/DeferredFolds/Prelude.hs +2/−2
deferred-folds.cabal view
@@ -1,5 +1,5 @@ name: deferred-folds-version: 0.9.6+version: 0.9.7 category: Folding synopsis: Abstractions over deferred folds description:
library/DeferredFolds/Defs/Unfoldl.hs view
@@ -61,6 +61,12 @@ instance Show a => Show (Unfoldl a) where show = show . toList +instance IsList (Unfoldl a) where+ type Item (Unfoldl a) = a+ fromList list = foldable list+ toList = foldr (:) []++ {-| Apply a Gonzalez fold -} {-# INLINE fold #-} fold :: Fold input output -> Unfoldl input -> output
library/DeferredFolds/Defs/UnfoldlM.hs view
@@ -65,6 +65,11 @@ instance Show a => Show (UnfoldlM Identity a) where show = show . toList +instance IsList (UnfoldlM Identity a) where+ type Item (UnfoldlM Identity a) = a+ fromList list = foldable list+ toList = foldr (:) []+ {-| Check whether it's empty -} {-# INLINE null #-} null :: Monad m => UnfoldlM m input -> m Bool
library/DeferredFolds/Defs/Unfoldr.hs view
@@ -55,6 +55,11 @@ instance Show a => Show (Unfoldr a) where show = show . toList +instance IsList (Unfoldr a) where+ type Item (Unfoldr a) = a+ fromList list = foldable list+ toList = foldr (:) []+ {-| Apply a Gonzalez fold -} {-# INLINE fold #-} fold :: Fold input output -> Unfoldr input -> output@@ -118,7 +123,13 @@ Unfoldr (\ step init -> HashMap.foldrWithKey (\ key value state -> step (key, value) state) init hashMap) {-| Value of a hash-map by key -}+{-# INLINE hashMapAt #-}+hashMapAt :: (Hashable key, Eq key) => HashMap key value -> key -> Unfoldr value+hashMapAt hashMap key = foldable (HashMap.lookup key hashMap)++{-| Value of a hash-map by key -} {-# INLINE hashMapValue #-}+{-# DEPRECATED hashMapValue "Use 'hashMapAt' instead" #-} hashMapValue :: (Hashable key, Eq key) => key -> HashMap key value -> Unfoldr value hashMapValue key = foldable . HashMap.lookup key
library/DeferredFolds/Prelude.hs view
@@ -25,7 +25,7 @@ import Data.Dynamic as Exports import Data.Either as Exports import Data.Fixed as Exports-import Data.Foldable as Exports+import Data.Foldable as Exports hiding (toList) import Data.Function as Exports hiding (id, (.)) import Data.Functor as Exports import Data.Functor.Identity as Exports@@ -52,7 +52,7 @@ import Foreign.StablePtr as Exports import Foreign.Storable as Exports hiding (sizeOf, alignment) import GHC.Conc as Exports hiding (withMVar, threadWaitWriteSTM, threadWaitWrite, threadWaitReadSTM, threadWaitRead)-import GHC.Exts as Exports (lazy, inline, sortWith, groupWith)+import GHC.Exts as Exports (lazy, inline, sortWith, groupWith, IsList(..)) import GHC.Generics as Exports (Generic) import GHC.IO.Exception as Exports import Numeric as Exports