iteratee patch: last does not behave nicely on EOF

John Lato jwlato at gmail.com
Tue Mar 1 22:49:43 GMT 2011


Hello,

Thanks very much for sending this patch.  I agree that this is incorrect
behavior.

It appears I hadn't pushed the patches for 0.8.1.1 to head.  This is done
now, and I've pushed your patch as well.  I also added a regression test for
this case.

I also uploaded this to hackage as iteratee-0.8.1.2.  This is the only
change from the previous version.

Thanks,
John

On Fri, Feb 25, 2011 at 5:36 AM, Akio Takano <tkn.akio at gmail.com> wrote:

> 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
>
> _______________________________________________
> Iteratee mailing list
> Iteratee at projects.haskell.org
> http://projects.haskell.org/cgi-bin/mailman/listinfo/iteratee
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://projects.haskell.org/pipermail/iteratee/attachments/20110301/cc303fab/attachment.html>


More information about the Iteratee mailing list