Fixed haddock comment.

This commit is contained in:
John MacFarlane 2014-08-13 13:59:18 -07:00
parent 3b7d276ab0
commit 17b2fd567b

View file

@ -857,15 +857,13 @@ warn msg = do
-- | Remove intermediate "." and ".." directories from a path.
--
-- @
-- collapseFilePath "./foo" == "foo"
-- collapseFilePath "/bar/../baz" == "/baz"
-- collapseFilePath "/../baz" == "/../baz"
-- collapseFilePath "parent/foo/baz/../bar" == "parent/foo/bar"
-- collapseFilePath "parent/foo/baz/../../bar" == "parent/bar"
-- collapseFilePath "parent/foo/.." == "parent"
-- collapseFilePath "/parent/foo/../../bar" == "/bar"
-- @
-- > collapseFilePath "./foo" == "foo"
-- > collapseFilePath "/bar/../baz" == "/baz"
-- > collapseFilePath "/../baz" == "/../baz"
-- > collapseFilePath "parent/foo/baz/../bar" == "parent/foo/bar"
-- > collapseFilePath "parent/foo/baz/../../bar" == "parent/bar"
-- > collapseFilePath "parent/foo/.." == "parent"
-- > collapseFilePath "/parent/foo/../../bar" == "/bar"
collapseFilePath :: FilePath -> FilePath
collapseFilePath = joinPath . reverse . foldl go [] . splitDirectories
where