getOrNull

fun getOrNull(): B?(source)

Returns the encapsulated value B if this instance represents Either.Right or null if it is Either.Left.

import arrow.core.Either
import io.kotest.matchers.shouldBe

fun test() {
Either.Right(12).getOrNull() shouldBe 12
Either.Left(12).getOrNull() shouldBe null
}