arrow-core-data / arrow.typeclasses / Foldable / foldRight


abstract fun <A, B> Kind<F, A>.foldRight(lb: Eval<B>, f: (A, Eval<B>) -> Eval<B>): Eval<B>

Right associative lazy fold on F using the provided function.

This method evaluates lb lazily (in some cases it will not be needed), and returns a lazy value. We are using (A, Eval) => Eval to support laziness in a stack-safe way. Chained computation should be performed via .map and .flatMap.

For more detailed information about how this method works see the documentation for Eval.

Do you like Arrow?

Arrow Org