//arrow-core/arrow.core/Ior/leftOrNull

leftOrNull

common fun leftOrNull(): A?

Returns the Left value or A if this is Left or Both and null if this is a Right.

Example:

import arrow.core.Ior

fun main() {
  val right = Ior.Right(12).leftOrNull()         // Result: null
  val left = Ior.Left(12).leftOrNull()           // Result: 12
  val both = Ior.Both(12, "power").leftOrNull()  // Result: 12
  println("right = $right")
  println("left = $left")
  println("both = $both")
}

Do you like Arrow?

Arrow Org
<