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

Heinrich Apfelmus apfelmus at quantentunnel.de
Mon Aug 23 03:06:07 EDT 2010

Conal Elliott wrote:
> For anyone interested in iteratees (etc) and not yet on the iteratees
> mailing list.
> I'm asking about what iteratees *mean* (denote), independent of the various
> implementations.  My original note (also at the end below):

In my world view, iteratees are just a monad M with a single operation

     symbol :: M Char

that reads the next symbol from an input stream. In other words, they're 
a very simple parser monad. The emphasis is not on parsing, but on the 
fact that one and the same monadic value can be run on different streams

     runHandle     :: M a -> Handle -> IO a
     runString     :: M a -> String -> a
     runByteString :: M a -> ByteString -> a

The monad M may also include convenience like exceptions and  liftIO .

I have omitted the chunking [Char] because I don't like it; invariance 
with respect to the chunk sizes is something that should be left to the 
iteratee abstraction.

Heinrich Apfelmus


More information about the Haskell-Cafe mailing list