swap

fun swap(): Either<B, A>(source)

Swap the generic parameters A and B of this Either.

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

fun test() {
Either.Left("left").swap() shouldBe Either.Right("left")
Either.Right("right").swap() shouldBe Either.Left("right")
}