Bosatsu packages

Yichus/IO

Builtin package (resource io.bosatsu). This is the complete package source used by this build. The export list names its public API; definitions below give the types and behavior.

New to the API? Start with Make a calculator or Build an API, then use this page to look up a definition.

package Yichus/IO

from Bosatsu/Predef import Int, String, List

export (
  IO,
  pure, flat_map,
  capture, capture_formula,
  sequence, trace, random_int, current_time_millis
)

# IO produces a; it must not forget its result type at the FFI boundary.
external type IO[a: +*]

external def pure[a](value: a) -> IO[a]
external def flat_map[a, b](prog: IO[a], f: a -> IO[b]) -> IO[b]
external def capture[a](name: String, value: a) -> IO[a]
external def capture_formula[a](name: String, formula: String, value: a) -> IO[a]
external def sequence[a](progs: List[IO[a]]) -> IO[List[a]]
external def trace(unit: forall a. a) -> IO[String]
external def random_int(min: Int, max: Int) -> IO[Int]
external def current_time_millis(seed: Int) -> IO[Int]