//arrow-core/arrow.core/Ior/swap

swap

common fun swap(): Ior<B, A>

If this is a Left, then return the left value in Right or vice versa, when this is Both , left and right values are swap

Example:

import arrow.core.Ior

fun main() {
  Ior.Left("left").swap()   // Result: Right("left")
  Ior.Right("right").swap() // Result: Left("right")
  Ior.Both("left", "right").swap() // Result: Both("right", "left")
}

Do you like Arrow?

Arrow Org
<