IorEffect

class IorEffect<E>(semigroup: Semigroup<E>, cont: ContEffect<E>) : ContEffect<E> , Semigroup<E>

Functions

bind
Link copied to clipboard
open suspend fun <B> Cont<E, B>.bind(): B

Runs the Cont to finish, returning B or shift in case of R.

open suspend fun <B> Either<E, B>.bind(): B

Folds Either into Cont, by returning B or a shift with R.

open suspend fun <B> Validated<E, B>.bind(): B

Folds Validated into Cont, by returning B or a shift with R.

suspend fun <B> Ior<E, B>.bind(): B

open suspend fun <B> Option<B>.bind(shift: () -> E): B

Folds Option into Cont, by returning B or a transforming None into R and shifting the result.

open suspend fun <B> Result<B>.bind(transform: (Throwable) -> E): B

Folds Result into Cont, by returning B or a transforming Throwable into R and shifting the result.

combine
Link copied to clipboard
open override fun E.combine(b: E): E
ensure
Link copied to clipboard
open suspend fun ensure(condition: Boolean, shift: () -> E)

ensure that condition is true, if it's false it will shift with the provided value R. Monadic version of kotlin.require.

maybeCombine
Link copied to clipboard
open override fun E.maybeCombine(b: E?): E
plus
Link copied to clipboard
open operator override fun E.plus(b: E): E
shift
Link copied to clipboard
open suspend override fun <B> shift(r: E): B

Short-circuit the Cont computation with value R.

Sources

common source
Link copied to clipboard