
On Tue, Jan 04, 2011 at 07:57:46PM +0100, Bas van Dijk wrote:
On Tue, Jan 4, 2011 at 4:27 PM, Ross Paterson
wrote: On Tue, Jan 04, 2011 at 04:03:34PM +0100, Henning Thielemann wrote:
Simon Marlow schrieb:
Good plan. I'll make a proposal to add System.IO.binary. A different type for binary handles is the right thing, but it's a larger undertaking so I don't plan to attack it right now (someone else is welcome to do so).
Isn't this also the purpose of the safer-file-handles package?
No, that puts the IOMode and region in the type, not the binary mode.
Indeed. However, I would be glad to add such a safety feature if we can distill a nice API.
What would such an API look like?
My simplistic thought was to to make System.IO.Binary essentially a copy of System.IO minus the text-only operations, with its own Handle type and hClose, etc. Apart from the name clashes, the issues I could see were: - instead of setBinaryMode and setEncoding, you'd have operations to convert between the Handle types, with the extra requirement that the argument Handle not be used later. - you'd probably need both binary and text versions of stdin, stdout and stderr, with a requirement that you only use one of them.