arrow-core-data / arrow.core / Either / mapLeft

mapLeft

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

The given function is applied if this is a Left.

Example:

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

Do you like Arrow?

Arrow Org
<