[Haskell-cafe] RE: ANN: System.FilePath 0.9
andrew at pimlott.net
Wed Jul 26 14:46:22 EDT 2006
On Wed, Jul 26, 2006 at 04:34:50PM +0100, Duncan Coutts wrote:
> On Wed, 2006-07-26 at 15:29 +0200, Udo Stenzel wrote:
> > Exactly. I believe, a FilePath should be an algebraic datatype.
> > Most operations on that don't have to be specified, because they are
> > simple and have an obvious effect. Add a system specific parser and a
> > system specific renderer, maybe also define a canonical format, and the
> > headaches stop. What's wrong with this?
> We've had this discussion before. The main problem is that all the
> current IO functions (readFile, etc) use the FilePath type, which is
> just a String.
Geesh, just provide a few wrappers. If we make this a show-stopper,
we'll never get there.
> That's another portability headache - file name string encodings.
> Windows and OSX use encodings of Unicode. Unix uses strings of bytes.
> They are not fully inter-convertible. On Unix the traditional technique
> is to keep a system file name in the original encoding and convert to
> Unicode to display to the user, but the Unicode version is never
> converted back to a system file name because it doesn't necessarily
> convert back to the same sequence of bytes.
The only solution for this, IMO, is to provide different types for
different systems. Hence my typeclass approach. (Which I'm not saying
is good enough to cover for all these differences yet.)
More information about the Haskell-Cafe