Either

sealed class Either<out L, out R>

Types

Link copied to clipboard
data class Left<out L, Nothing>(val value: L) : Either<L, Nothing>
Link copied to clipboard
data class Right<Nothing, out R>(val value: R) : Either<Nothing, R>

Functions

Link copied to clipboard
inline fun <X> fold(fl: (L) -> X, fr: (R) -> X): X
Link copied to clipboard
inline fun <X> map(f: (R) -> X): Either<L, X>
Link copied to clipboard
inline fun <X, Y> transform(fl: (L) -> X, fr: (R) -> Y): Either<X, Y>

Properties

Link copied to clipboard
abstract val isLeft: Boolean
Link copied to clipboard
abstract val isRight: Boolean
Link copied to clipboard
abstract val left: L?
Link copied to clipboard
abstract val right: R?

Inheritors

Link copied to clipboard
Link copied to clipboard

Extensions

Link copied to clipboard
inline fun <L, R, X> Either<L, R>.flatMap(f: (R) -> Either<L, X>): Either<L, X>
Link copied to clipboard
fun <L, R> Either<L, R>.getOrDefault(defaultValue: R): R
Link copied to clipboard
inline fun <L, R> Either<L, R>.getOrElse(onLeft: (L) -> R): R