arrow-core-data / arrow.core / Ior / toEither

toEither

fun toEither(): Either<A, B>

Returns a Either.Right containing the Right value or B if this is Right or Both and Either.Left if this is a Left.

Example:

Right(12).toEither() // Result: Either.Right(12)
Left(12).toEither()  // Result: Either.Left(12)
Both("power", 12).toEither()  // Result: Either.Right(12)

Do you like Arrow?

Arrow Org
<