gleam/io

Functions

pub fn debug(term: a) -> a

Prints a value to standard error (stderr) yielding Gleam syntax.

The value is returned after being printed so it can be used in pipelines.

Example

debug("Hi mum")
// -> "Hi mum"
// <<"Hi mum">>
debug(Ok(1))
// -> Ok(1)
// {ok, 1}
import gleam/list
[1, 2]
|> list.map(fn(x) { x + 1 })
|> debug
|> list.map(fn(x) { x * 2 })
// -> [4, 6]
// [2, 3]
pub fn print(string: String) -> Nil

Writes a string to standard output.

If you want your output to be printed on its own line see println.

Example

io.print("Hi mum")
// -> Nil
// Hi mum
pub fn print_error(string: String) -> Nil

Writes a string to standard error.

If you want your output to be printed on its own line see println_error.

Example

io.print_error("Hi pop")
// -> Nil
// Hi pop
pub fn println(string: String) -> Nil

Writes a string to standard output, appending a newline to the end.

Example

io.println("Hi mum")
// -> Nil
// Hi mum
pub fn println_error(string: String) -> Nil

Writes a string to standard error, appending a newline to the end.

Example

io.println_error("Hi pop")
// -> Nil
// Hi mum
Search Document