Skip to content

Latest commit

 

History

History
59 lines (37 loc) · 912 Bytes

io.md

File metadata and controls

59 lines (37 loc) · 912 Bytes

io

Standard I/O. import io, effect.

io.read_line() -> String

Read a single line from standard input

let name = io.read_line()

io.print(s: String) -> Unit

Print a string to stdout without a trailing newline

io.print("Enter name: ")

io.read_all() -> String

Read all of standard input as a single string

let input = io.read_all()

io.write_bytes(data: List[Int]) -> Unit

Write raw bytes to stdout (no UTF-8 conversion)

io.write_bytes([0x50, 0x34, 0x0A])

io.write(data: Bytes) -> Unit

Write a Bytes buffer to stdout (zero-copy, buffered)

io.write(buf)

io.read_byte() -> Int

Read a single byte from stdin (returns -1 on EOF).

let b = io.read_byte()

io.read_n_bytes(n: Int) -> List[Int]

Read N bytes from stdin (may return fewer on EOF).

let bytes = io.read_n_bytes(4)