flix

0.78.0

Readable

trait Readable[t: Type]Source

Trait for types that can be read from.

Associated Types

type Aef: EffSource

Effect associated with reading from the resource.

type Elm: TypeSource

Type of each element that can be read from the resource.

Instances

instance Readable[BufReader[a, t, rr]] with Readable[t] where Readable.Elm[t] ~ aSource
type Elm = atype Aef = rr + Aef[t]
instance Readable[DecodingReader[t, rr]] with Readable[t] where Readable.Elm[t] ~ Int8Source
type Elm = Chartype Aef = Aef[t] + IO + rr
instance Readable[StdErr]Source
type Elm = Int8type Aef = IO
instance Readable[StdOut]Source
type Elm = Int8type Aef = IO
instance Readable[TcpSocket]Source
type Elm = Int8type Aef = IO
instance Readable[java.io.InputStream]Source
type Elm = Int8type Aef = IO

Signatures

def read(buffer: Array[Elm[t], r], reader: t): Result[IoError, Int32] \ r + Aef[t] with Readable[t]§ Source

Reads k elements from the resource and writes them into b.

Returns Ok(k) to signify that k bytes were successfully read and written to b.

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

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