The Attempt
represents a strict, already evaluated result
of a Task that either resulted in success, wrapped in a
Now, or in an error, wrapped in a Error.
Constructs an eager Task instance for a result that represents an error.
Constructs a lazy Task instance.
Constructs a lazy Task instance.
This type can be used for "lazy" values. In some sense it is equivalent to using a Function0 value.
Constructs a lazy Task instance that gets evaluated only once.
Constructs a lazy Task instance that gets evaluated only once.
In some sense it is equivalent to using a lazy val. When caching is not required or desired, prefer EvalAlways or Now.
Constructs an eager Task instance whose result is already known.
Type alias representing callbacks for create tasks.
Returns a new task that, when executed, will emit the result of the given function executed asynchronously.
Obtain results from both a
and b
, nondeterministically ordering
their effects.
Obtain results from both a
and b
, nondeterministically ordering
their effects.
The two tasks are both executed asynchronously. In a multi-threading environment this means that the tasks will get executed in parallel and their results synchronized.
Creates a Task
that upon execution will execute both given tasks
(possibly in parallel in case the tasks are asynchronous) and will
return the result of the task that manages to complete first,
along with a cancelable future of the other task.
Creates a Task
that upon execution will execute both given tasks
(possibly in parallel in case the tasks are asynchronous) and will
return the result of the task that manages to complete first,
along with a cancelable future of the other task.
If the first task that completes
Creates a Task
that upon execution will return the result of the
first completed task in the given list and then cancel the rest.
Create a Task
from an asynchronous computation, which takes the
form of a function with which we can register a callback.
Create a Task
from an asynchronous computation, which takes the
form of a function with which we can register a callback.
This can be used to translate from a callback-based API to a
straightforward monadic version. Note that execution of
the register
callback always happens asynchronously.
is a function that will be called when this Task
is executed, receiving a callback as a parameter, a
callback that the user is supposed to call in order to
signal the desired outcome of this Task
.
Promote a non-strict value representing a Task to a Task of the same type.
Promote a non-strict value to a Task, catching exceptions in the process.
Promote a non-strict value to a Task, catching exceptions in the process.
Note that since Task
is not memoized, this will recompute the
value each time the Task
is executed.
Promote a non-strict value to a Task that is memoized on the first evaluation, the result being then available on subsequent evaluations.
Mirrors the given source Task
, but upon execution ensure
that evaluation forks into a separate (logical) thread.
Converts the given Scala Future
into a Task
.
Converts the given Scala Future
into a Task
.
NOTE: if you want to defer the creation of the future, use in combination with defer.
Type-class instances for Task.
Apply a mapping functions to the results of two tasks, nondeterministically ordering their effects.
Apply a mapping functions to the results of two tasks, nondeterministically ordering their effects.
If the two tasks are synchronous, they'll get executed immediately, one after the other, with the result being available synchronously. If the two tasks are asynchronous, they'll get scheduled for execution at the same time and in a multi-threading environment they'll execute in parallel and have their results synchronized.
A Task instance that upon evaluation will never complete.
Returns a Task
that on execution is always successful, emitting
the given strict value.
Lifts a value into the task context.
Lifts a value into the task context. Alias for now.
Returns a task that on execution is always finishing in error emitting the specified exception.
Gathers the results from a sequence of tasks into a single list.
Gathers the results from a sequence of tasks into a single list. The effects are not ordered, but the results are.
Alias for zipList.
A Task[Unit]
provided for convenience.
Constructs a lazy Task instance whose result will be computed asynchronously.
Pairs two Task instances.
Pairs three Task instances.
Pairs four Task instances.
Pairs five Task instances.
Pairs six Task instances.
Gathers the results from a sequence of tasks into a single list.
Gathers the results from a sequence of tasks into a single list. The effects are not ordered, but the results are.
Pairs two Task instances, creating a new instance that will apply the given mapping function to the resulting pair.
Pairs three Task instances, applying the given mapping function to the result.
Pairs four Task instances, applying the given mapping function to the result.
Pairs five Task instances, applying the given mapping function to the result.
Pairs six Task instances, applying the given mapping function to the result.