[Haskell-cafe] Re: Fwd: Semantics of iteratees, enumerators, enumeratees?

Heinrich Apfelmus apfelmus at quantentunnel.de
Wed Aug 25 04:25:08 EDT 2010


Nicolas Pouillard wrote:
> Heinrich Apfelmus wrote:
>>
>> There are also enumerators and enumeratees. I think that
>>
>>      purpose of enumerator =
>> 	run an iteratee on multiple sources
>>          (i.e. first part of the input from a  Handle ,
>>            second part from a  String )
> 
> I would say more simply that an enumerator is a data-producer (or source).
> Although it is a producer defined as a consumer (or sink) feeder.

Sure, but then why not define them as

    type Enumerator a b = Iteratee a b -> IO b

? After all, I imagine a data producer to feed an Iteratee with tokens 
until it has run to completion.


The reason for the definition

    type Enumerator a b = Iteratee a b -> IO (Iteratee a b)

is that you can now concatenate different input sources.


Regards,
Heinrich Apfelmus

--
http://apfelmus.nfshost.com



More information about the Haskell-Cafe mailing list