Proposal: Add System.FilePath to base

Neil Mitchell ndmitchell at gmail.com
Fri Nov 24 09:53:39 EST 2006


Hi Bulat,

> i think that the best way is to
>
> module FilePath
>
> import FilePath.Windows as Windows
> import FilePath.Unix    as Unix
>
> isProperPath = if weOnWindows
>                  then Windows.isProperPath
>                  else Unix.isProperPath

That results in an awful lot of boilerplate code (about 3 lines per
function), plus reduces the amount of sharing between Windows and Unix
-  they are almost identical. If you look at the current method,
FilePath has all the code, and Windows and Posix use clever CPP hacks
to get it all working. Although these hacks are clever, I don't want
them to go in base, its not good style.

> then GHC can optimize it, throwing away unused branch at compile-time.
> and yhc will work just fine with its portable bytecode

As it stands currently, GHC can optimise and yhc can do it portably.
Hugs can even use it without CPP - everyone should be happy ;)

Thanks

Neil


More information about the Libraries mailing list