Task α
is a primitive for asynchronous computation.
It represents a computation that will resolve to a value of type α
,
possibly being computed on another thread. This is similar to Future
in Scala,
Promise
in Javascript, and JoinHandle
in Rust.
The tasks have an overridden representation in the runtime.
Constructor
Task.pure.{u}
Task.pure (a : α)
constructs a task that is already resolved with value a
.
Fields
get : α
If task : Task α
then task.get : α
blocks the current thread until the
value is available, and then returns the result of the task.