getOrNone

Transforms Either into Option, where the encapsulated value B is wrapped in Some when this instance represents Either.Right, or None if it is Either.Left.

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

fun test() {
Either.Right(12).getOrNone() shouldBe Some(12)
Either.Left(12).getOrNone() shouldBe None
}