[Haskell-cafe] Data.Enumerator question

Ertugrul Soeylemez es at ertes.de
Fri Jun 24 08:23:56 CEST 2011


David Place <d at vidplace.com> wrote:

> I can see that an Enumeratee can produce fewer outputs than it
> receives as inputs.  For example, this GroupBy Enumeratee.
>
> > http://hpaste.org/47916
>
> Can an Enumeratee produce more outputs than inputs?  For instance,
> take a Data.Text and send each character to the inner Iteratee
> individually.  I feels this can be done, but don't see how to do it.

Yes.  Just look at the definition of Enumeratee.  It is an iteratee
function, which takes an iteratee (by its Step value) and produces
another iteratee, possibly with additional input.  It can pass the
iteratee any input it wants, possibly dependent on the outer input
stream.

In other words, the enumeratee is an iteratee, which consumes an input
stream and derives from it the input stream of another iteratee.  It is
well possible to simply ignore the outer input stream (in which case you
have about the same functionality as a regular enumerator).


Greets,
Ertugrul


-- 
nightmare = unsafePerformIO (getWrongWife >>= sex)
http://ertes.de/





More information about the Haskell-Cafe mailing list