arrow-core-data / arrow.core / Ior / mapLeft

mapLeft

inline fun <C> mapLeft(fa: (A) -> C): Ior<C, B>

The given function is applied if this is a Left or Both to A.

Example:

Ior.Right(12).map { "flower" } // Result: Right(12)
Ior.Left(12).map { "flower" }  // Result: Left("power")
Ior.Both(12, "power").map { "flower $it" }  // Result: Both("flower 12", "power")

Do you like Arrow?

Arrow Org
<