Skip to content

Commit

Permalink
Document relation between joinPath and (</>)
Browse files Browse the repository at this point in the history
Fixes #82
  • Loading branch information
hasufell committed Dec 3, 2021
1 parent 7c9b722 commit 9bd9092
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Generate.hs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ qualify pw str
| otherwise = str
where
prelude = ["elem","uncurry","snd","fst","not","null","if","then","else"
,"True","False","Just","Nothing","fromJust","concat","isPrefixOf","isSuffixOf","any"]
,"True","False","Just","Nothing","fromJust","concat","isPrefixOf","isSuffixOf","any","foldr"]
fpops = ["</>","<.>","-<.>"]


Expand Down
1 change: 1 addition & 0 deletions System/FilePath/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -747,6 +747,7 @@ splitDirectories = map dropTrailingPathSeparator . splitPath

-- | Join path elements back together.
--
-- > joinPath a == foldr (</>) "" a
-- > joinPath ["/","directory/","file.ext"] == "/directory/file.ext"
-- > Valid x => joinPath (splitPath x) == x
-- > joinPath [] == ""
Expand Down
1 change: 1 addition & 0 deletions System/FilePath/Posix.hs
Original file line number Diff line number Diff line change
Expand Up @@ -747,6 +747,7 @@ splitDirectories = map dropTrailingPathSeparator . splitPath

-- | Join path elements back together.
--
-- > joinPath a == foldr (</>) "" a
-- > joinPath ["/","directory/","file.ext"] == "/directory/file.ext"
-- > Valid x => joinPath (splitPath x) == x
-- > joinPath [] == ""
Expand Down
1 change: 1 addition & 0 deletions System/FilePath/Windows.hs
Original file line number Diff line number Diff line change
Expand Up @@ -747,6 +747,7 @@ splitDirectories = map dropTrailingPathSeparator . splitPath

-- | Join path elements back together.
--
-- > joinPath a == foldr (</>) "" a
-- > joinPath ["/","directory/","file.ext"] == "/directory/file.ext"
-- > Valid x => joinPath (splitPath x) == x
-- > joinPath [] == ""
Expand Down
2 changes: 2 additions & 0 deletions tests/TestGen.hs
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,8 @@ tests =
,("W.splitDirectories \"C:\\\\test\\\\\\\\\\\\file\" == [\"C:\\\\\", \"test\", \"file\"]", property $ W.splitDirectories "C:\\test\\\\\\file" == ["C:\\", "test", "file"])
,("P.splitDirectories \"/test///file\" == [\"/\", \"test\", \"file\"]", property $ P.splitDirectories "/test///file" == ["/", "test", "file"])
,("W.splitDirectories \"/test///file\" == [\"/\", \"test\", \"file\"]", property $ W.splitDirectories "/test///file" == ["/", "test", "file"])
,("P.joinPath a == foldr (P.</>) \"\" a", property $ \a -> P.joinPath a == foldr (P.</>) "" a)
,("W.joinPath a == foldr (W.</>) \"\" a", property $ \a -> W.joinPath a == foldr (W.</>) "" a)
,("P.joinPath [\"/\", \"directory/\", \"file.ext\"] == \"/directory/file.ext\"", property $ P.joinPath ["/", "directory/", "file.ext"] == "/directory/file.ext")
,("W.joinPath [\"/\", \"directory/\", \"file.ext\"] == \"/directory/file.ext\"", property $ W.joinPath ["/", "directory/", "file.ext"] == "/directory/file.ext")
,("P.joinPath (P.splitPath x) == x", property $ \(QFilePathValidP x) -> P.joinPath (P.splitPath x) == x)
Expand Down

0 comments on commit 9bd9092

Please sign in to comment.