A Ior B is similar to scala.util.Either[A, B], except that it can represent the simultaneous presence of
an A and a B. It is right-biased so methods such as map and flatMap operate on the
B value. Some methods, like flatMap, handle the presence of two Both values using a
Semigroup[A], while other methods, like toEither, ignore the A value in a Both.
A Ior B is isomorphic to Either[Either[A, B], (A, B)], but provides methods biased toward B
values, regardless of whether the B values appear in a Right or a Both.
The isomorphic scala.util.Either form can be accessed via the unwrap method.
Represents a right-biased disjunction that is either an
A
, or aB
, or both anA
and aB
.An instance of
A Ior B
is one of:Left[A]
Right[B]
Both[A, B]
A Ior B
is similar toscala.util.Either[A, B]
, except that it can represent the simultaneous presence of anA
and aB
. It is right-biased so methods such asmap
andflatMap
operate on theB
value. Some methods, likeflatMap
, handle the presence of two Both values using aSemigroup[A]
, while other methods, like toEither, ignore theA
value in a Both.A Ior B
is isomorphic toEither[Either[A, B], (A, B)]
, but provides methods biased towardB
values, regardless of whether theB
values appear in a Right or a Both. The isomorphicscala.util.Either
form can be accessed via the unwrap method.