A type that represents an asynchronous value. This is often called Future
This implementation avoids stack problems some implementations have, but
allows/requires the user to control resolution. A simple way to do this is
to add Task.runner.resolve(); to your main loop.
Static variables
Static methods
staticalways<A, B>(t:Task<A>, value:B):Task<B>
When a given Task is resolved, discard its result and return value
instead
staticap<A, B>(fn:Task<A ‑> B>, t:Task<A>):Task<B>
Applies a function to a value within the context of Tasks.
Functions as a general sort of liftM
staticf_callbacks<A>(fn:(callback:A ‑> Void) ‑> Void):Task<A>
Lifts a side-effect that accepts a callback into a Task that runs the side effect and returns the input to the callback
Returns:
A Task that will contain the value passed to the callback
staticfilter<A>(t:Task<A>, predicate:A ‑> Bool):Task<Option<A>>
Discards the result of a Task if it does not match a given predicate
Returns:
a Task that returns a Some(value) that matches a predicate, or None
staticlogMessage<A>(t:Task<A>, genMessage:(data:A, pos:PosInfos) ‑> String, ?pos:Null<PosInfos>):Task<A>
When a task is complete, log a message to the console
staticmutate<A>(t:Task<A>, fn:A ‑> Void):Task<A>
Queues a side effect to be performed when a Task is complete
Returns:
The original Task
staticzip<A, B>(ta:Task<A>, tb:Task<B>):Task<Pair<A, B>>
Returns:
A Task that returns a Pair of results from two Tasks