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

Udo Stenzel u.stenzel at web.de
Thu Jul 27 15:59:37 EDT 2006

Andrew Pimlott wrote:
> On Wed, Jul 26, 2006 at 05:06:41PM -0400, David Roundy wrote:
> > This doesn't apply uniformly to all programs--except that we can say
> > that any path with a trailing '/' is intended to be a directory, and
> > if it's not, then that's an error.
> I thought some more about this, and I think the right way to handle this
> is on parsing and printing.


> After all, the trailing slash has no real
> meaning for any intermediate processing you might do.

Here I beg to differ.  I'd expect:

*> setFileName "foo" "bar" == "bar"
*> setFileName "foo/" "bar" == "foo/bar"

In fact, that's consistent with the current documentation, because

*> getFileName "foo" == "foo"
*> getFileName "foo/" == ""

No matter whether I'm correct, whether my expectation is natural or
practical and whether others agree, the bahaviour has to be clearly
specified and the final slash certainly isn't unimportant.

>     readPath :: String -> (Path, Bool {- trailing delimiter -})
>     showPath :: Path -> String
>     showPathTrailingSlash :: Path -> String
> This is far simpler than trying to figure out what the slash means for
> every path operation.

It's also far uglier...  besides, it isn't about the slash, it is about
the difference between file and directory.

If you cannot in the long run tell everyone what you have been doing,
your doing was worthless.
                -- Erwin Schrödinger
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://www.haskell.org//pipermail/haskell-cafe/attachments/20060727/99cec53a/attachment-0001.bin

More information about the Haskell-Cafe mailing list