ResultEffectScope

value class ResultEffectScope(cont: EffectScope<Throwable>) : EffectScope<Throwable>

Functions

Link copied to clipboard
suspend override fun <B> <ERROR CLASS><B>.bind(): B

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

open suspend fun <B> <ERROR CLASS><B>.bind(transform: (Throwable) -> Throwable): B

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

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

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

Link copied to clipboard
open suspend fun ensure(condition: Boolean, shift: () -> Throwable)

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

Link copied to clipboard
open suspend override fun <B> shift(r: Throwable): B

Short-circuit the Effect computation with value R.