FR
importPour l'utiliser : import System.Path

System.Path — file path manipulation (pure)

Synopsis
toString : Path -> String

The underlying string of a path.

join : Path -> Path -> Path

Join two paths with a separator. If the right path is absolute or the left is empty, the right wins.

components : Path -> List String

The non-empty components of a path. components (path "a/b/c.txt") = ["a", "b", "c.txt"]

fileName : Path -> Maybe String

The final component of a path, if any. fileName (path "a/b/c.txt") = Just "c.txt"

stem : Path -> Maybe String

The filename without its extension. stem (path "a/b/c.txt") = Just "c"

extension : Path -> Maybe String

The extension of the final component (without the dot), if any. extension (path "a/b/c.txt") = Just "txt"

parent : Path -> Maybe Path

The parent directory of a path, if it has one. parent (path "a/b/c") = Just (path "a/b")

addExtension : Path -> String -> Path

Append an extension to a path. addExtension (path "a/b") "txt" = path "a/b.txt"

withExtension : Path -> String -> Path

Replace (or add) the extension of a path's final component. withExtension (path "a/b.txt") "md" = path "a/b.md"

isAbsolute : Path -> Bool

Is this an absolute path (does it start with /)?

normalize : Path -> Path

Collapse . and .. segments and redundant separators. normalize (path "a/./b/../c") = path "a/c"