iteratee patch: last does not behave nicely on EOF
Akio Takano
tkn.akio at gmail.com
Fri Feb 25 05:36:26 GMT 2011
Hi,
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
iteratee-0.8.1.1.
I attached a proposed patch to fix the problem. It's against
iteratee-0.8.1.0, as I couldn't find a repository with the latest
source.
Regards,
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
I.last
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: <http://projects.haskell.org/pipermail/iteratee/attachments/20110225/71334e77/attachment.obj>
More information about the Iteratee
mailing list