patch applied (cabal): First pass at parsing .cabal files as UTF8

Ross Paterson ross at soi.city.ac.uk
Tue Feb 26 04:41:24 EST 2008


On Tue, Feb 26, 2008 at 12:28:56AM -0800, Don Stewart wrote:
L johan.tibell:
> > On Tue, Feb 26, 2008 at 12:09 AM, Don Stewart <dons at galois.com> wrote:
> > >  Add System.IO.UTF8.{readFile,writeFile} to the base library?
> > 
> > I'd rather see that we add a more general solution for reading and
> > writing Unicode than add two functions specialized for UTF-8 that we
> > can't remove later when we do have a less ad-hoc solution.
> 
> Whatever we decide on, I'd like to see it as a standalone library first,
> so we can at least get some experience with it. I'm really more
> suggesting utf8-string as a model -- we don't need to rip apart base to
> get this done.

Those two functions (and appendFile) need to be made portable by using
openBinaryFile instead of openFile, and then they could be recommended.
The handle versions are only safe for binary handles; it's a pity that
these don't have a different type.

I think that we do need, in base, a type distinct from Handle that offers
a Word8 interface to binary I/O, as a foundation for these experiments.
(Let's not call them "Handle" this time.)

Experiments with file operations and operations on binary handles could
proceed independently, but the standard text handles (stdin, stdout and
stderr) can't be peeled off.  Fixing them has to be done inside base.
Would hard-wiring them as UTF-8 be any worse than hard-wiring them as
Latin-1 (which GHC does now)?



More information about the cabal-devel mailing list