arrow-core-data / arrow.core / Either / swap

swap

fun swap(): Either<B, A>

If this is a Left, then return the left value in Right or vice versa.

Example:

Left("left").swap()   // Result: Right("left")
Right("right").swap() // Result: Left("right")

Do you like Arrow?

Arrow Org
<