Package

monix

eval

Permalink

package eval

Visibility
  1. Public
  2. All

Type Members

  1. trait Callback[-T] extends (Try[T]) ⇒ Unit with Serializable

    Permalink

    Represents a callback that should be called asynchronously with the result of a computation.

    Represents a callback that should be called asynchronously with the result of a computation. Used by Task to signal the completion of asynchronous computations on runAsync.

    The onSuccess method should be called only once, with the successful result, whereas onError should be called if the result is an error.

  2. sealed abstract class Coeval[+A] extends Serializable

    Permalink

    Coeval represents lazy computations that can execute synchronously.

    Coeval represents lazy computations that can execute synchronously.

    Word definition and origin:

    • Having the same age or date of origin; a contemporary; synchronous.
    • From the Latin "coævus": com- ‎("equal") in combination with aevum ‎(aevum, "age").
    • The constructor of Coeval is the dual of an expression that evaluates to an A.

    There are three evaluation strategies:

    • Now or Error: for describing strict values, evaluated immediately
    • Once: expressions evaluated a single time
    • Always: expressions evaluated every time the value is needed

    The Once and Always are both lazy strategies while Now and Error are eager. Once and Always are distinguished from each other only by memoization: once evaluated Once will save the value to be returned immediately if it is needed again. Always will run its computation every time.

    Both Now and Error are represented by the Attempt trait, a sub-type of Coeval that can be used as a replacement for Scala's own Try type.

    Coeval supports stack-safe lazy computation via the .map and .flatMap methods, which use an internal trampoline to avoid stack overflows. Computation done within .map and .flatMap is always done lazily, even when applied to a Now instance.

  3. sealed abstract class Task[+A] extends Serializable

    Permalink

    Task represents a specification for a possibly lazy or asynchronous computation, which when executed will produce an A as a result, along with possible side-effects.

    Task represents a specification for a possibly lazy or asynchronous computation, which when executed will produce an A as a result, along with possible side-effects.

    Compared with Future from Scala's standard library, Task does not represent a running computation or a value detached from time, as Task does not execute anything when working with its builders or operators and it does not submit any work into any thread-pool, the execution eventually taking place only after runAsync is called and not before that.

    Note that Task is conservative in how it spawns logical threads. Transformations like map and flatMap for example will default to being executed on the logical thread on which the asynchronous computation was started. But one shouldn't make assumptions about how things will end up executed, as ultimately it is the implementation's job to decide on the best execution model. All you are guaranteed is asynchronous execution after executing runAsync.

  4. trait TaskApp extends AnyRef

    Permalink

    Safe App type that runs a Task action.

    Safe App type that runs a Task action.

    Clients should implement run, runl, or runc.

    Also available for Scala.js, but without the ability to take arguments and without the blocking in main.

Value Members

  1. object Callback extends Serializable

    Permalink
  2. object Coeval extends Serializable

    Permalink
  3. object Task extends TaskInstances with Serializable

    Permalink

Ungrouped