quiver 1.1.2 → 1.1.3
raw patch · 2 files changed
+12/−16 lines, 2 files
Files
- quiver.cabal +1/−1
- src/Control/Quiver/SP.lhs +11/−15
quiver.cabal view
@@ -1,5 +1,5 @@ name: quiver-version: 1.1.2+version: 1.1.3 synopsis: Quiver finite stream processing library homepage: https://github.com/zadarnowski/quiver category: Control
src/Control/Quiver/SP.lhs view
@@ -23,7 +23,7 @@ > spconsume, > spfetch, spemit, (>:>), (>>?), (>>!), > sppure, spid, spconcat, spfilter,-> spfold, spfold', spfoldl, spfoldl', spfoldr, spfoldr',+> spfold, spfold', spfoldl, spfoldl', spfoldr, > sptraverse, sptraverse_, > spevery, > spforever,@@ -52,15 +52,15 @@ > -- | A producer version of a simple processor. -> type SProducer b f e = forall a . SP a b f e+> type SProducer b f e = forall b' . Producer b b' f (SPResult e) > -- | A consumer version of a simple processor. -> type SConsumer a f e = forall b . SP a b f e+> type SConsumer a f e = Consumer () a f (SPResult e) > -- | An effect version of a simple processor. -> type SEffect f e = forall a b . SP a b f e+> type SEffect f e = Effect f (SPResult e) > -- | Simple processor result type. @@ -206,20 +206,16 @@ > -- | A processor that delivers the entire input of the stream folded > -- into a single value using the supplied right-associative function > -- and initial value.+> --+> -- Note that this can be quite inefficient for long streams, since+> -- the entire chain of applications of 'f' needs to be materialised+> -- on the heap before it can ever be applied to the final value and+> -- reduced at the end of the stream. > spfoldr :: (a -> b -> b) -> b -> SQ a x f b-> spfoldr f = cloop-> where-> cloop r = spconsume (cloop . flip f r) (deliver r)--> -- | A processor that delivers the entire input of the stream folded-> -- into a single value using strict application of the supplied-> -- right-associative function and initial value.--> spfoldr' :: (a -> b -> b) -> b -> SQ a x f b-> spfoldr' f = cloop+> spfoldr f r = cloop id > where-> cloop r = r `seq` spconsume (cloop . flip f r) (deliver r)+> cloop k = spconsume (\a -> cloop (k . f a)) (deliver (k r)) > -- | A processor that applies a monadic function to every input > -- element and emits the resulting value.