packages feed

deferred-folds 0.6 → 0.6.1

raw patch · 4 files changed

+10/−1 lines, 4 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ DeferredFolds.Unfold: filter :: (a -> Bool) -> Unfold a -> Unfold a
+ DeferredFolds.UnfoldM: filter :: Monad m => (a -> m Bool) -> UnfoldM m a -> UnfoldM m a

Files

deferred-folds.cabal view
@@ -1,7 +1,7 @@ name:   deferred-folds version:-  0.6+  0.6.1 category:   Folding synopsis:
library/DeferredFolds/Prelude.hs view
@@ -9,6 +9,7 @@ ------------------------- import Prelude as Exports hiding ((<>)) import Foreign as Exports hiding (void)+import Data.Bool as Exports import Data.Monoid as Exports hiding ((<>), First(..), Last(..)) import Data.Semigroup as Exports import Data.Foldable as Exports
library/DeferredFolds/Unfold.hs view
@@ -123,6 +123,10 @@ foldable :: Foldable foldable => foldable a -> Unfold a foldable foldable = Unfold (\ step init -> A.foldl' step init foldable) +{-# INLINE filter #-}+filter :: (a -> Bool) -> Unfold a -> Unfold a+filter test (Unfold run) = Unfold (\ step -> run (\ state element -> if test element then step state element else state))+ {-| Ints in the specified inclusive range -} {-# INLINE intsInRange #-} intsInRange :: Int -> Int -> Unfold Int
library/DeferredFolds/UnfoldM.hs view
@@ -91,6 +91,10 @@ foldable :: (Monad m, Foldable foldable) => foldable a -> UnfoldM m a foldable foldable = UnfoldM (\ step init -> A.foldlM step init foldable) +{-# INLINE filter #-}+filter :: Monad m => (a -> m Bool) -> UnfoldM m a -> UnfoldM m a+filter test (UnfoldM run) = UnfoldM (\ step -> run (\ state element -> test element >>= bool (return state) (step state element)))+ {-| Ints in the specified inclusive range -} intsInRange :: Monad m => Int -> Int -> UnfoldM m Int intsInRange from to =