In the documentation for
System.IO, we find the following assertion:
Any I/O errors encountered while a handle is semi-closed are simply discarded.
Encoding and decoding errors are always detected and reported, except during lazy I/O (hGetContents, getContents, and readFile), where a decoding error merely results in termination of the character stream, as with other I/O errors.
Is this really correct, though? This
SO question says that exceptions found during lazy I/O are thrown from pure code, and a
small experiment seems to confirm it. I personally prefer that behaviour, by the way.
Perhaps the documentation should be updated?