[Haskell-cafe] Semi-closed handles and I/O errors: misleading documentation?

Daniel Díaz diaz.carrete at gmail.com
Sun Nov 29 17:00:09 UTC 2015


In the documentation for System.IO 
<http://hackage.haskell.org/package/base-4.8.1.0/docs/System-IO.html>, we 
find the following assertion:

Any I/O errors encountered while a handle is semi-closed are simply 
discarded.


also this other one:

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 
<http://stackoverflow.com/questions/16257037/detecting-i-o-exceptions-in-a-lazy-string-from-hgetcontents> 
says that exceptions found during lazy I/O are thrown from pure code, and a small 
experiment <http://stackoverflow.com/a/33985047/1364288> seems to confirm 
it. I personally prefer that behaviour, by the way. 

Perhaps the documentation should be updated?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20151129/17d26529/attachment.html>


More information about the Haskell-Cafe mailing list