arrow-core-data / arrow.core / Validated / lift
@JvmStatic inline fun <E, A, B> lift(crossinline f: (A) -> B): (
Validated
<E, A>) ->
Validated
<E, B>
Lifts a function A -> B
to the Validated structure.
A -> B -> Validated<E, A> -> Validated<E, B>
@JvmStatic inline fun <A, B, C, D> lift(crossinline fl: (A) -> C, crossinline fr: (B) -> D): (
Validated
<A, B>) ->
Validated
<C, D>
Lifts two functions to the Bifunctor type.
import arrow.core.*
fun main(args: Array<String>) {
//sampleStart
val f = Validated.lift(String::toUpperCase, Int::inc)
val res1 = f("test".invalid())
val res2 = f(1.valid())
//sampleEnd
println("res1: $res1")
println("res2: $res2")
}
Do you like Arrow?
✖