EN
importPour l'utiliser : import System.Path

System.Path — manipulation de chemins de fichiers (pure)

Synopsis
path : String -> Path

Enveloppe une chaîne en Path (stockée telle quelle ; utiliser normalize pour la nettoyer).

toString : Path -> String

La chaîne sous-jacente d'un chemin.

join : Path -> Path -> Path

Joint deux chemins avec un séparateur. Si le chemin de droite est absolu ou que celui de gauche est vide, c'est celui de droite qui l'emporte.

components : Path -> List String

Les composantes non vides d'un chemin. components (path "a/b/c.txt") = ["a", "b", "c.txt"]

fileName : Path -> Maybe String

La dernière composante d'un chemin, s'il y en a une. fileName (path "a/b/c.txt") = Just "c.txt"

stem : Path -> Maybe String

Le nom de fichier sans son extension. stem (path "a/b/c.txt") = Just "c"

extension : Path -> Maybe String

L'extension de la dernière composante (sans le point), s'il y en a une. extension (path "a/b/c.txt") = Just "txt"

parent : Path -> Maybe Path

Le répertoire parent d'un chemin, s'il en a un. parent (path "a/b/c") = Just (path "a/b")

addExtension : Path -> String -> Path

Ajoute une extension à un chemin. addExtension (path "a/b") "txt" = path "a/b.txt"

withExtension : Path -> String -> Path

Remplace (ou ajoute) l'extension de la dernière composante d'un chemin. withExtension (path "a/b.txt") "md" = path "a/b.md"

isAbsolute : Path -> Bool

Est-ce un chemin absolu (commence-t-il par /) ?

normalize : Path -> Path

Réduit les segments . et .. et les séparateurs redondants. normalize (path "a/./b/../c") = path "a/c"