Translate pull-based stream folds into push-based iteratees.
|Latest on Hackage:||0.3.1.1|
This package is not currently in any snapshots. If you're interested in using it, we recommend adding it to Stackage Nightly. Doing so will make builds more reliable, and allow stackage.org to host generated Haddocks.
What's in this library?
Functions that turn pull-based stream operations from the pipes/streaming ecosystem into push-based, iteratee-like stream operations.
Inspired by the blog post Programmatic translation to iteratees from pull-based code.
Could you go into more detail?
Of these, the first two are pull-based: you take some (possibly effectful) source of values and keep extracting stuff until the source is exhausted and/or you have obtained all the info you need.
Meanwhile, foldl is push-based: foldl folds are not directly aware of any source, they are like little state machines that keep running as long as someone feeds them input.
However, push-based mode also has advantages. Push-based abstractions are not tied to a particular type of source because data is fed externally. And foldl folds have very useful Applicative and Comonad instances.
Also, sometimes a library will only offer a push-based interface.
Wouldn't it be nice if you could adapt already existing pull-based operations to work on push-based consumers? For example, using a decoding function from Pipes.Text.Encoding to preprocess the inputs of a Fold.
This library provides that.
- Added functions with MonadResource contraints.
- Implemented the improvements suggested by Michael Thompson here :
https://groups.google.com/forum/#!topic/haskell-pipes/7n6NPTmxPKY by M.T.
- Removed the newtypes. I mistakenly believed that they were needed to avoid
having to enable -XImpredicativeTypes.
- Eversible, not Evertible!
- Removed special purpose error functions.
- Added some utility functions.
- Added Category instances.