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

Sean Leather leather at cs.uu.nl
Fri Nov 20 13:06:58 EST 2009

> heh, the well known problem, i've seen it in Delphi. it even has a large
> list of exceptions to be ignored, but i think that better way will be
> to set this on a per-package and per-module basis

Yes, that might be a better idea. In general though, it sounds as if
-fbreak-on-error will be useful more often than -fbreak-on-exception. I was
not aware of the former, and I had the latter in my .ghci. I think I'll
remove it from there and just use the OPTIONS pragma when needed.

> > 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/dca255cd/attachment.html

More information about the Glasgow-haskell-users mailing list