packages feed

deferred-folds 0.6.2 → 0.6.3

raw patch · 2 files changed

+13/−1 lines, 2 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ DeferredFolds.UnfoldM: foldlRunner :: Monad m => (forall x. (x -> a -> x) -> x -> x) -> UnfoldM m a
+ DeferredFolds.UnfoldM: foldrRunner :: Monad m => (forall x. (a -> x -> x) -> x -> x) -> UnfoldM m a

Files

deferred-folds.cabal view
@@ -1,7 +1,7 @@ name:   deferred-folds version:-  0.6.2+  0.6.3 category:   Folding synopsis:
library/DeferredFolds/UnfoldM.hs view
@@ -65,10 +65,12 @@ foldlM' step init (UnfoldM run) =   run step init +{-| A more efficient implementation of mapM_ -} {-# INLINE mapM_ #-} mapM_ :: Monad m => (input -> m ()) -> UnfoldM m input -> m () mapM_ step = foldlM' (const step) () +{-| Same as 'mapM_' with arguments flipped -} {-# INLINE forM_ #-} forM_ :: Monad m => UnfoldM m input -> (input -> m ()) -> m () forM_ = flip mapM_@@ -91,6 +93,16 @@ {-# INLINE foldable #-} foldable :: (Monad m, Foldable foldable) => foldable a -> UnfoldM m a foldable foldable = UnfoldM (\ step init -> A.foldlM step init foldable)++{-| Construct from a specification of how to execute a left-fold -}+{-# INLINE foldlRunner #-}+foldlRunner :: Monad m => (forall x. (x -> a -> x) -> x -> x) -> UnfoldM m a+foldlRunner run = UnfoldM (\ stepM state -> run (\ stateM a -> stateM >>= \state -> stepM state a) (return state))++{-| Construct from a specification of how to execute a right-fold -}+{-# INLINE foldrRunner #-}+foldrRunner :: Monad m => (forall x. (a -> x -> x) -> x -> x) -> UnfoldM m a+foldrRunner run = UnfoldM (\ stepM -> run (\ x k z -> stepM z x >>= k) return)  {-| Filter -} {-# INLINE filter #-}