Reimplement path functions around ADT
- Dominant language
- Haskell
- Stars
- 74
- Forks
- 38
- PR merge metrics
- No merged PRs in 30d
Description
Pulling out from https://github.com/haskell/filepath/issues/12#issuecomment-64000192, 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.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.