Follow one execution
Effectfully loops over the failure causes of an Fx with an accumulator.
filterMapLoopCauseEffectTick 0. Source: loaded; Source: loaded.
Read this diagram
Follow each lane from left to right. Events stacked vertically share a tick; the green cursor marks the current time across every lane.
- A value
The text inside the pill is the emitted value. - Work starts
The raised chevron starts an inner run (^in the source). - The run returns
The vertical bar ends this lane’s run. - A cause is delivered
The exclamation mark belongs to this lane. - Work is interrupted
The cross marks cancellation of this run. - Current time
The line and diamond move together across all lanes. - Happening now
A highlighted event is at the current tick. - Still ahead
Muted, dashed values have not happened yet. - Time continues
The lane’s arrow is not a return marker. An empty stretch can be quiet work that is still running.
Illustrated ticks start at 0. At 1×, one illustrated tick takes one second; captions specify real durations when timing matters. A cause or interruption belongs to its lane, and other work may continue. Scroll horizontally to inspect the rest of a long timeline.
Cause state and callback Effects belong to the consuming run. Services remain required, callback failure is sent to the Sink, and interruption follows each delivery; no semaphore is introduced.
Import
import { filterMapLoopCauseEffect } from "@typed/fx/Fx";Signatures
export declare const filterMapLoopCauseEffect: {
<B, A, E2, R2, C>(seed: B, f: (acc: B, a: Cause.Cause<A>) => Effect.Effect<readonly [
Option.Option<Cause.Cause<C>>,
B
], E2, R2>): <E, R>(self: Fx<A, E | E2, R>) => Fx<A, C | E2, R | R2>;
<A, E, R, B, R2, C>(self: Fx<A, E, R>, seed: B, f: (acc: B, a: Cause.Cause<E>) => Effect.Effect<readonly [
Option.Option<Cause.Cause<C>>,
B
], C, R2>): Fx<A, C, R | R2>;
};Why
filterMapLoopCauseEffect supports Effectful, stateful cause policy. Each Cause produces Some
to forward or None to suppress, but concurrent failure deliveries are not serialized and can
read the same seed or commit next states out of order.
Ownership and lifetime
Cause state and callback Effects belong to the consuming run. Services remain required, callback failure is sent to the Sink, and interruption follows each delivery; no semaphore is introduced.
Examples
import { Effect, Option } from "effect"
import { Fx } from "@typed/fx"
const handled = Fx.fail("offline").pipe(
Fx.filterMapLoopCauseEffect(0, (count, cause) => Effect.succeed([Option.some(cause), count + 1])),
)Other public imports
These import paths expose the same declaration. Each page retains its own public name and signature.