[Haskell-cafe] Suggested additions to System.FilePath.Posix/Windows

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Sat Sep 19 07:45:00 EDT 2009


On Thu, 2009-09-17 at 11:58 +0200, Marcus D. Gabriel wrote:

> > -- | 'reduceFilePath' returns a pathname that is reduced to canonical
> > -- form equivalent to that of ksh(1), that is, symbolic link names are
> > -- treated literally when finding the directory name.  See @cd -L@ of
> > -- ksh(1).  Specifically, extraneous separators @(\"/\")@, dot
> > -- @(\".\")@, and double-dot @(\"..\")@ directories are removed.
> >
> > reduceFilePath :: FilePath -> FilePath
> > reduceFilePath = joinPath . filePathComponents

So it's like the existing System.Directory.canonicalizePath but it's
pure and it does not do anything with symlinks. On the other hand
because it's pure it can do something with non-local paths.

Is there anything POSIX-specific about this? I don't see it.

Duncan



More information about the Haskell-Cafe mailing list