[Haskell-cafe] System.FilePath, Request for comments

Neil Mitchell ndmitchell at gmail.com
Thu Jun 29 14:14:02 EDT 2006


> 1) there are two independent filepath modules used with little
> modifications in all projects i seen. They both included in MissingH
> (FilePath.hs and NameManip.hs).
>From what I can tell, FilePath.hs is the one from Cabal, which I
already used as a reference. As far as I can tell, this library is
also a superset of NameManip.hs.

> 2) As you can see in this February discussion, one of debatable
> question was support of ADTs for filanames. We can talk about this
> now. Currently there is ByteStrings with forecoming UTF-8 support and
> it's possible to implement FilePath module so it will work both with
> filenames represented by String and ByteString. It's also possible to
> add support of such filenames to IO library (at least, my own)
I jumped with "no" - since it breaks things like readFile/writeFile. I
would rather something more practical and less pure/safe thats
immediately useable with less cost. Of course, I hope the interface
does not make any demands on the representation - and that other
FilePath's could be used in place, in a similar way to ByteString and
ByteString.Lazy coexisting with the same interface but different

The other important point regarding ADT's is what is a FilePath and
what is a String? If I set the extension of a FilePath, is that
extension itself a FilePath or a String? What if I set the drive or
the filename? Is a filename on its own a FilePath? Even though it
doesn't correspond to a file, because its lost its context/directory
and therefore cannot be used?



More information about the Haskell-Cafe mailing list