EitherEffect

fun interface EitherEffect<E, A> : Effect<Either<E, A>>

Functions

Link copied to clipboard
open suspend fun <B> Either<E, B>.bind(): B
open suspend fun <B> Validated<E, B>.bind(): B
open suspend fun <B> Result<B>.bind(transform: (Throwable) -> E): B
Link copied to clipboard
abstract fun control(): DelimitedScope<Either<E, A>>
Link copied to clipboard
open suspend fun ensure(value: Boolean, orLeft: () -> E)

Ensure check if the value is true, and if it is it allows the either { } binding to continue. In case it is false, then it short-circuits the binding and returns the provided value by orLeft inside an Either.Left.

Inheritors

Link copied to clipboard

Extensions

Link copied to clipboard
suspend fun <E, B : Any> EitherEffect<E, *>.ensureNotNull(value: B?, orLeft: () -> E): B

Ensures that value is not null. When the value is not null, then it will be returned as non null and the check value is now smart-checked to non-null. Otherwise, if the value is null then the either binding will short-circuit with orLeft inside of Either.Left.