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

Bulat Ziganshin bulat.ziganshin at gmail.com
Fri Nov 20 12:42:07 EST 2009

Hello Sean,

Friday, November 20, 2009, 8:25:08 PM, you wrote:

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

> 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

Best regards,
 Bulat                            mailto:Bulat.Ziganshin at gmail.com

More information about the Glasgow-haskell-users mailing list