[Haskell-cafe] File path programme
k.schupke at imperial.ac.uk
Wed Jan 26 10:50:21 EST 2005
Malcolm Wallace wrote:
> Good point. Ideally, you want to be able to write all FilePath code
>polymorphically at type (Path p => p), and have a decent defaulting
>mechanism available to choose a particular instance at compile time
>(perhaps conditionally, based on OS platform).
>Sadly, in the absence of a better 'default' declaration semantics,
>we are left having to resolve the ambiguity ourselves, or resort to
>some other type-system extension, like as you say existentials.
You could define a type in the library using conditional compilation:
type SystemPath = UnixPath
type SystemPath = WindowsPath
Then you do:
let myPath = (emptyPath :: SystemPath) in ...
More information about the Libraries