Effect<A, E, R> class abstract

The Effect type represents an immutable description of a workflow or operation that is lazily executed.

Type parameters:

  • A (Success): The type of value that an effect can succeed with
  • E (Error): The type of expected errors that can occur
  • R (Requirements): The contextual data required by the effect
Available extensions

Constructors

Effect.new()
const

Properties

errorType Type

Available on Effect<A, E, R>, provided by the EffectTypes extension

Extract the error type
no setter
hashCode int
The hash code for this object.
no setterinherited
requirementsType Type

Available on Effect<A, E, R>, provided by the EffectTypes extension

Extract the requirements type
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
successType Type

Available on Effect<A, E, R>, provided by the EffectTypes extension

Extract the success type
no setter

Methods

catchAll<E2, R2>(Effect<A, E2, R2> f(E)) Effect<A, E2, R2>
Catches and recovers from errors
flatMap<B, E2, R2>(Effect<B, E2, R2> f(A)) Effect<B, E2, R2>
Flat maps this effect with another effect
fork([Context<R>? context]) Fiber<A, E>

Available on Effect<A, E, R>, provided by the EffectRunner extension

Forks this effect into a fiber using the default runtime
map<B>(B f(A)) Effect<B, E, R>
Maps the success value of this effect
mapError<E2>(E2 f(E)) Effect<A, E2, R>
Maps the error value of this effect
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
provideContext(Context<R> context) Effect<A, E, Never>
Provides the required context to this effect
provideService<S extends Object, R2>(S service) Effect<A, E, R2>
Provides a specific service to this effect
run([Context<R>? context]) Future<Exit<A, E>>

Available on Effect<A, E, R>, provided by the EffectRunner extension

Runs this effect using the default runtime
runToExit([Context<R>? context]) Future<Exit<A, E>>
Runs this effect and returns an Exit
runUnsafe([Context<R>? context]) Future<A>
Runs this effect unsafely, throwing on failure
runUnsafeWithDefaultRuntime([Context<R>? context]) Future<A>

Available on Effect<A, E, R>, provided by the EffectRunner extension

Runs this effect unsafely using the default runtime
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

async<A>(Future<A> computation()) Effect<A, Object, Never>
Creates an effect from an asynchronous computation
die(Object throwable) Effect<Never, Never, Never>
Creates an effect that dies with the given throwable
fail<E>(E error) Effect<Never, E, Never>
Creates an effect that fails with the given error
service<A extends Object>() Effect<A, Never, A>
Creates an effect that requires a specific service from the context
succeed<A>(A value) Effect<A, Never, Never>
Creates an effect that succeeds with the given value
sync<A>(A computation()) Effect<A, Object, Never>
Creates an effect from a synchronous computation that might throw