object Coeval extends Serializable
- Source
- Coeval.scala
- Alphabetic
- By Inheritance
- Coeval
- Serializable
- Serializable
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
-
final
case class
Always
[+A](f: () ⇒ A) extends Coeval[A] with Product with Serializable
Constructs a lazy Coeval instance.
Constructs a lazy Coeval instance.
This type can be used for "lazy" values. In some sense it is equivalent to using a Function0 value.
-
sealed abstract
class
Attempt
[+A] extends Coeval[A] with Product
The
Attempt
represents a strict, already evaluated result of a Coeval that either resulted in success, wrapped in a Now, or in an error, wrapped in an Error. -
final
case class
Error
(ex: Throwable) extends Attempt[Nothing] with Product with Serializable
Constructs an eager Coeval instance for a result that represents an error.
-
final
case class
Now
[+A](value: A) extends Attempt[A] with Product with Serializable
Constructs an eager Coeval instance from a strict value that's already known.
-
final
class
Once
[+A] extends Coeval[A] with () ⇒ A
Constructs a lazy Coeval instance that gets evaluated only once.
-
class
TypeClassInstances
extends Instance[Coeval] with Instance[Coeval] with Instance[Coeval, Throwable] with Instance[Coeval] with Instance[Coeval]
Groups the implementation for the type-classes defined in monix.types.
Value Members
-
def
apply[A](f: ⇒ A): Coeval[A]
Promotes a non-strict value to a Coeval.
-
def
defer[A](fa: ⇒ Coeval[A]): Coeval[A]
Promote a non-strict value representing a
Coeval
to aCoeval
of the same type. -
def
delay[A](a: ⇒ A): Coeval[A]
Alias for eval.
-
def
eval[A](a: ⇒ A): Coeval[A]
Promote a non-strict value to a
Coeval
, catching exceptions in the process.Promote a non-strict value to a
Coeval
, catching exceptions in the process.Note that since
Coeval
is not memoized, this will recompute the value each time theCoeval
is executed. -
def
evalOnce[A](a: ⇒ A): Coeval[A]
Promote a non-strict value to a
Coeval
that is memoized on the first evaluation, the result being then available on subsequent evaluations. -
def
fromTry[A](a: Try[A]): Coeval[A]
Builds a
Coeval
out of a ScalaTry
value. -
def
now[A](a: A): Coeval[A]
Returns a
Coeval
that on execution is always successful, emitting the given strict value. -
def
pure[A](a: A): Coeval[A]
Lifts a value into the coeval context.
Lifts a value into the coeval context. Alias for now.
-
def
raiseError[A](ex: Throwable): Coeval[A]
Returns a
Coeval
that on execution is always finishing in error emitting the specified exception. -
def
sequence[A, M[X] <: TraversableOnce[X]](sources: M[Coeval[A]])(implicit cbf: CanBuildFrom[M[Coeval[A]], A, M[A]]): Coeval[M[A]]
Transforms a
TraversableOnce
of coevals into a coeval producing the same collection of gathered results.Transforms a
TraversableOnce
of coevals into a coeval producing the same collection of gathered results.It's a simple version of traverse.
-
def
suspend[A](fa: ⇒ Coeval[A]): Coeval[A]
Alias for defer.
-
def
tailRecM[A, B](a: A)(f: (A) ⇒ Coeval[Either[A, B]]): Coeval[B]
Keeps calling
f
until it returns aRight
result.Keeps calling
f
until it returns aRight
result.Based on Phil Freeman's Stack Safety for Free.
-
def
traverse[A, B, M[X] <: TraversableOnce[X]](sources: M[A])(f: (A) ⇒ Coeval[B])(implicit cbf: CanBuildFrom[M[A], B, M[B]]): Coeval[M[B]]
Transforms a
TraversableOnce[A]
into a coeval of the same collection using the provided functionA => Coeval[B]
.Transforms a
TraversableOnce[A]
into a coeval of the same collection using the provided functionA => Coeval[B]
.It's a generalized version of sequence.
-
implicit
val
typeClassInstances: TypeClassInstances
Implicit type-class instances of Coeval.
-
val
unit: Coeval[Unit]
A
Coeval[Unit]
provided for convenience. -
def
zip2[A1, A2, R](fa1: Coeval[A1], fa2: Coeval[A2]): Coeval[(A1, A2)]
Pairs two Coeval instances.
-
def
zip3[A1, A2, A3](fa1: Coeval[A1], fa2: Coeval[A2], fa3: Coeval[A3]): Coeval[(A1, A2, A3)]
Pairs three Coeval instances.
-
def
zip4[A1, A2, A3, A4](fa1: Coeval[A1], fa2: Coeval[A2], fa3: Coeval[A3], fa4: Coeval[A4]): Coeval[(A1, A2, A3, A4)]
Pairs four Coeval instances.
-
def
zip5[A1, A2, A3, A4, A5](fa1: Coeval[A1], fa2: Coeval[A2], fa3: Coeval[A3], fa4: Coeval[A4], fa5: Coeval[A5]): Coeval[(A1, A2, A3, A4, A5)]
Pairs five Coeval instances.
-
def
zip6[A1, A2, A3, A4, A5, A6](fa1: Coeval[A1], fa2: Coeval[A2], fa3: Coeval[A3], fa4: Coeval[A4], fa5: Coeval[A5], fa6: Coeval[A6]): Coeval[(A1, A2, A3, A4, A5, A6)]
Pairs six Coeval instances.
-
def
zipList[A](sources: Coeval[A]*): Coeval[List[A]]
Zips together multiple Coeval instances.
-
def
zipMap2[A1, A2, R](fa1: Coeval[A1], fa2: Coeval[A2])(f: (A1, A2) ⇒ R): Coeval[R]
Pairs two Coeval instances, creating a new instance that will apply the given mapping function to the resulting pair.
-
def
zipMap3[A1, A2, A3, R](fa1: Coeval[A1], fa2: Coeval[A2], fa3: Coeval[A3])(f: (A1, A2, A3) ⇒ R): Coeval[R]
Pairs three Coeval instances, applying the given mapping function to the result.
-
def
zipMap4[A1, A2, A3, A4, R](fa1: Coeval[A1], fa2: Coeval[A2], fa3: Coeval[A3], fa4: Coeval[A4])(f: (A1, A2, A3, A4) ⇒ R): Coeval[R]
Pairs four Coeval instances, applying the given mapping function to the result.
-
def
zipMap5[A1, A2, A3, A4, A5, R](fa1: Coeval[A1], fa2: Coeval[A2], fa3: Coeval[A3], fa4: Coeval[A4], fa5: Coeval[A5])(f: (A1, A2, A3, A4, A5) ⇒ R): Coeval[R]
Pairs five Coeval instances, applying the given mapping function to the result.
-
def
zipMap6[A1, A2, A3, A4, A5, A6, R](fa1: Coeval[A1], fa2: Coeval[A2], fa3: Coeval[A3], fa4: Coeval[A4], fa5: Coeval[A5], fa6: Coeval[A6])(f: (A1, A2, A3, A4, A5, A6) ⇒ R): Coeval[R]
Pairs six Coeval instances, applying the given mapping function to the result.
- object Attempt extends Serializable
- object Once extends Serializable
This is the API documentation for the Monix library.
Package Overview
monix.execution exposes lower level primitives for dealing with asynchronous execution:
Atomic
types, as alternative tojava.util.concurrent.atomic
monix.eval is for dealing with evaluation of results, thus exposing Task and Coeval.
monix.reactive exposes the
Observable
pattern:Observable
implementationsmonix.types implements type-class shims, to be translated to type-classes provided by libraries such as Cats or Scalaz.
monix.cats is the optional integration with the Cats library, providing translations for the types described in
monix.types
.monix.scalaz is the optional integration with the Scalaz library, providing translations for the types described in
monix.types
.