Left

data class Left<out A>(val value: A) : Ior<A, Nothing>

Constructors

Link copied to clipboard
constructor(value: A)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val value: A

Functions

Link copied to clipboard
inline fun <A, B> Ior<A, B>.combine(other: Ior<A, B>, combineA: (A, A) -> A, combineB: (B, B) -> B): Ior<A, B>
Link copied to clipboard
operator fun <A : Comparable<A>, B : Comparable<B>> Ior<A, B>.compareTo(other: Ior<A, B>): Int
Link copied to clipboard
inline fun <A, B, D> Ior<A, B>.flatMap(combine: (A, A) -> A, f: (B) -> Ior<A, D>): Ior<A, D>

Binds the given function across Ior.Right.

Link copied to clipboard
inline fun <A, B> Ior<A, Ior<A, B>>.flatten(combine: (A, A) -> A): Ior<A, B>
Link copied to clipboard
inline fun <C> fold(fa: (A) -> C, fb: (Nothing) -> C, fab: (A, Nothing) -> C): C

Applies fa if this is a Left, fb if this is a Right or fab if this is a Both

Link copied to clipboard
inline fun <A, B> Ior<A, B>.getOrElse(default: (A) -> B): B
Link copied to clipboard
Link copied to clipboard
inline fun <A, B, D> Ior<A, B>.handleErrorWith(combine: (B, B) -> B, f: (A) -> Ior<D, B>): Ior<D, B>

Binds the given function across Ior.Left.

Link copied to clipboard

Returns true if this is a Both, false otherwise.

inline fun isBoth(leftPredicate: (A) -> Boolean, rightPredicate: (Nothing) -> Boolean): Boolean

Returns false if Right or Left, or returns the result of the application of the given predicate to the Both value.

Link copied to clipboard

Returns true if this is a Left, false otherwise.

inline fun isLeft(predicate: (A) -> Boolean): Boolean

Returns false if Right or Both, or returns the result of the application of the given predicate to the Left value.

Link copied to clipboard

Returns true if this is a Right, false otherwise.

inline fun isRight(predicate: (Nothing) -> Boolean): Boolean

Returns false if Left or Both, or returns the result of the application of the given predicate to the Right value.

Link copied to clipboard
fun leftOrNull(): A?

Returns the Left value or A if this is Left or Both and null if this is a Right.

Link copied to clipboard
inline fun <D> map(f: (Nothing) -> D): Ior<A, D>

The given function is applied if this is a Right or Both to B.

Link copied to clipboard
inline fun <C> mapLeft(fa: (A) -> C): Ior<C, Nothing>

The given function is applied if this is a Left or Both to A.

Link copied to clipboard
fun swap(): Ior<Nothing, A>

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

Link copied to clipboard

Returns a Either.Right containing the Right value or B if this is Right or Both and Either.Left if this is a Left.

Link copied to clipboard
fun <A, B> Ior<A, B>.toIorNel(): IorNel<A, B>

Given an Ior with an error type A, returns an IorNel with the same error type. Wraps the original error in a NonEmptyList so that it can be combined with an IorNel in a Raise DSL which operates on one.

Link copied to clipboard
fun toPair(): Pair<A?, Nothing?>
Link copied to clipboard
open override fun toString(): String
Link copied to clipboard

Return the isomorphic Either of this Ior