filepath

Neil Mitchell ndmitchell at gmail.com
Sun Dec 9 16:17:56 EST 2007


Hi

> The first is this:
>     Prelude System.FilePath> "." </> "foo"
>     "./foo"
> which means we get things like
>     [2 of 2] Compiling GHC.Foo          ( ./GHC/Foo.hs, ./GHC/Foo.o )
> rather than
>     [2 of 2] Compiling GHC.Foo          ( GHC/Foo.hs, GHC/Foo.o )
> Is there a reason the result shouldn't be "foo"?

My best guess is that "." </> "foo" should equal "./foo". However, I'm
not overly wedded to this behaviour, so if the general consensus is
the other way, I'll happily implement that.

> Possibly relatedly, the current directory seems to be "" rather than
> ".". This turns up in at least a couple of areas:
>     Prelude System.FilePath> normalise "."
>     ""

I would say this is a bug, and that normalise "." should be ".".

>     Prelude System.FilePath> splitFileName "foo"
>     ("","foo")

I'd say this was expected. In a similar way, takeDirectory "foo" gives
"", not "./".

> This looks like a straightforward bug to me:
>     Prelude System.FilePath> normalise "./"
>     "/"

Woops. I'd have to agree with you there.

> I'm not convinced by
>     Prelude System.FilePath> isValid ""
>     True
> I don't think I could "create a file like it".

Fair enough, I agree with that one too.

> Finally, could splitSearchPath please take an extra argument, a list of
> FilePaths, to be appended to the result if it ends with a : or ; (as
> appropriate)?

Perhaps call it splitSearchPathIncluding? It seems like
splitSearchPath is a sensible enough function already, and the extra
argument won't be typically appropriate.

Thanks

Neil


More information about the Libraries mailing list