object Task
- Source
- Task.scala
- Alphabetic
- By Inheritance
- Task
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
-
type
ParallelTask[A] = TagKind.@@[Task[A], Parallel]
type for Tasks which need to be executed in parallel when using an Applicative instance
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
Try[A](a: ⇒ A): \/[Throwable, A]
Utility function - evaluate
a
and catch and return any exceptions. -
def
apply[A](a: ⇒ A)(implicit pool: ExecutorService = Strategy.DefaultExecutorService): Task[A]
Create a
Task
that will evaluatea
using the givenExecutorService
. -
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
async[A](register: ((\/[Throwable, A]) ⇒ Unit) ⇒ Unit): Task[A]
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. -
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
def
delay[A](a: ⇒ A): Task[A]
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 sinceTask
is unmemoized, this will recomputea
each time it is sequenced into a larger computation. Memoizea
with a lazy value before calling this function if memoization is desired. -
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
fail[A](e: Throwable): Task[A]
A
Task
which fails with the givenThrowable
. -
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
def
fork[A](a: ⇒ Task[A])(implicit pool: ExecutorService = Strategy.DefaultExecutorService): Task[A]
Returns a
Task
that produces the same result as the givenFuture
, but forks its evaluation off into a separate (logical) thread, using the givenExecutorService
.Returns a
Task
that produces the same result as the givenFuture
, but forks its evaluation off into a separate (logical) thread, using the givenExecutorService
. Note that this forking is only described by the returnedTask
--nothing occurs until theTask
is run. - def fromDisjunction[A <: Throwable, B](x: \/[A, B]): Task[B]
- def fromMaybe[A](ma: Maybe[A])(t: ⇒ Throwable): Task[A]
-
def
gatherUnordered[A](tasks: Seq[Task[A]], exceptionCancels: Boolean = false): Task[IList[A]]
Like
Nondeterminism[Task].gatherUnordered
, but ifexceptionCancels
is true, exceptions in any task try to immediately cancel all other running tasks.Like
Nondeterminism[Task].gatherUnordered
, but ifexceptionCancels
is true, exceptions in any task try to immediately cancel all other running tasks. IfexceptionCancels
is false, in the event of an error, all tasks are run to completion before the error is returned.- Since
7.0.3
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
-
def
now[A](a: A): Task[A]
Convert a strict value to a
Task
.Convert a strict value to a
Task
. Also seedelay
. - def point[A](a: ⇒ A): Task[A]
- def reduceUnordered[A, M](tasks: Seq[Task[A]], exceptionCancels: Boolean = false)(implicit R: Reducer[A, M], M: Monoid[M]): Task[M]
- def schedule[A](a: ⇒ A, delay: Duration)(implicit pool: ScheduledExecutorService = Strategy.DefaultTimeoutScheduler): Task[A]
-
def
suspend[A](a: ⇒ Task[A]): Task[A]
Produce
f
in the main trampolining loop,Future.step
, using a fresh call stack.Produce
f
in the main trampolining loop,Future.step
, using a fresh call stack. The standard trampolining primitive, useful for avoiding stack overflows. -
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
- def tailrecM[A, B](a: A)(f: (A) ⇒ Task[\/[A, B]]): Task[B]
- implicit val taskInstance: Nondeterminism[Task] with BindRec[Task] with Catchable[Task] with MonadError[Task, Throwable]
-
implicit
val
taskParallelApplicativeInstance: Applicative[ParallelTask]
This Applicative instance runs Tasks in parallel.
This Applicative instance runs Tasks in parallel.
It is different from the Applicative instance obtained from Monad[Task] which runs tasks sequentially.
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
def
unsafeStart[A](a: ⇒ A)(implicit pool: ExecutorService = Strategy.DefaultExecutorService): Task[A]
Create a
Task
that starts evaluatinga
using the givenExecutorService
right away.Create a
Task
that starts evaluatinga
using the givenExecutorService
right away. This will start executing side effects immediately, and is thus morally equivalent tounsafePerformIO
. The resultingTask
cannot be rerun to repeat the effects. Use with care. -
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
object
TaskInterrupted
extends InterruptedException with Product with Serializable
signals task was interrupted *