H98 Text IO
rl at cse.unsw.edu.au
Tue Feb 26 09:14:41 EST 2008
Duncan Coutts wrote:
> On Wed, 2008-02-27 at 00:31 +1100, Roman Leshchinskiy wrote:
>> Duncan Coutts wrote:
>>> So here is a concrete proposal:
>>> * Haskell98 file IO should always use UTF-8.
>>> * Haskell98 IO to terminals should use the current locale
>> Personally, I'd find this deeply surprising. I don't care that much what
>> locale gets used for I/O (if it matters, you have to deal with it
>> explicitly anyway) as long as it is consistent. 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?
>> Also, would this affect the encoding used for file names? If so, how?
> No, that's a separate issue.
Hmm, so how do I reliably read a list of file names from a file?
More information about the Libraries