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