[Haskell-cafe] Re: Writing binary files?

Simon Marlow simonmar at microsoft.com
Thu Sep 16 05:01:55 EDT 2004

On 16 September 2004 00:02, Glynn Clements wrote:

> Which is why I'm suggesting changing Char to be a byte, so that we can
> have the basic, robust API now and wait for the more advanced API,
> rather than having to wait for a usable API while people sort out all
> of the issues.

An easier way is just to declare that the existing API assumes a Latin-1
encoding consistently.  Later we might add a way to let the application
pick another encoding, or request that the I/O library uses the locale

Existing code continues to work, and there are no conceptual problems (a
Char is still Unicode).

You have to decide what happens when the programmer tries to output a
Char that is out of range for Latin-1.  The current behaviour is simply
to take the code point mod 0x100, but we could also decide to raise an
exception in this case.


More information about the Haskell-Cafe mailing list