Bind : Async e es a -> (a -> Async e es b) -> Async e es b Implements bind (`>>=`)
Val : a -> Async e es a A pure result
Err : HSum es -> Async e es a An error
Sync : IO (Result es a) -> Async e es a A wrapped synchronous/blocking IO action
Cancel : Async e es () Cancels the curret fiber
OnCncl : Async e es a -> Async e [] () -> Async e es a Run the given cancel hook when cancelation is observed for `act`
UC : (IOToken -> Nat -> Async e es a) -> Async e es a Masks a fiber as uncanceble
This takes a function argument which will get the running fiber's
identifier token plus cancelation id in order to unmask certain
inner regions, where cancellation can again be observed.
See also `Poll`.
Attempt : Async e es a -> Async e fs (Result es a) Error handling: In case an error occured, it is wrapped in
a `Left`, while a successful result is wrapped in a `Right`.
Note, that we do not handle the `Canceled` case: Cancellation
cannot be undone. In can be temporarily masked using `UC`, but
after that, it will be observed as soon as possible.
Env : Async e es e Returns the context currently handling this fiber, giving us access
to functionality specific to the running event loop.
Self : Async e es IOToken Returns the current fiber's unique identifier
Cede : Async e es () Cedes control to the execution context
Fibers are auto-ceded after a predefined number of evaluation steps
to make sure other fibers get a chance to run even when the event loop
is single-threaded. In addition, a fiber can make room for other
fibers by invoking `cede` at strategic points.
Start : Async e es a -> Async e fs (Fiber es a) Runs the given computation concurrently to this one returning a
`Fiber` representing the runnign computation.
Asnc : ((Result es a -> IO1 ()) -> IO1 (IO1 ())) -> Async e es a The asynchronous primitive. This allows us to register callbacks
and await their invocation, thus blocking the current fiber until
a result is ready. Being able to treat this as a regular
IO-like computation is one of the main reasons why `Async` is such
a powerful abstraction.
The `IO1 ()` returned after installing a callback will be treated
as a cancellation hook: It will be invoked if the current
computation is canceled and cancellation can currently be observed.
We use this data constructor whenever we'd like to wait for a
result to be ready at a later time such as a timer, input from
a pipe or socket, or data available from standard input.
APoll : IOToken -> Nat -> Async e es a -> Async e es a Temporarily undo a layer of uncancelability. See also `UC`.