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 that gets evaluated only once.
Constructs an eager Task instance whose result is already known.
Type alias representing callbacks for create tasks.
Groups the implementation for the type-classes defined in monix.types.
Groups the implementation for the type-classes defined in monix.types.
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.
Nondeterministically gather results from the given sequence of tasks, returning a task that will signal a sequence of results once all tasks are finished.
Nondeterministically gather results from the given sequence of tasks, returning a task that will signal a sequence of results once all tasks are finished.
This function is the nondeterministic analogue of sequence
and should
behave identically to sequence
so long as there is no interaction between
the effects being gathered. However, unlike sequence
, which decides on
a total order of effects, the effects in a gather
are unordered with
respect to each other.
Although the effects are unordered, we ensure the order of results matches the order of the input sequence. Also see gatherUnordered.
Alias for zipList.
Nondeterministically gather results from the given sequence of tasks to a sequence, without keeping the original ordering of results.
Nondeterministically gather results from the given sequence of tasks to a sequence, without keeping the original ordering of results.
This function is similar to gather, but neither the effects nor the
results will be ordered. Useful when you don't need ordering because it
can be more efficient than gather
.
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.
Type-class instances for Task that have nondeterministic effects for Applicative.
Type-class instances for Task that have nondeterministic effects for Applicative.
It can be optionally imported in scope to make map2
and ap
to
potentially run tasks in parallel.
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.
Given a sequence of tasks, transforms it to a task signaling a sequence, executing the tasks one by one and gathering their results in a list.
Given a sequence of tasks, transforms it to a task signaling a sequence, executing the tasks one by one and gathering their results in a list.
This operation will execute the tasks one by one, in order, which means that both effects and results will be ordered. See gather and gatherUnordered for unordered results or effects, and thus potential of running in paralel.
Type-class instances for Task.
A Task[Unit]
provided for convenience.
Constructs a lazy Task instance whose result will be computed asynchronously.
Unsafe utility - starts the execution of a Task with a guaranteed asynchronous boundary, by providing the needed Scheduler, StackedCancelable and Callback.
Unsafe utility - starts the execution of a Task with a guaranteed asynchronous boundary, by providing the needed Scheduler, StackedCancelable and Callback.
DO NOT use directly, as it is UNSAFE to use, unless you know what you're doing. Prefer Task.runAsync and Task.fork.
Unsafe utility - starts the execution of a Task, by providing the needed Scheduler, StackedCancelable and Callback.
Unsafe utility - starts the execution of a Task, by providing the needed Scheduler, StackedCancelable and Callback.
DO NOT use directly, as it is UNSAFE to use, unless you know what you're doing. Prefer Task.runAsync.
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.