nee-core / dev.neeffect.nee

Package dev.neeffect.nee

Types

ANee

Nee returning Any error.

typealias ANee<R, A> = Nee<R, Any, A>

Effect

An effect, or maybe aspect :-)

interface Effect<R, E>

Effects

data class Effects<R1, R2 : R1, E1, E2> : Effect<R2, Either<E1, E2>>

HandleErrorEffect

data class HandleErrorEffect<R, E, E1> : Effect<R, E1>

IO

typealias IO<A> = Nee<Any, Nothing, A>

Nee

Nee monad.

sealed class Nee<in R, out E, out A>

NoEffect

class NoEffect<R, E> : Effect<R, E>

Functions

andThen

Composition of effects.

fun <R1, E1, R2 : R1, E2> Effect<R2, E2>.andThen(otherEffect: Effect<R1, E1>): Effect<R2, Either<E1, E2>>

anyError

fun <R, E> Effect<R, E>.anyError(): Effect<R, Any>

go

fun <R, E, A> Nee<R, E, A>.go(): suspend R.() -> A
suspend fun <R, E, A> R.go(n: Nee<R, E, A>): A

goSafe

suspend fun <R, E, A> R.goSafe(n: Nee<R, E, A>): Either<E, out A>

k

fun <E, A> Out<E, A>.k(): suspend () -> Either<E, A>

noEffect

fun <R, E> noEffect(): NoEffect<R, E>

plus

operator fun <R1, E1, R2 : R1, E2 : E1> Effect<R2, E2>.plus(otherEffect: Effect<R1, E1>): Effect<R2, E1>

runNee

fun <T> runNee(context: CoroutineContext = EmptyCoroutineContext, block: suspend CoroutineScope.() -> T): Nee<Any, Throwable, T>

then

infix fun <R1, E1, R2 : R1, E2> Effect<R2, E2>.then(otherEffect: Effect<R1, E1>): Effect<R2, Either<E1, E2>>

widerError

fun <R, E, A, E1 : E> Nee<R, E1, A>.widerError(): Nee<R, E, A>

with

infix fun <R1, E1, R2 : R1, E2 : E1> Effect<R2, E2>.with(otherEffect: Effect<R1, E1>): Effect<R2, E1>

withErrorType

fun <R, E, A> Nee<R, Nothing, A>.withErrorType(): Nee<R, E, A>