
On Wed, Jul 26, 2006 at 05:06:41PM -0400, David Roundy wrote:
cp(1), for example, treats paths with trailing separators differently from paths without.
This doesn't apply uniformly to all programs--except that we can say that any path with a trailing '/' is intended to be a directory, and if it's not, then that's an error. But the trouble is that if you silently drop the '/', then the only way for me to implement a correct cp(1) in Haskell is to not use your proposed interface for pathname handling, which drops this information.
I thought some more about this, and I think the right way to handle this is on parsing and printing. After all, the trailing slash has no real meaning for any intermediate processing you might do. So if the type used by my path operations is Path, I might have something like readPath :: String -> (Path, Bool {- trailing delimiter -}) showPath :: Path -> String showPathTrailingSlash :: Path -> String This is far simpler than trying to figure out what the slash means for every path operation. Andrew