Proposal: Add System.FilePath to base

Simon Marlow simonmarhaskell at
Thu Nov 23 05:41:22 EST 2006

Neil Mitchell wrote:

> I guess most people saw this coming, but here is the proposal to add
> System.FilePath to base. The System.FilePath module is located at

I don't object to putting this in the base package.

There's one outstanding issue I still have with the design:  I suggest removing

isDirectory :: FilePath -> Bool
isFile :: FilePath -> Bool
asDirectory :: FilePath -> FilePath
asFile :: FilePath -> FilePath

At the least, they are confusingly named, because

   forall x. isDirectory (takeDirectory x) == False

(and I definitely don't suggest fixing this by making takeDirectory append a
path separator).

The point is, the absence of a path separator at the end of a FilePath does not
imply that the FilePath refers to a file rather than a directory.

If we must have these, then I suggest renaming them:

   hasTrailingPathSeparator :: FilePath -> Bool
   addTrailingPathSeparator :: FilePath -> FilePath
   dropTrailingPathSeparator :: FilePath -> FilePath

Also, what's going on with System.FilePath.Windows and System.FilePath.Posix?
Their documentation is empty.  CPP shenanigans?


More information about the Libraries mailing list