packages feed

deferred-folds 0.2.2 → 0.2.3

raw patch · 3 files changed

+20/−2 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ DeferredFolds.FoldlMView: foldM :: Monad m => FoldM m input output -> FoldlMView input -> m output
+ DeferredFolds.FoldlMView: foldlM' :: Monad m => (output -> input -> m output) -> output -> FoldlMView input -> m output

Files

deferred-folds.cabal view
@@ -1,7 +1,7 @@ name:   deferred-folds version:-  0.2.2+  0.2.3 category:   Folding synopsis:
library/DeferredFolds/FoldlMView.hs view
@@ -5,6 +5,9 @@ import qualified DeferredFolds.Prelude as A  +{-|+A monadic variation of "DeferredFolds.FoldView"+-} newtype FoldlMView input =   FoldlMView (forall m output. Monad m => (output -> input -> m output) -> output -> m output) @@ -52,10 +55,25 @@   where     identityStep state input = return (step state input) +{-| Perform a monadic strict left fold -}+{-# INLINE foldlM' #-}+foldlM' :: Monad m => (output -> input -> m output) -> output -> FoldlMView input -> m output+foldlM' step init (FoldlMView run) =+  run step init+ {-| Apply a Gonzalez fold -} {-# INLINE fold #-} fold :: Fold input output -> FoldlMView input -> output fold (Fold step init extract) = extract . foldl' step init++{-| Apply a monadic Gonzalez fold -}+{-# INLINE foldM #-}+foldM :: Monad m => FoldM m input output -> FoldlMView input -> m output+foldM (FoldM step init extract) view =+  do+    initialState <- init+    finalState <- foldlM' step initialState view+    extract finalState  {-| Construct from any foldable -} {-# INLINE foldable #-}
library/DeferredFolds/Prelude.hs view
@@ -19,4 +19,4 @@  -- foldl --------------------------import Control.Foldl as Exports (Fold(..))+import Control.Foldl as Exports (Fold(..), FoldM(..))