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

mapLeft

common 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:

import arrow.core.Ior

fun main() {
  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
<