getOrNull
Returns the unwrapped value B of 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
}
Content copied to clipboard