arrow-core-data / arrow.core / Eval / now

now

fun <A> now(a: A): Now<A>

Creates an Eval instance from an already constructed value but still defers evaluation when chaining expressions with map and flatMap

Parameters

a -

is an already computed value of type A


import arrow.core.*

fun main() {
//sampleStart
  val eager = Eval.now(1).map { it + 1 }
  println(eager.value())
//sampleEnd
}

It will return 2.