FR
importPour l'utiliser : import System.File

System.File — reading and writing whole files

Synopsis
ioError : String -> FileError

A plain IO error from a message (no path), for handle-based operations.

readFile : Path -> Result FileError String with FileRead

Read a whole file as a string. readFile (path "notes.txt") is Ok "<contents>", or Error (NotFound …).

writeFile : Path -> String -> Result FileError () with FileWrite

Write a string to a file, replacing any existing contents.

appendFile : Path -> String -> Result FileError () with FileWrite

Append a string to the end of a file (creating it if needed).

exists : Path -> Bool with FileRead

Does this path exist?

isFile : Path -> Bool with FileRead

Does this path exist and is it a regular file?

isDir : Path -> Bool with FileRead

Does this path exist and is it a directory?

writeLines : Path -> List String -> Result FileError () with FileWrite

Write a list of lines to a file, one per line (each followed by a newline).

readFileOr : String -> Path -> String with FileRead

Read a file, falling back to a default string if it can't be read. A convenience for when you don't want to handle the error explicitly.