System.FilePath propsal (Was: Cabal feedback notes)

Simon Marlow simonmar at
Wed Oct 27 05:00:02 EDT 2004

On 26 October 2004 19:30, Krasimir Angelov wrote:

> --- Peter Simons <simons at> wrote:
>> I think the use of FilePath is not a good idea to
>> begin
>> with. A file path should be a data type something
>> like this,
>> IMHO:
>>   type Segment = String
>>   data FilePath = Path [Segment]
>>                 | RootedPath [Segment]
>> You shouldn't write slashes or backslashes which are
>> converted later, you should use a, say :/: operator to build
>> paths portably right from the start.
> I don't think I will be happy with that. Most of I/O
> functions in Haskell uses FilePath as String. If we
> use data type instead of String we need to pretty
> print/parse the structure each time when we use it for
> I/O.

Yes, in some sense having an abstract type or a datatype for FilePaths
would be the right thing.  But it's a much larger change, and would
probably break a lot of code.  

The goal here is just to provide some utilities that already exist in
one form or another in several places.  By all means start discussing
the ultimate FilePath representation separately, though.


More information about the Libraries mailing list