arrow-core-data / arrow.core / Either / lift

lift

@JvmStatic fun <A, B, C> lift(f: (B) -> C): (Either<A, B>) -> Either<A, C>

Lifts a function (B) -> C to the Either structure returning a polymorphic function that can be applied over all Either values in the shape of Either<A, B>

import arrow.core.*

fun main(args: Array<String>) {
 //sampleStart
 val f = Either.lift<Int, CharSequence, String> { s: CharSequence -> "$s World" }
 val either: Either<Int, CharSequence> = "Hello".right()
 val result = f(either)
 //sampleEnd
 println(result)
}

@JvmStatic fun <A, B, C, D> lift(fa: (A) -> C, fb: (B) -> D): (Either<A, B>) -> Either<C, D>

Do you like Arrow?

Arrow Org
<