System.FilePath propsal (Was: Cabal feedback notes)

Peter Simons simons at cryp.to
Tue Oct 26 12:36:10 EDT 2004


Wolfgang Thaller writes:

 >> On Windows, it also converts forward slashes to backward
 >> slashes.

 >> normalizeCase :: FilePath -> FilePath

 > Are there enough situations where the simple but not
 > quite correct pure normalizeCase function would be The
 > Right Thing (or at least Sufficiently Close To The Right
 > Thing)?

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. 

Peter



More information about the Libraries mailing list