
On Wed, 15 Sep 2004, Glynn Clements wrote:
Henning Thielemann wrote:
I even plead for an abstract data type FilePath which supports operations like 'enter a directory', 'go one level higher' and so on.
Are you referring to "pure" operations on the FilePath, e.g. appending and removing entries?
Yep, thus the signature should be like parentDirectory :: FileName -> FilePath -> FilePath
That's reasonable enough. But it needs to be borne in mind that there's a difference between:
setCurrentDirectory ".." and: dir <- getCurrentDirectory setCurrentDirectory $ parentDirectory dir
[where parentDirectory is a pure FilePath -> FilePath function.]
if the last component in the path is a symlink.
If you want to make FilePath an instance of Eq, the situation gets much more complicated.
I agree, though these are not problems introduced by the abstraction of FilePath but they already exist for FilePath = String.