GitHub

deferred

API reference for deferred.

Deferred[A, E]: a result that will be set exactly once.

Fibers that wait() park until it is completed. Completing an already-completed deferred does nothing and returns False.

Completion, named as in Effect:

  • done(exit): complete with an exit (succeed/fail/fail_cause are shorthands).
  • complete(eff): run eff once and complete with its outcome, even if the completing fiber is interrupted. Every waiter sees the same result.
  • complete_with(eff): store eff itself; each wait() runs it.
  • into(eff): run eff and complete with its outcome, whether or not already completed (eff.pipe(deferred.into)).

Classes