sealed class Nee<in R, out E, out A>
Nee monad.
Naive enterprise effects Wraps business function inside some "effects".
R - environment to run function on
P - param of function (business)
//CONTROVERSIAL P is only added to handle caching
E - error that can happen (because of effects)
anyError |
fun anyError(): ANee<R, A> |
flatMap |
abstract fun <B, R1 : R, E2 : E> flatMap(f: (A) -> Nee<R1, E2, B>): Nee<R1, E, B> |
map |
abstract fun <B> map(f: (A) -> B): Nee<R, E, B> |
perform |
Call Nee with given environment. abstract fun perform(env: R): Out<E, A> |
runUnsafe |
fun runUnsafe(env: R): A |
constR |
Same as pure, but adds tracing. fun <R, E, A : Any> constR(effect: Effect<R, E>, value: A): Nee<R, E, A> |
constWithError |
fun <R, E, A> constWithError(effect: Effect<R, E>, func: (R) -> Out<E, A>): Nee<R, E, A> |
fail |
fun <E> fail(e: E): Nee<Any, E, Nothing> |
failOnly |
fun <R, E, A> failOnly(e: E): Nee<R, E, A> |
flatOut |
fun <R, E, A, E1 : E> flatOut(f: Nee<R, E, Out<E1, A>>): Nee<R, E, A> |
fromOut |
fun <A, E> fromOut(out: Out<E, A>): Nee<Any, E, A> |
pure |
fun <R, E, A> pure(a: () -> A): Nee<R, E, A> |
success |
alias to pure fun <A> success(a: () -> A): Nee<Any, Nothing, A> |
with |
from function - adds tracing. fun <R, E, A> with(effect: Effect<R, E>, func: (R) -> A): Nee<R, E, A> |
withError |
fun <R, E, A> withError(effect: Effect<R, E>, func: (R) -> Out<E, A>): Nee<R, E, A> |
go |
fun <R, E, A> Nee<R, E, A>.go(): suspend R.() -> A |
widerError |
fun <R, E, A, E1 : E> Nee<R, E1, A>.widerError(): Nee<R, E, A> |
withErrorType |
fun <R, E, A> Nee<R, Nothing, A>.withErrorType(): Nee<R, E, A> |