arrow-core-data / arrow.core / Either / toOption

toOption

fun toOption(): Option<B>

Returns a Some containing the Right value if it exists or a None if this is a Left.

Example:

Right(12).toOption() // Result: Some(12)
Left(12).toOption()  // Result: None

Do you like Arrow?

Arrow Org
<