arrow-core-data / arrow.core / Either / orNull
fun orNull(): B?
Returns the right value if it exists, otherwise null
Example:
import arrow.core.Right
import arrow.core.Left
//sampleStart
val right = Right(12).orNull() // Result: 12
val left = Left(12).orNull()   // Result: null
//sampleEnd
fun main() {
  println("right = $right")
  println("left = $left")
}
Do you like Arrow?
✖