Either

sealed class Either<out L, out R>(source)

Represents a disjoint union i.e. a type with two possibilities, either Left or Right.

Provides a Right biased map and flatMap function as well as a few others.

Inheritors

Functions

Link copied to clipboard
inline fun <L, R, T> Either<L, R>.flatMap(f: (R) -> Either<L, T>): Either<L, T>

flat-map over the Right side of this Either.

Link copied to clipboard
inline fun <T> fold(fL: (L) -> T, fR: (R) -> T): T

fold this.

Link copied to clipboard
inline fun <T> map(f: (R) -> T): Either<L, T>

Maps over the Right side of this Either.

Link copied to clipboard
fun toOption(): Option<R>

Turns this Either into an Option, the Right side becomes Some the left side is ignored and turned into None.