arrow-core-data / arrow.core / Either / map

map

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

The given function is applied if this is a Right.

Example:

Right(12).map { "flower" } // Result: Right("flower")
Left(12).map { "flower" }  // Result: Left(12)

Do you like Arrow?

Arrow Org
<