map

inline fun <C> map(f: (right: B) -> C): Either<A, C>(source)

Map, or transform, the right value B of this Either to a new value C.

import arrow.core.Either
import io.kotest.matchers.shouldBe

fun test() {
Either.Right(12).map { _: Int ->"flower" } shouldBe Either.Right("flower")
Either.Left(12).map { _: Nothing -> "flower" } shouldBe Either.Left(12)
}