Proposal: System.FilePath: current directory should be ".", not ""

Ben Moseley ben_moseley at mac.com
Sat Nov 14 07:42:02 EST 2009


>  A lovely abstract type would be wonderful, but no one has yet  
> released
> such a library on hackage...


I'm certainly not going to claim it's 'lovely' ... but there is now on  
hackage a library which offers an abstract type:

http://hackage.haskell.org/package/pathtype

It's very early days, hasn't been used in anger, doesn't support a lot  
of Windows things yet, but the basics do work.

I'd be grateful for any comments (and of course patches!)

Oh, and....

*System.Path> takeDirectory ("Main.hs"::RelFile)
.


--Ben

On 5 Nov 2009, at 20:36, Neil Mitchell wrote:

> I agree with the idea behind this proposal, but am pretty sure it will
> break quite a few filepath things that I maintain. So +1, but also +1
> for a really strong release announcement and version bump.
>
> The problem with filepaths is that they lack much structure, and are
> very system dependent - meaning every change will break something. A
> lovely abstract type would be wonderful, but no one has yet released
> such a library on hackage...
>
> Thanks, Neil
>
>
> 2009/11/4 Duncan Coutts <duncan.coutts at googlemail.com>:
>> On Wed, 2009-11-04 at 10:00 +0000, Simon Marlow wrote:
>>
>>> I've amended the patch as suggested above, it turned out to be not  
>>> too
>>> hard.
>>
>> [..]
>>
>>> Neil's comprehensive test suite still passes with the new patch.
>>>
>>> Ticket, with new patch attached:
>>>
>>>    http://hackage.haskell.org/trac/ghc/ticket/2034
>>>
>>> The discussion deadline has long passed, so I propose we have  
>>> another 2
>>> weeks (18 November).
>>
>> I support this new proposal.
>>
>>
>> To summarise for people who have not been paying full attention:
>>
>> Currently:
>>        takeDirectory "Main.hs"  =  ""
>>
>> Proposed:
>>        takeDirectory "Main.hs"  =  "./"
>>
>> The purpose being that one can always take the directory and get a  
>> valid
>> path to use with a file system function, eg createDirectory.
>>
>>
>> Unchanged behaviour:
>>
>>        "./" </> "Main.hs"  =  "./Main.hs"
>>
>> It was initially proposed that </> eat "./" on the left hand side but
>> the current proposal leaves the behaviour of </> unchanged.
>>
>> Duncan
>>
>> _______________________________________________
>> Libraries mailing list
>> Libraries at haskell.org
>> http://www.haskell.org/mailman/listinfo/libraries
>>
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://www.haskell.org/mailman/listinfo/libraries



More information about the Libraries mailing list