import { Either, isLeft } from './Either'
import { fromLeft } from './Left'
import { fromRight } from './Right'
/**
* Swaps the values contained in an `Either`.
* @name swap(either: Either): Either
*/
export function swap(either: Either): Either {
return isLeft(either) ? Either.of(fromLeft(either)) : Either.left(fromRight(either))
}