Eval

object Eval
Companion:
class
class Object
trait Matchable
class Any
Eval.type

Type members

Classlikes

sealed abstract class Defer[A](val thunk: () => Eval[A]) extends Eval[A]

Defer is a type of Eval[A] that is used to defer computations which produce Eval[A].

Defer is a type of Eval[A] that is used to defer computations which produce Eval[A].

Users should not instantiate Defer instances themselves. Instead, they will be automatically created when needed.

sealed abstract class FlatMap[A] extends Eval[A]

FlatMap is a type of Eval[A] that is used to chain computations involving .map and .flatMap. Along with Eval#flatMap it implements the trampoline that guarantees stack-safety.

FlatMap is a type of Eval[A] that is used to chain computations involving .map and .flatMap. Along with Eval#flatMap it implements the trampoline that guarantees stack-safety.

Users should not instantiate FlatMap instances themselves. Instead, they will be automatically created when needed.

Unlike a traditional trampoline, the internal workings of the trampoline are not exposed. This allows a slightly more efficient implementation of the .value method.

sealed abstract class Leaf[A] extends Eval[A]

A Leaf does not depend on any other Eval so calling .value does not trigger any flatMaps or defers

A Leaf does not depend on any other Eval so calling .value does not trigger any flatMaps or defers

Value members

Concrete methods

def always[A](a: => A): Eval[A]

Construct a lazy Eval[A] value without caching (i.e. Always[A]).

Construct a lazy Eval[A] value without caching (i.e. Always[A]).

def defer[A](a: => Eval[A]): Eval[A]

Defer a computation which produces an Eval[A] value.

Defer a computation which produces an Eval[A] value.

This is useful when you want to delay execution of an expression which produces an Eval[A] value. Like .flatMap, it is stack-safe.

def later[A](a: => A): Eval[A]

Construct a lazy Eval[A] value with caching (i.e. Later[A]).

Construct a lazy Eval[A] value with caching (i.e. Later[A]).

def now[A](a: A): Eval[A]

Construct an eager Eval[A] value (i.e. Now[A]).

Construct an eager Eval[A] value (i.e. Now[A]).

Concrete fields

Static Eval instance for common value false.

Static Eval instance for common value false.

This can be useful in cases where the same value may be needed many times.

val One: Eval[Int]

Static Eval instance for common value 1.

Static Eval instance for common value 1.

This can be useful in cases where the same value may be needed many times.

Static Eval instance for common value true.

Static Eval instance for common value true.

This can be useful in cases where the same value may be needed many times.

val Unit: Eval[Unit]

Static Eval instance for common value Unit.

Static Eval instance for common value Unit.

This can be useful in cases where the same value may be needed many times.

val Zero: Eval[Int]

Static Eval instance for common value 0.

Static Eval instance for common value 0.

This can be useful in cases where the same value may be needed many times.

Implicits

Inherited implicits

implicit val catsDeferForEval: Defer[Eval]
Inherited from:
EvalInstances
implicit def catsEqForEval[A : Eq]: Eq[Eval[A]]
Inherited from:
EvalInstances1
implicit def catsGroupForEval[A : Group]: Group[Eval[A]]
Inherited from:
EvalInstances
implicit def catsMonoidForEval[A : Monoid]: Monoid[Eval[A]]
Inherited from:
EvalInstances0
implicit def catsOrderForEval[A : Order]: Order[Eval[A]]
Inherited from:
EvalInstances
Inherited from:
EvalInstances
Inherited from:
EvalInstances
Inherited from:
EvalInstances1