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 list
> [1, 2]
> |> list.map(fn(x) { x + 1 })
> |> debug
> |> list.map(fn(x) { x * 2 })
// -> [2, 3]
[4, 6]
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")
// -> Hi mum
Nil
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 eprintln.

Example

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

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

Example

> io.println("Hi mum")
// -> Hi mum
Nil
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")
// -> Hi mum
Nil
Search Document