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

map

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

The given function is applied if this is a Right.

Example:

import arrow.core.*

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

Do you like Arrow?

Arrow Org
<