FileWrite
eff FileWrite
SourceAn effect used to write to the file system.
All operations on this effect are infalliable. If an operation fails the handler must deal with it.
Operations
def append(data: { str = String }, f: String): Unit
SourceAppends str
to the given file f
.
Creates the file f
if it does not exist.
def appendBytes(data: Vector[Int8], f: String): Unit
SourceAppends data
to the given file f
.
Creates the file f
if it does not exist.
def appendLines(data: { lines = List[String] }, f: String): Unit
SourceAppends lines
to the given file f
.
Creates the file f
if it does not exist.
def mkDir(d: String): Unit
SourceCreates the directory d
.
def mkDirs(d: String): Unit
SourceCreates the directory d
and all its parent directories.
def truncate(f: String): Unit
SourceTruncates the given file f
.
def write(data: { str = String }, f: String): Unit
SourceWrites str
to the given file f
.
Creates file f
if it does not exist. Overwrites it if it exists.
def writeBytes(data: Vector[Int8], f: String): Unit
SourceWrites data
to the given file f
.
Creates file f
if it does not exist. Overwrites it if it exists.
def writeLines(data: { lines = List[String] }, f: String): Unit
SourceWrites lines
to the given file f
.
Creates f
if it does not exist. Overwrites it if it exists.
Definitions
def handle(f: a -> b \ ef): a -> Result[IoError, b] \ (ef & (~FileWrite)) + IO
SourceHandles the FileWrite
effect of the given function f
.
In other words, re-interprets the FileWrite
effect using the IO
effect.