deferred-folds 0.4.0.1 → 0.4.1
raw patch · 3 files changed
+23/−1 lines, 3 filesdep +containersPVP ok
version bump matches the API change (PVP)
Dependencies added: containers
API changes (from Hackage documentation)
+ DeferredFolds.Unfold: intMap :: IntMap value -> Unfold (Int, value)
+ DeferredFolds.Unfold: map :: Map key value -> Unfold (key, value)
Files
- deferred-folds.cabal +2/−1
- library/DeferredFolds/Prelude.hs +8/−0
- library/DeferredFolds/Unfold.hs +13/−0
deferred-folds.cabal view
@@ -1,7 +1,7 @@ name: deferred-folds version:- 0.4.0.1+ 0.4.1 category: Folding synopsis:@@ -45,4 +45,5 @@ DeferredFolds.Prelude build-depends: base >=4.7 && <5,+ containers >=0.5 && <0.6, foldl >=1 && <2
library/DeferredFolds/Prelude.hs view
@@ -17,6 +17,14 @@ import Control.Applicative as Exports import Control.Monad as Exports +-- containers+-------------------------+import Data.IntMap.Strict as Exports (IntMap)+import Data.Map.Strict as Exports (Map)+import Data.IntSet as Exports (IntSet)+import Data.Set as Exports (Set)+import Data.Sequence as Exports (Seq)+ -- foldl ------------------------- import Control.Foldl as Exports (Fold(..), FoldM(..))
library/DeferredFolds/Unfold.hs view
@@ -3,6 +3,8 @@ import DeferredFolds.Prelude import qualified DeferredFolds.Prelude as A+import qualified Data.Map.Strict as C+import qualified Data.IntMap.Strict as D {-|@@ -112,6 +114,7 @@ foldable foldable = Unfold (\ step init -> A.foldl' step init foldable) {-| Ints in the specified inclusive range -}+{-# INLINE intsInRange #-} intsInRange :: Int -> Int -> Unfold Int intsInRange from to = Unfold $ \ step init ->@@ -121,3 +124,13 @@ then loop (step state int) (succ int) else state in loop init from++{-# INLINE map #-}+map :: Map key value -> Unfold (key, value)+map map =+ Unfold (\ step init -> C.foldlWithKey' (\ state key value -> step state (key, value)) init map)++{-# INLINE intMap #-}+intMap :: IntMap value -> Unfold (Int, value)+intMap intMap =+ Unfold (\ step init -> D.foldlWithKey' (\ state key value -> step state (key, value)) init intMap)