silo:std.effects.filesystem

Source src/silo:std.effects.filesystem

1##! Filesystem effect — read, write, delete, and probe files by path.
2
3:use
4  :open core Str Bool Unit Result
5  :open effects.io IO
6:end
7
8## Filesystem effect for reading, writing, deleting, and probing files by path.
9:effect(pub) FileSystem IO
10  ## Reads a file at the given path and returns its contents or an error string.
11  .read-file ( Str -> (Result Str Str) )
12  ## Writes content to a file at the given path, returning Unit or an error string.
13  .write-file ( Str Str -> (Result Unit Str) )
14  ## Deletes a file at the given path.
15  .delete-file ( Str -> (Result Unit Str) )
16  ## Reports whether a file exists at the given path.
17  .file-exists ( Str -> (Result Bool Str) )
18:end