SagaSaga
Standard Library

Std.File

File system operations through an algebraic effect.

Types

FileError

type FileError =
  | NotFound
  | PermissionDenied
  | IsDirectory
  | NotDirectory
  | NoSpace
  | AlreadyExists
  | Other String
  deriving (Debug)

Errors that can occur during file operations.

Effects

File

effect File {
  fun read : String -> Result String FileError
  fun write : String -> String -> Result Unit FileError
  fun append : String -> String -> Result Unit FileError
  fun delete : String -> Result Unit FileError
  fun exists : String -> Bool
}

Effect for reading, writing, and querying files.

Handlers

fs

handler fs for File

Handler that delegates to the real file system.