Ior
Port of https://github.com/typelevel/cats/blob/v0.9.0/core/src/main/scala/cats/data/Ior.scala
Represents a right-biased disjunction that is either an A
, or a B
, or both an A
and a B
.
An instance of Ior<A
,B
> is one of:
Ior<A
,B
> is similar to 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 Ior.Both values using a combine
function (A, A) -> A
, while other methods, like toEither, ignore the A
value in a Ior.Both Both.
Ior<A
,B
> is isomorphic to Either<Either<A
,B
>, Pair<A
,B
>>, but provides methods biased toward B
values, regardless of whether the B
values appear in a Ior.Right or a Ior.Both. The isomorphic Either form can be accessed via the unwrap method.