[Haskell-cafe] using IO monad in Iteratee

John Millikin jmillikin at gmail.com
Sat Apr 2 16:39:53 CEST 2011


Use enumHandle.

enumFile deals with the common case of "read from the filesystem in IO". It 
can't deal with general MonadIO monads because there'd be no guarantee that 
the handle would actually be closed (eg, an ErrorT IO might never run the 
cleanup).

If you need a special monad, do something like:

withBinaryFile $ \h -> runMyMonad (run_ (enumHandle h $$ myIter))
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20110402/b33b3e92/attachment.htm>


More information about the Haskell-Cafe mailing list