igloo at earth.li
Sun Dec 9 08:34:13 EST 2007
I'm having some problems using filepath in GHC. I think some of these we
might have discussed before, but if so I've forgotten what the
conclusion was, if any, and I can't see the answers in the docs.
The first is this:
Prelude System.FilePath> "." </> "foo"
which means we get things like
[2 of 2] Compiling GHC.Foo ( ./GHC/Foo.hs, ./GHC/Foo.o )
[2 of 2] Compiling GHC.Foo ( GHC/Foo.hs, GHC/Foo.o )
Is there a reason the result shouldn't be "foo"?
Possibly relatedly, the current directory seems to be "" rather than
".". This turns up in at least a couple of areas:
Prelude System.FilePath> normalise "."
Prelude System.FilePath> splitFileName "foo"
I expected "." and "./" respectively, rather than the ""s. This causes
problems when giving arguments to library functions or programs, which
generally want "." or "./" rather than "", and if you are displaying a
directory to the user then you again probably don't want to print "".
As an example, I had a problem where GHC was running "gcc -I foo" rather
than "gcc -I. foo".
This looks like a straightforward bug to me:
Prelude System.FilePath> normalise "./"
I'm not convinced by
Prelude System.FilePath> isValid ""
I don't think I could "create a file like it".
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
More information about the Libraries