Skip to content
Effect 4.0 is here. One ecosystem. Zero dependencies.

Supervisor

A Supervisor<T> is allowed to supervise the launching and termination of fibers, producing some visible value of type T from the supervision.

11 exports Since v2.0.0 Source

Constructors

Signature

declare class AbstractSupervisor<T> implements Supervisor<T> {
constructor<T>();
readonly [SupervisorTypeId]: {
_T: (_: never) => never;
};
abstract value: Effect<T>;
map<B>(f: (a: T) => B): Supervisor<B>;
onEffect<A, E>(_fiber: RuntimeFiber<A, E>, _effect: Effect<any, any, any>): void;
onEnd<A, E>(_value: Exit<A, E>, _fiber: RuntimeFiber<A, E>): void;
onResume<A, E>(_fiber: RuntimeFiber<A, E>): void;
onRun<E, A, X>(execution: () => X, _fiber: RuntimeFiber<A, E>): X;
onStart<A, E, R>(_context: Context<R>, _effect: Effect<A, E, R>, _parent: Option<RuntimeFiber<any, any>>, _fiber: RuntimeFiber<A, E>): void;
onSuspend<A, E>(_fiber: RuntimeFiber<A, E>): void;
zip<A>(right: Supervisor<A>): Supervisor<[T, A]>;
}
Since v2.0.0

Creates a new supervisor that tracks children in a set.

Signature

declare const fibersIn: (ref: MutableRef.MutableRef<SortedSet.SortedSet<Fiber.RuntimeFiber<any, any>>>) => Effect.Effect<Supervisor<SortedSet.SortedSet<Fiber.RuntimeFiber<any, any>>>>

Creates a new supervisor that constantly yields effect when polled

Signature

declare const fromEffect: <A>(effect: Effect.Effect<A>) => Supervisor<A>
Since v2.0.0

A supervisor that doesn't do anything in response to supervision events.

Signature

declare const none: Supervisor<void>
Since v2.0.0

Creates a new supervisor that tracks children in a set.

Signature

declare const track: Effect.Effect<Supervisor<Array<Fiber.RuntimeFiber<any, any>>>>

Context

Signature

declare const addSupervisor: <A>(supervisor: Supervisor<A>) => Layer.Layer<never>

Models

Supervisor

interface
Since v2.0.0

Signature

interface Supervisor<out T> extends Variance<T> {
readonly value: Effect<T>;
map<B>(f: (a: T) => B): Supervisor<B>;
onEffect<A, E>(fiber: RuntimeFiber<A, E>, effect: Effect<any, any, any>): void;
onEnd<A, E>(value: Exit<A, E>, fiber: RuntimeFiber<A, E>): void;
onResume<A, E>(fiber: RuntimeFiber<A, E>): void;
onStart<A, E, R>(context: Context<R>, effect: Effect<A, E, R>, parent: Option<RuntimeFiber<any, any>>, fiber: RuntimeFiber<A, E>): void;
onSuspend<A, E>(fiber: RuntimeFiber<A, E>): void;
zip<A>(right: Supervisor<A>): Supervisor<[T, A]>;
}

Other

Symbols

Signature

declare const SupervisorTypeId: unique symbol

Signature

type SupervisorTypeId = typeof SupervisorTypeId

Unsafe

Unsafely creates a new supervisor that tracks children in a set.

Signature

declare const unsafeTrack: () => Supervisor<Array<Fiber.RuntimeFiber<any, any>>>