Avail Lazy Future
An implementation of a lazy future, using the runtime's execution pool. If the value is never requested, it never not run the computation. Otherwise, the first invocation of withValue causes the computation to run in a task (when it's safe to run interpreters).
When the computation completes, any actions queued in the waiters list by withValue will run, inside their own tasks.
Constructors
Create an AvailLazyFuture which runs the computation, once, if requested.
Properties
The function to evaluate if anyone requests the lazy future's value. The function takes another function, supplied by the lazy future's internals, responsible for running any waiting actions.
The AvailRuntime responsible for executing the computation and actions.
Functions
Ensure the given action will run with the result of the computation. If this is the first request for this future, launch a task to run the computation, evaluating all waiters when complete. If the value has not yet been computed, add the action to the waiters. If the value has been computed, just run the action. Note that all evaluation takes place while interpreters may run.