Ior

`@higherkind sealed class Ior<out A, out B>`

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 `[Semigroup]<`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.

Types

 Both `data class Both : ``Ior``` Left `data class Left : ``Ior``` Right `data class Right : ``Ior```

Properties

 isBoth Returns `true` if this is a Both, `false` otherwise.`abstract val isBoth: ``Boolean` isLeft Returns `true` if this is a Left, `false` otherwise.`abstract val isLeft: ``Boolean` isRight Returns `true` if this is a Right, `false` otherwise.`abstract val isRight: ``Boolean`

Functions

 bifoldLeft `fun bifoldLeft(c: C, f: (C, A) -> C, g: (C, B) -> C): C` bifoldRight `fun bifoldRight(c: ``Eval``, f: (A, ``Eval``) -> ``Eval``, g: (B, ``Eval``) -> ``Eval``): ``Eval``` bimap Apply `fa` if this is a Left or Both to `A` and apply `fb` if this is Right or Both to `B``fun bimap(fa: (A) -> C, fb: (B) -> D): ``Ior``` fold Applies `fa` if this is a Left, `fb` if this is a Right or `fab` if this is a Both`fun fold(fa: (A) -> C, fb: (B) -> C, fab: (A, B) -> C): C` foldLeft `fun foldLeft(c: C, f: (C, B) -> C): C` foldRight `fun foldRight(lc: ``Eval``, f: (B, ``Eval``) -> ``Eval``): ``Eval``` map The given function is applied if this is a Right or Both to `B`.`fun map(f: (B) -> D): ``Ior``` mapLeft The given function is applied if this is a Left or Both to `A`.`fun mapLeft(fa: (A) -> C): ``Ior``` pad Return this Ior as Pair of Option`fun pad(): ``Pair``<``Option``, ``Option``>` swap If this is a Left, then return the left value in Right or vice versa, when this is Both , left and right values are swap`fun swap(): ``Ior``` toEither Returns a Either.Right containing the Right value or `B` if this is Right or Both and Either.Left if this is a Left.`fun toEither(): ``Either``` toLeftOption Returns a Some containing the Left value or `A` if this is Left or Both and None if this is a Right.`fun toLeftOption(): ``Option``` toOption Returns a Some containing the Right value or `B` if this is Right or Both and None if this is a Left.`fun toOption(): ``Option``` toValidated Returns a Validated.Valid containing the Right value or `B` if this is Right or Both and Validated.Invalid if this is a Left.`fun toValidated(): ``Validated``` traverse `fun traverse(GA: ``Applicative``, f: (B) -> Kind): Kind>` unwrap Return the isomorphic Either of this Ior`fun unwrap(): ``Either``<``Either``, ``Pair``>`

Companion Object Functions

 bothNel `fun bothNel(a: A, b: B): ``IorNel``` fromOptions Create an Ior from two Options if at least one of them is defined.`fun fromOptions(oa: ``Option``, ob: ``Option``): ``Option``<``Ior``>` leftNel `fun leftNel(a: A): ``IorNel``` tailRecM `fun tailRecM(a: A, f: (A) -> >, SL: ``Semigroup``): ``Ior```

Extension Functions

 ap `fun ``Ior``.ap(SG: ``Semigroup``, ff: D>): ``Ior``` flatMap Binds the given function across Ior.Right.`fun ``Ior``.flatMap(SG: ``Semigroup``, f: (B) -> ``Ior``): ``Ior``` getOrElse `fun ``Ior``.getOrElse(default: () -> B): B`