doc / ch.tutteli.atrium.core / Either

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.

Functions

fold

fun <T> fold(fL: (L) -> T, fR: (R) -> T): T

map

fun <T> map(f: (R) -> T): Either<L, T>

toOption

fun toOption(): Option<R>

Extension Functions

flatMap

fun <L, R, T> Either<L, R>.flatMap(f: (R) -> Either<L, T>): Either<L, T>

Inheritors

Left

data class Left<L> : Either<L, Nothing>

The left case of an Either.

Right

data class Right<R> : Either<Nothing, R>

The right case of an Either.