H98 Text IO

Ross Paterson ross at soi.city.ac.uk
Tue Feb 26 08:33:56 EST 2008


On Tue, Feb 26, 2008 at 01:07:50PM +0000, Duncan Coutts wrote:
> It'd be nice if there was agreement between the different
> implementations. It seems we're not far from agreement between at least
> hugs, ghc and jhc.
> 
> Ross, perhaps you can put the argument for what hugs currently does -
> always using the locale for all terminal an text file IO rather than
> picking a fixed encoding.

I'm not going claim it's ideal, but the situation created by Haskell 98
is that Handles are supposed to deal in Chars, but their relationship
to external encodings is undefined.  Given that, implementations have to
make a somewhat arbitrary choice.  I suppose the argument for the locale
is the UTF-8 has not yet taken over the world.  I agree that it's weaker
for files and sockets, since they are shared between different systems.

I'm not worried about breaking broken programs.

I'll just note in passing that similar issues arise with system calls,
notably file operations, program arguments and the environment.  But I/O
is probably sufficient trouble for today.


More information about the Libraries mailing list