leftOrNull
Returns the unwrapped value A of Either.Left or null
if it is Either.Right.
import arrow.core.Either
import io.kotest.matchers.shouldBe
fun test() {
Either.Right(12).leftOrNull() shouldBe null
Either.Left(12).leftOrNull() shouldBe 12
}
Content copied to clipboard