Make hGetContents throw an exception if an error is encountered
authorSimon Marlow <marlowsd@gmail.com>
Mon, 12 Oct 2009 15:29:55 +0000 (15:29 +0000)
committerSimon Marlow <marlowsd@gmail.com>
Mon, 12 Oct 2009 15:29:55 +0000 (15:29 +0000)
commitd9b146b931c749029a914cd70a2ff109b83784dc
treebf731a452b64e5f122c8b9b383e5259eea208d10
parentca1b9b70edbc27f97e77f999bda61af7cbef4d9c
Make hGetContents throw an exception if an error is encountered

Strictly speaking this breaks Haskell 98 compatibility, which requires
hGetContents to just end the lazy stream silently if an error is
encountered.  However, for a few reasons we think it will make
everyone's life a bit easier if we make this change

 1. Errors will be a lot more common in GHC 6.12.1, in the form
    of Unicode decoding errors.

 2. When Haskell 98 was designed, we didn't know how to throw
    exceptions from inside lazy I/O, but now we do.

 3. If anyone is actually relying on the previous behaviour, their
    code is arguably broken.
GHC/IO/Handle/Text.hs