Standard I/O operations for printing to stdout.

Wall-clock stdout primitives. Every entry that actually writes carries the ! Io effect so callers are forced to declare it in their own signatures.

Examples

cure
use Std.Io

println("Hello, Cure!")                # Hello, Cure!
print_int(42)                          # 42
print_float(3.14)                      # 3.14
cure
use Std.Io

fn greet(name: String) -> Unit ! Io =
  println("Hello, " <> name <> "!")

<> on String desugars to Std.Semigroup.combine, which resolves to Std.String's own instance -- String is nominal, not a List(Char) alias.

Functions

  • # fn atom_to_string(a: Atom) -> String
  • # fn float_to_string(f: Float) -> String
  • # fn int_to_string(n: Int) -> String
  • # fn print(text: String) -> Unit ! Io

    Print a string to stdout without a trailing newline. Alias for put_chars/1; kept for readability at call sites.

  • # fn print_float(f: Float) -> Unit ! Io

    Print a float followed by a newline.

  • # fn print_int(n: Int) -> Unit ! Io

    Print an integer followed by a newline.

  • # fn println(text: String) -> Unit ! Io

    Print a string to stdout with a trailing newline.

  • # fn put_chars(text: String) -> Unit ! Io