:set -fbreak-on-exception in GHCi causes exception in readFile
Jose Iborra
pepeiborra at gmail.com
Fri Nov 20 12:31:27 EST 2009
This is by design, -fbreak-on-exception breaks on any exception, be it captured or not, even on library code.
I am not sure how readFile is implemented internally, but it probably reads from the file until an eoferror is thrown and then captures it gracefully.
There is another debugger flag, -fbreak-on-error, which only breaks on unhandled exceptions.
Is this what you want ?
Regards,
pepe
On 20/11/2009, at 18:25, Sean Leather wrote:
> 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.
>
> Regards,
> Sean
> _______________________________________________
> Glasgow-haskell-users mailing list
> Glasgow-haskell-users at haskell.org
> http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
More information about the Glasgow-haskell-users
mailing list