Open
Description
Pulling out from #12 (comment), I think most path/drive based functions (but not extension functions) should first parse their path, then modify, then render it. That gives a much smaller "trusted core" of FilePath.
data Lexeme = Drive Char | UNC String | Separator Char | Path String
parse :: String -> [Lexeme]
display :: [Lexeme] -> String
display = concatMap $ \x -> case x of
Drive x -> [x,':'] -- x will be an ASCII character
UNC x -> '\\':'\\':x -- x will be a UNC name, not containing any pathSeparators
Separator x -> x -- x will be a member of pathSeparators
Path x -> x -- x will not contain any pathSeparators
We would rely on the property display . parse == id
, so likely UNC would need extending to say which type of separators it was, whether it had ?
etc.