[Haskell] ANNOUNCE: enumerator, an alternative iteratee package
jmillikin at gmail.com
Thu Aug 19 00:31:23 EDT 2010
Most of you have probably read Oleg's essays on using left-fold
enumerators for incremental IO. In short, by encapsulating monadic
left-folds in an "Iteratee" type, incremental pure processing is
possible without using lazy IO. Sources to read:
Oleg: Streams and Iteratees < http://okmij.org/ftp/Streams.html >
Magnus Therning: Trying to work out iteratees <
cdsmith: Iteratees Step By Step (Part 1) <
John Millikin (me): Understanding Iteratees <
Currently, the primary package for left-fold enumerators is John
Lato's "iteratee". It is based on Oleg's original code, extended to
support various forms of containers, platform-specific IO, and codecs
for the WAV and TIFF formats.
While I appreciate Mr. Lato's development of the package, I find it
far too large, and its documentation too sparse, to effectively use.
To correct this, I've written the "enumerator" package. It is also
derived from Oleg's IterateeM.hs , but with a simplified API and
significantly reduced dependency list.
Hackage entry: http://hackage.haskell.org/package/enumerator
Haddock docs: http://ianen.org/haskell/enumerator/api-docs/
Source code (literate PDF): http://ianen.org/haskell/enumerator/enumerator.pdf
darcs get http://ianen.org/haskell/enumerator/
Additionally, I've included examples of using enumerators to implement
simplified versions of the "cat" and "wc" utilities. These should
serve as a useful starting point for anybody who wants to use
enumerators in their own code:
There are already a few libraries using the existing "iteratee"
package (snap, attoparsec-iteratee, hexpat-iteratee); I am very
interested in advice from the authors of these libraries. In
particular, are any of the removed features (ListLike,
WrappedByteString, seeking) something your libraries depend on? Are
there any useful combinators you'd like to see included?
More information about the Haskell