:set -fbreak-on-exception in GHCi causes exception in readFile

Sean Leather leather at cs.uu.nl
Fri Nov 20 12:25:08 EST 2009

Perhaps I don't quite get how this works, but when I :set
-fbreak-on-exception in GHCi, I get an exception using readFile. It reads
the entire file and then throws what appears to be an EOF exception.

Prelude> readFile "blah.txt"
> "blah\nblah\nblah\nStopped at <exception thrown>
> _exception ::
>   e = GHC.Exception.SomeException (GHC.Exception.:DException _
> (GHC.Show.:DShow ...) ....)
>                                   (GHC.IOBase.IOError Nothing
> GHC.IOBase.EOF ....)

When I :set -fno-break-on-exception, I see no exception.

I thought that lazy IO reads until it reaches the EOF, then closes the file.
This happens with both 6.10.1 and 6.8.3, so perhaps this is standard stuff,
and I'm missing something.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/glasgow-haskell-users/attachments/20091120/273eacd3/attachment.html

More information about the Glasgow-haskell-users mailing list