On 15 September 2004 12:32, [EMAIL PROTECTED] wrote: > On Mon, Sep 13, 2004 at 12:01:58PM +0100, Glynn Clements wrote: >> My view is that, right now, we have the worst of both worlds, and >> taking a short step backwards (i.e. narrow the Char type and leave >> the rest alone) is a lot simpler (and more feasible) than the long >> journey towards real I18N. > > This being Haskell, I can't imagine a consensus on a step backwards. > In any case, a Char type distinct from bytes and the rest is the most > valuable part of the current situation. The rest is just libraries, > and the solution to that is to create other libraries. (It's true > that the Prelude is harder to work around, but even that can be done, > as with the new exception interface.) Indeed more than one approach > can proceed concurrently, and that's probably what's going to happen: > > The Right Thing proceeds in stages: > 1. new byte-based libraries > 2. conversions sitting on top of these > 3. the ultimate I18N API > > The Quick Fix: alter the existing implementation to use the > encoding determined by the current locale at the borders.
I wish I had some more time to work on this, but I implemented a prototype of an "ultimate" i18n API recently. This is derived from the API that Ben Rudiak-Gould proposed last year. It is in two layers: the InputStream/OutputStream classes provide raw byte I/O, and the TextStream class provides a conversion on top of that. The prototype uses iconv for conversions. You can make Streams from all sorts of things: files, sockets, pipes, and even Haskell arrays. InputStream and OutputStreams are just classes, so you can implement your own. IIRC, I managed to get it working with speed comparable to GHC's current IO library. Here's a tarball that works with GHC 6.2.1 on a Unix platform, just --make to build it: http://www.haskell.org/~simonmar/new-io.tar.gz If anyone would like to pick this up and run with it, I'd be delighted. I'm not likely to get back to in the short term, at least. Cheers, Simon _______________________________________________ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell-cafe