
Ross Paterson wrote:
On Tue, Feb 26, 2008 at 11:47:49AM +0000, Duncan Coutts wrote:
The major problem is with code that assumes GHC's Handles are essentially Word8 and layer their own UTF8 or other decoding over the top. The utf8-string package has this problem for example. Such code should be using openBinaryFile because they are reading/writing binary data, not String text.
As I was saying on cabal-devel, I think this distinction ought to be in the types, i.e. we need, in base, a type distinct from Handle that offers a Word8 interface to binary I/O, as a foundation for various experiments with encodings (which need not all be in base).
I agree with a separate handle type, but Duncan's proposal is all about "fixing" the fact that the H98 library doesn't implement the H98 spec. I think that proposal should pass independently. I then think that a System.IO.Binary library, which provides a newtyped Handle for Word8 IO would be an excellent thing to propose next! Jules