Leaf

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

class Eval[A]
trait Serializable
class Object
trait Matchable
class Any
class Always[A]
class Later[A]
class Now[A]

Value members

Inherited methods

def flatMap[B](f: A => Eval[B]): Eval[B]

Lazily perform a computation based on an Eval[A], using the function f to produce an Eval[B] given an A.

Lazily perform a computation based on an Eval[A], using the function f to produce an Eval[B] given an A.

This call is stack-safe -- many .flatMap calls may be chained without consumed additional stack during evaluation. It is also written to avoid left-association problems, so that repeated calls to .flatMap will be efficiently applied.

Computation performed in f is always lazy, even when called on an eager (Now) instance.

Inherited from
Eval
def map[B](f: A => B): Eval[B]

Transform an Eval[A] into an Eval[B] given the transformation function f.

Transform an Eval[A] into an Eval[B] given the transformation function f.

This call is stack-safe -- many .map calls may be chained without consumed additional stack during evaluation.

Computation performed in f is always lazy, even when called on an eager (Now) instance.

Inherited from
Eval
def memoize: Eval[A]

Ensure that the result of the computation (if any) will be memoized.

Ensure that the result of the computation (if any) will be memoized.

Practically, this means that when called on an Always[A] a Later[A] with an equivalent computation will be returned.

Inherited from
Eval
def value: A

Evaluate the computation and return an A value.

Evaluate the computation and return an A value.

For lazy instances (Later, Always), any necessary computation will be performed at this point. For eager instances (Now), a value will be immediately returned.

Inherited from
Eval