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

now

@JvmStatic fun <A> now(a: A): Eval<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.

Do you like Arrow?

Arrow Org
<