nee-core / dev.neeffect.nee / Effect

Effect

interface Effect<R, E>

An effect, or maybe aspect :-)

Parameters

R - some environment param used by effect and business function

E - error caused by this effect

Functions

handleError

Installs error handler (kind of mapLeft).

open fun <XE> handleError(handler: (E) -> XE): Effect<R, XE>

wrap

Wrap a business function in a given effect

abstract fun <A> wrap(f: (R) -> A): (R) -> Pair<Out<E, A>, R>

Extension 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>

plus

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

then

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

with

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

Inheritors

AsyncEffect

Aynchority effect.

class AsyncEffect<R : ExecutionContextProvider> : Effect<R, Nothing>, Logging

CacheEffect

class CacheEffect<R, E, P> : Effect<R, E>

Effects

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

FlexSecEffect

Security effect - flex version.

class FlexSecEffect<USER, ROLE> : Effect<FlexibleEnv, SecurityError>

FlexTxEffect

Transaction (flexible env version).

class FlexTxEffect<R> : Effect<FlexibleEnv, TxError>

HandleErrorEffect

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

NoEffect

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

SecuredRunEffect

class SecuredRunEffect<USER, ROLE, R : SecurityProvider<USER, ROLE>> : Effect<R, SecurityError>

TraceEffect

class TraceEffect<R : TraceProvider<R>> : Effect<R, Nothing>

TxEffect

Transaction like effect.

class TxEffect<DB, R : TxProvider<DB, R>> : Effect<R, TxError>, Logging