Either

sealed class Either<out L, out R>

Represents a value of one of two possible types.

An instance of Either is an instance of either Left or Right. It is right-biased, meaning it's the default case to operate on.

Inheritors

Types

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

Functions

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

Right-biased map.

Link copied to clipboard
fun onFailure(fn: (failure: L) -> Unit): Either<L, R>
Link copied to clipboard
fun onSuccess(fn: (success: R) -> Unit): Either<L, R>