CombinatorsswapEitherswapEither CallableswapEither<L, R>(x: Either<L, R>): Either<R, L>If the input is a Left, return a Right with the same value, otherwise return a Left with the same value. ExampleswapEither({left: "foobar"})// => {right: "foobar"}swapEither({right: "foobar"})// => {left: "foobar"}Type parametersLThe Left type.RThe Right type.Parametersx: Either<L, R>Returns Either<R, L>
If the input is a Left, return a Right with the same value, otherwise return a Left with the same value.
Example