wnoise at ofb.net
Sun Dec 9 16:32:13 EST 2007
On 2007-12-09, Neil Mitchell <ndmitchell at gmail.com> wrote:
>> 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 )
>> 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.
Concur that "./foo" is correct.
>> 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"
> I'd say this was expected. In a similar way, takeDirectory "foo" gives
> "", not "./".
If the result type of splitFileName must be (String, String), I think
this is the best embedding of no directory into String. However, I
think that this might be the wrong API. (Maybe String, String) would be
better. (And Maybe String for takeDirectory).
More information about the Libraries