The conduit package
Conduits are an approach to the streaming data problem. It is meant as an alternative to enumerators/iterators, hoping to address the same issues with different trade-offs based on real-world experience with enumerators. For more information, see http://www.yesodweb.com/book/conduit.
- ResourceT has been greatly simplified, specialized for IO, and moved into a separate package. Instead of hard-coding ResourceT into the conduit datatypes, they can now live around any monad. The Conduit datatype has been enhanced to better allow generation of streaming output. The SourceResult, SinkResult, and ConduitResult datatypes have been removed entirely.
- Instead of storing state in mutable variables, we now use CPS. A
Sourcereturns the next
Source, and likewise for
Conduits. Not only does this take better advantage of GHC's optimizations (about a 20% speedup), but it allows some operations to have a reduction in algorithmic complexity from exponential to linear. This also allowed us to remove the
Preparedset of types. Also, the
sinkState) use better constructors for return types, avoiding the need for a dummy state on completion.
BufferedSourceis now an abstract type, and has a much more efficient internal representation. The result was a 41% speedup on microbenchmarks (note: do not expect speedups anywhere near that in real usage). In general, we are moving towards
BufferedSourcebeing a specific tool used internally as needed, but using
Sourcefor all external APIs.
- Initial release.
Turn on some runtime check to ensure invariants are respected.
Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info
For package maintainers and hackage trustees