flix

0.61.0

Writable

trait Writable[t: Type]Source

A trait for types which are resources that can be written to.

Associated Types

type Aef: EffSource

Effect associated with writing to the underlying resource.

type Elm: TypeSource

Type of each element that can be written to the resource.

Instances

instance Writable[EncodingWriter[t]] with Writable[t]Source
instance Writable[StdIn]Source
instance Writable[TcpSocket]Source
instance Writable[java.io.OutputStream]Source

Signatures

def write(buffer: Array[Elm[t], r], writer: t): Result[IoError, Int32] \ r + Aef[t] with Writable[t] Source

Reads k items from b and writes them into the underlying resource.

Returns Ok(k) to signify that k items were successfully read and written to r.

Guarantees that 0 <= k <= length(b).

Returns Err(e) if some underlying I/O error occurs.

Module Definitions

def writeLine(line: String, writer: t): Result[IoError, Unit] \ IO + Sys + Aef[t] with Writable[t] where Writable.Elm[t] ~ Char Source

Writes line to writer and appends a new line separator.

The new line separator is platform dependent, and is determined by the "line.separator" system property.

def writeNewLine(writer: t): Result[IoError, Unit] \ IO + Sys + Aef[t] with Writable[t] where Writable.Elm[t] ~ Char Source

Writes a new line separator to writer.

The new line separator is platform dependent, and is determined by the "line.separator" system property.

def writeString(string: String, writer: t): Result[IoError, Unit] \ Aef[t] with Writable[t] where Writable.Elm[t] ~ Char Source

Writes string to writer.