[Haskell-cafe] Re: File path programme

Peter Simons simons at cryp.to
Mon Jan 31 11:19:46 EST 2005

Robert Dockins writes:

 > 1) File names are abstract entities.  There are a number of
 > ways one might concretely represent a filename. Among these
 > ways are:
 >        a) A contiguous sequence of octets in memory
 >             (C style string on most modern hardware)
 >        b) A sequence of unicode codepoints
 >             (Haskell style string)
 >        c) Algebraic datatypes supporting path manipulations
 >             (yet to be developed)

The solution I have in mind uses algebraic data types which
are parameterized over the actual representation. Thus, you
can use them to represent any type of path (in any kind of
representation). In the spirit of release early, release

  darcs get http://cryp.to/pathspec

The module currently knows only _relative_ paths. I am still
experimenting with absolute paths because I have recently
learned that on Windows something like "C:foo.txt" is
actually relative -- not absolute. Very weird.

There also is a function which changes a path specification
into its canonic form, meaning that all redundant segments
are stripped. So although two paths which designate the same
target may not be equal, they can be tested for equivalence.

Suggestions for enhancement are welcome, of course.


More information about the Haskell-Cafe mailing list