[Haskell-cafe] Re: Ready for testing: Unicode support for Handle I/O

Simon Marlow marlowsd at gmail.com
Wed Feb 4 08:25:11 EST 2009

Paolo Losi wrote:
> Simon Marlow wrote:
>> The only change to the existing behaviour is that by default, text IO
>> is done in the prevailing encoding of the system.  Handles created by
>> openBinaryFile use the Latin-1 encoding, as do Handles placed in
>> binary mode using hSetBinaryMode.
> wouldn't be semantically correct for a "binary handle"
> to "return" [Word8]?
> also switching from text to binary (hSetBinaryMode)
> doesn't seem "natural"

Yes, and as I said in the original message I haven't done the binary/text 
separation (yet).  I agree it's something that should be done, and the 
current API leaves a lot to be desired, but the main goal was to get 
Unicode text I/O working without breaking any existing code (or at least 
without breaking any code that isn't already morally broken :-).  As a 
side-effect I managed to do some useful refactoring which should make 
further separation of layers much easier.

So you should think of this as a step in the right direction, with further 
steps to come in the future.

A while back there was a lot of activity on developing new IO library 
designs.  There are a bunch of these: Bulat's streams library, a variant of 
Bulat's done by Takano Akio, John Goerzen's HVIO, and I had a prototype 
streams library too.  The problem is, it's a lot of work to make a complete 
IO library implementation, agree on the API, and migrate over from the old 
one.  And while we're on the subject of redesigning IO libraries, it's not 
at all clear that the imperative approach is the right one either.


More information about the Haskell-Cafe mailing list