H98 Text IO

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Tue Feb 26 16:24:55 EST 2008


On Wed, 2008-02-27 at 01:14 +1100, Roman Leshchinskiy wrote:
> Duncan Coutts wrote:
> > On Wed, 2008-02-27 at 00:31 +1100, Roman Leshchinskiy wrote:

> >> I'm probably mistaken,
> >> but doesn't this proposal mean that I can't implement cat in H98 using
> >> text I/O? That would be a bit disturbing.
> > 
> > You've never been able to do that with the guarantees provided by H98.
> 
> As a matter of fact, 21.10.2 from the Haskell Report suggests that at 
> least copying text files should be possible. Unless I'm mistaken, your 
> proposal would invalidate that example somewhat.

> This begs another question. What exactly does "current locale" mean, 
> given that we have lazy I/O and the locale can be changed on the fly?

The current locale is a Posix concept. There are posix functions for
changing it.

I'd suggest that a Handle inherits the current locale as its encoding at
the point of creation of the Handle. Further changes to the posix locale
would not change any existing open Handles.

If we were to provide an action to change the encoding of an open Handle
then it is clear that it cannot act on semi-closed handles. That'd make
lazy IO ok.



More information about the Libraries mailing list