H98 Text IO

Ian Lynagh igloo at earth.li
Tue Feb 26 12:16:57 EST 2008


[dropped g-h-u as this is really a libraries discussion, and
cross-posted threads are a pain]

On Tue, Feb 26, 2008 at 02:18:17PM +0000, Simon Marlow wrote:
> Simon Marlow wrote:
> >Duncan Coutts wrote:
> 
> Let's call this one proposal 0:
> 
> >>      * Haskell98 file IO should always use UTF-8.
> >>      * Haskell98 IO to terminals should use the current locale
> >>        encoding.
>
> >  1. all text I/O is in the locale encoding (what C and Hugs do)
> >
> >  2. stdin/stdout/stderr and terminals are always in the locale
> >     encoding, everything else is UTF-8
> >
> >  3. everything is UTF-8

3 is my favourite. It means that if I run
    ./foo
and I want to see exactly what the output was, I can run
    ./foo | hexdump -C
and get something consistent with the first run.


0 breaks the above.

1 means that if you and I both generate a file we don't necessarily get
the same file.

2 I don't like for your "prog in" vs "prog < in" reason, and likewise
"prog -o out" vs "prog > out".


I think it's important that we have some way of sending/getting binary
stuff to/from std*, though (and we need to make sure it plays nicely
with buffering).


Thanks
Ian



More information about the Libraries mailing list