System.FilePath propsal (Was: Cabal feedback notes)

Wolfgang Thaller wolfgang.thaller at
Tue Oct 26 11:12:21 EDT 2004

> -- | Normalize the case of a file path. On Unix, this returns the path 
> unchanged;
> -- on case-insensitive filesystems, it converts the path to lowercase. 
> -- On Windows, it also converts forward slashes to backward slashes.
> normalizeCase :: FilePath -> FilePath

I'm afraid I don't like this function. The case-insensitive file 
systems used on Windows and Mac OS X by default are _case-preserving_ 
[well, FAT32 is almost case-preserving], so if you use normalizeCase in 
any other situation than normalizeCase a == normalizeCase b, then it'll 
probably be wrong.

Also, it has been discussed before that Mac OS X, Linux, and probably 
even Windows support mounting both case-sensitive and case-insensitive 
file systems. So whether a file name should be case sensitive really 
depends on where a file is.
So maybe we need

normalizeCase :: FilePath -> IO FilePath

... where the FilePath must refer to an existing file or directory. 
That's definitely not a simple path utility function any more.

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)?



More information about the Libraries mailing list