[Haskell-cafe] Towards a single, unified API for incremental data processing

John Millikin jmillikin at gmail.com
Sun Apr 1 21:50:01 CEST 2012


There are currently several APIs for processing strict monoidal values
as if they were pieces of a larger, lazy value. Some of the most
popular are based on Oleg's left-fold enumerators, including the
"iteratee", "enumerator", "iterIO". Other choices include "comonads",
"conduits", and "pipes".

Despite having various internal implementations and semantics, these
libraries generally export a similar-looking API. This is a terrible
duplication of effort, and it causes dependant packages to be strongly
tied to the underlying implementation.

I propose that a new package, "tzinorot", be written to provide a
single API based on Data.List. It should be pretty easy to use,
requiring only a few common extensions to the type system.

For example, the enumerator package's 'mapM' function could be
generalized for use in tzinorot through a few simple modifications to
the type signature:

----------
-- enumerator mapM
mapM :: Monad m => (ao -> m ai) -> Enumeratee ao ai m b

-- tzinorot mapM
mapM :: (Monad m, Tzinorot t, ListLike l1 a1, ListLike l2 a2) => (l1
a1 -> m (l2 a2)) -> t Void s (TzinorotItems (l1 a1)) (TzinorotItems
(l2 a2)) m r
----------

To make it easier to install and use the tzinorot package, it will
depend on all of its supported implementations (iteratee, enumerator,
conduits, pipes, etc), and use Michael Snoyman's "cabala" tool to
manage dependency versions. See the cabala announcement for details on
use:

http://www.yesodweb.com/blog/2012/04/replacing-cabal



More information about the Haskell-Cafe mailing list