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

Heinrich Apfelmus apfelmus at quantentunnel.de
Wed Sep 1 08:10:22 EDT 2010


Tilo Wiklund wrote:
> Daniel Fischer wrote:
>> [...]
>> Well, I just gave an example where one would want chunking for reasons
>> other than performance. That iteratees don't provide the desired
>> functionality is a different matter.
>> [...]
> 
> In the case of hashing, wouldn't it be more reasonable to consider
> iterators over streams of fixed (or at least predictable) sized chunks
> (where a set of chunks can themselves be chunked), with the chunking
> behaviour being given by another iteratee over the original stream?
> 
> It seems to me that one of the major points of iteratees is to provide
> an abstraction from the kind of chunking irrelevant to the parsing
> logic, otherwise I fail to see any difference (at least relevant to
> chunking) to plain strict IO.

I thought so, too, but I was informed[1] that iteratees are just a small 
step up the abstraction ladder. The difference compared to an ordinary 
file  Handle  is that you can now reuse one and the same iteratee for 
reading from a  String , for instance, without changing the source code 
of the iteratee.

Furthermore, iteratees can be suspended, which facilities resource 
management like closing files handles after they've been read.

   [1]: 
http://www.reddit.com/r/haskell/comments/ar4wb/understanding_iteratees/c0j0f3r



Regards,
Heinrich Apfelmus

--
http://apfelmus.nfshost.com



More information about the Haskell-Cafe mailing list