iteratee patch: last does not behave nicely on EOF

Akio Takano tkn.akio at
Fri Feb 25 05:36:26 GMT 2011


I experienced some cases where iteratees involving `last' do not move
to the Done state after receiving EOF. For example, the following
program should print Nothing but it dies with EofException. I'm using

I attached a proposed patch to fix the problem. It's against
iteratee-, as I couldn't find a repository with the latest

Takano Akio

import Control.Monad.Trans (liftIO)
import Data.Iteratee.Iteratee
import qualified Data.Iteratee.ListLike as I

main = enumPure1Chunk [1..10] myIter >>= run

myIter :: Iteratee [Int] IO ()
myIter = do
   x <- I.peek
   liftIO $ print x
-------------- next part --------------
A non-text attachment was scrubbed...
Name: last.dpatch
Type: application/octet-stream
Size: 773 bytes
Desc: not available
URL: <>

More information about the Iteratee mailing list