System.FilePath propsal (Was: Cabal feedback notes)

Graham Klyne GK at ninebynine.org
Wed Oct 27 09:58:00 EDT 2004


Doing a quick scan...  Generally it looks pretty good, but without actually 
trying to use it I can't be sure.  I have some small questions:


1. How are multiple extensions handled?  (e.g. foo.tar.gz)  I think this is 
catered for, with the final extension being picked off.


2. How does path joining work in this case:

    joinPaths C:/root/path/file.ext altPath/file2.ext2

i.e. is "file.ext" discarded?


3. What is the purpose of commonInit?


Also, a very small point:  I forgot that FilePath is defined in the 
prelude... maybe a comment to this effect on the module export list?

...

[later]

I tend to agree with the comments about case normalization.  maybe better 
to have a path comparison function that takes system-dependent equivalences 
into account?

I'm rather taken by the approach that Peter Simons suggests [1] 
(abstracting the path composition), but I suspect there are more details to 
be worked out there.  It also makes my earlier suggestion [2] of using a 
URI-based representation as a common abstraction seem slightly less 
radical.  I also note Simon's comments on this (don't do it yet_) are 
persuasive.  I'll reserve my campaign to unify filenames and URIs for the 
"ultimate" FilePath abstraction ;-)

[1] http://www.haskell.org//pipermail/libraries/2004-October/002593.html

[2] http://www.haskell.org//pipermail/libraries/2004-August/002416.html

#g
--

At 06:33 26/10/04 -0700, Krasimir Angelov wrote:
>--- Simon Marlow <simonmar at microsoft.com> wrote:
> > Last time this came up I asked for a concrete
> > proposal, but no-one came
> > forward with one.  I'd do it myself, but I'm kind of
> > busy right now.
> > Would someone care to whip up a list of functions &
> > signatures?
>
>Ok. Here is one concrete proposal for System.FilePath.
>It contains nearly all useful FilePath functions from
>Cabal, .Net's System.IO.Path and Python's OS.Path.
>There are only few exceptions:
>
>    - findBinary from Cabal isn't included here. I
>think that System.Directory is more appropriate place.
>    - OS.Path provides expanduser function which
>replaces ~ and ~user with the right home directories.
>I am not sure how to do this in platform independent
>way. Maybe on Windows this function must be identity.
>    - OS.Path provides expandvar function which
>replaces $var and ${var} with the value of the
>corresponding environment variable. I am not sure
>wheter this function should be there since it can be
>used to replace values in any text. Maybe
>System.Environment is better place for it. Another
>issue is whether it must replace $var or %var% under
>Windows. %var% is more natural for Windows.
>
>Some function names are slightly different from those
>in Cabal. Propsals for future extensions and better
>function names are welcome.
>
>Cheers,
>   Krasimir
>
>
>
>__________________________________
>Do you Yahoo!?
>Yahoo! Mail - Helps protect you from nasty viruses.
>http://promotions.yahoo.com/new_mail
>_______________________________________________
>Libraries mailing list
>Libraries at haskell.org
>http://www.haskell.org/mailman/listinfo/libraries

------------
Graham Klyne
For email:
http://www.ninebynine.org/#Contact



More information about the Libraries mailing list