nee-core / dev.neeffect.nee / Nee

Nee

sealed class Nee<R, E, out A>

Nee monad.

Naive enterprise effects Wraps business function inside some "effects".

Parameters

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)

A - expected result type

Functions

anyError

fun anyError(): ANee<R, A>

flatMap

abstract fun <B> flatMap(f: (A) -> Nee<R, E, B>): Nee<R, 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>

Companion Object Functions

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>

flatOut

fun <R, E, A, E1 : E> flatOut(f: Nee<R, E, Out<E1, A>>): <ERROR CLASS>

pure

fun <R, E, A> pure(a: A): Nee<R, E, 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>