[Haskell-cafe] Re: ANN: System.FilePath 0.9

Neil Mitchell ndmitchell at gmail.com
Fri Jul 21 12:00:21 EDT 2006


> I haven't been following this discussion very closely, but this caught my eye.
> Has anyone pointed out yet that eliminating ".." in a FilePath isn't valid in
> the presence of symbolic links?  I vaguely recall that this is why Krasimir's
> System.FilePath library doesn't include normalisation.  Normalisation that just
> changes separators, removes redundant separators and removes "." components is
> probably ok.
Ok, I'll remove this behaviour

> I don't really see the point of fullPathWith.  Isn't it just combine?
It also applies normalise to the result, although I'm not sure thats a
particularly useful thing to do. I'll think about this.

> I think shortPath is on dodgy ground, given the difficulty with normalising
> FilePaths, and the fact that paths are not unique in the presence of symlinks.
I think this is still a useful thing, but I'll think harder about it
in relation to symlinks, and figure out what properties it should

> The temporary file stuff is wrong - see System.IO.openTemporaryFile.  The only
> way to reliably create a temporary file is to open it at the same time,
> otherwise there's a race condition.
Looking at it again, I'm not sure that the temporary operations belong
in this module. Ditto for the directory operations. It would be handy
if the directory operations (particularly ensureDirectory) were
somewhere else in the standard libraries though.

> I have some other issues with naming, and the fact that the library mixes IO and
> non-IO functions.
I think this is unavoidable, I tried to make as many functions as
possible pure, but where the filesystem must be consulted they have to
be IO based. For example canonicalPath probably belongs in this
module, but has to be IO based.

>  We should avoid referring to $PATH as the "path", since we
> already have FilePath.
Agreed, but I couldn't come up with a better name, if anyone has any

> Where you use the term Filename, I think it should probably
> be FilePath. I think we should consistently use a single term, preferably FilePath.
I have tried to consistently use FilePath as a path to a file, and
filename as the actual name once you get there. For example:


Has a FilePath of "/usr/bin/ghc" and a FileName of "ghc". That
distinction seems more logical to me, but if everyone thinks otherwise
I'm happy to change it.



More information about the Haskell-Cafe mailing list