init::io
init/src/io.mo
pub type RawIO A {
io A
}pub def RawIO.pure (a : A) : RawIO AConstruct a RawIO value wrapping a pure value.
pub def RawIO.bind (a : RawIO A) (f : A -> RawIO B) : RawIO BUnwrap a RawIO value and apply a continuation.
pub instance Monad RawIO {
def pure (a : A) : RawIO A :=
RawIO.pure a
def bind (a : RawIO A) (f : A -> RawIO B) : RawIO B :=
RawIO.bind a f
}pub type IO A {
mk (raw : RawIO A)
}IO is the user-facing IO type. It wraps RawIO and can be extended
with state, exceptions, and other capabilities. Today it is a thin
wrapper that delegates to RawIO.
pub def IO.pure (a : A) : IO AConstruct an IO value from a pure value.
pub instance Monad IO {
def pure (a : A) : IO A :=
IO.pure a
def bind (a : IO A) (f : A -> IO B) : IO B :=
IO.bind a f
}