Now

cats.Now
final case class Now[A](value: A) extends Leaf[A]

Construct an eager Eval[A] instance.

In some sense it is equivalent to using a val.

This type should be used when an A value is already in hand, or when the computation to produce an A value is pure and very fast.

Attributes

Source
Eval.scala
Graph
Supertypes
trait Product
trait Equals
class Leaf[A]
class Eval[A]
trait Serializable
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

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.

Attributes

Source
Eval.scala

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.

Attributes

Inherited from:
Eval
Source
Eval.scala
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.

Attributes

Inherited from:
Eval
Source
Eval.scala

Attributes

Inherited from:
Product

Attributes

Inherited from:
Product