Jon Fairbairn jon.fairbairn at
Fri Sep 28 10:50:18 CEST 2012

Ian Lynagh <ian at> writes:

> On Wed, Sep 26, 2012 at 03:30:50PM +0100, Jon Fairbairn wrote:
>> I have an application where I want to use relative paths in
>> symlinks […]
>> So I want
>> makeRelative "/var/www/this_server/foo/bar/" "/var/www/this_server/bob"
>> to return "../../bob" […]
>> On posix at least, this would permit isRelative (makeRelative a
>> b) always to be True, which is a pleasant property for it to
>> have.
>> Is there any reason that System.FilePath.Posix.makeRelative should not
>> do this? I don’t know enough about non-posix filesystems to know
>> whether it even makes sense elsewhere.
> Coincidentally, I needed this yesterday

So evidently it is useful, and at least two people think it
should work this way :-)

> (in my case, I know that both paths are absolute).

I wrote something similar, but with calls to isAbsolute and use
of System.FilePath.makeRelative

> One thing I wasn't sure of is what to do about different drives on
> Windows. Perhaps it would actually need to return a Maybe FilePath?

That would be an API change. Instead the documentation could
still have a “where possible” clause, but add that it’s always
possible on Posix.

Jón Fairbairn                                 Jon.Fairbairn at

More information about the Libraries mailing list