arrow-core-data / arrow.core / Eval / always


fun <A> always(f: () -> A): Always<A>

Creates an Eval instance from a function deferring it’s evaluation until .value() is invoked recomputing each time .value() is invoked.


f -

is a function or computation that will be called every time .value() is invoked.

import arrow.core.*

fun main() {
  val alwaysEvaled = Eval.always { "expensive computation" }

“expensive computation” is computed every time value() is invoked.

Do you like Arrow?

Arrow Org