[Haskell-cafe] File path programme

Keean Schupke k.schupke at imperial.ac.uk
Thu Jan 27 06:33:21 EST 2005

>I guess it's just that I'm more concerned with making possible what is
>currently impossible (according to the library standards)--that is, using
>FFI and IO on the same file--rather than just adding utility features that
>application developers could have written themselves.  I suppose we don't
>need a class for this, all we need is a couple of functions to convert
>between FilePath and CString.
Except paths are different on different platforms... for example:

/a/b/../c/hello\ there/test



notice how the backslash is used to 'escape' a space or meta-character on
unix, but is the path separator for windows. If you want to write portable
applications, then you dont want to hard code the platform type. So 
from the datatype to a string is not simple:

    string = pathToString ...

one way of doing this is to have pathToString call a function to 
determine the
system type and construct the string accordingly. The problem here is 
that it is
not extensible by the user, the supported platforms are determined by 
the library.
By using a class we can let the user define translations for new 


More information about the Haskell-Cafe mailing list