lift
inline fun <E, A, B> lift(crossinline f: (A) -> B): (Validated<E, A>) -> Validated<E, B>
Content copied to clipboard
inline fun <A, B, C, D> lift(crossinline fl: (A) -> C, crossinline fr: (B) -> D): (Validated<A, B>) -> Validated<C, D>
Content copied to clipboard
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")
}Content copied to clipboard