Import
import { Sink } from "@typed/fx";Access Sink.loopCauseEffect through the imported Sink export. Its declaration below describes the member.
This public exposure is a re-export. Its import path is supported; declaration documentation is shared with the other public exposures below.
Signatures
export declare const loopCauseEffect: {
<A, E, R2, B, C>(seed: B, f: (acc: B, a: Cause.Cause<E>) => Effect.Effect<readonly [
Cause.Cause<C>,
B
], E, R2>): <R>(sink: Sink<A, E | C, R>) => Sink<A, E, R | R2>;
<A, E, R, B, C, R2>(sink: Sink<A, E | C, R>, seed: B, f: (acc: B, a: Cause.Cause<E>) => Effect.Effect<readonly [
Cause.Cause<C>,
B
], E, R2>): Sink<A, E, R | R2>;
};Why
Failure handling can consult services and retain state while preserving the original Cause when the handler itself fails.
Ownership and lifetime
Callback invocation constructs a transition Effect from the seed visible at that moment. The adapter does not serialize those Effects: overlapping failures can read the same seed, and successful transitions commit in completion order. A transition failure is combined with the original cause and does not commit. Success values bypass the state machine. The sink instance retains its seed across producer runs; construct a new one to reset it.
Examples
import { Effect } from "effect"
import * as Sink from "@typed/fx/Sink"
const target = Sink.make(Effect.logError, Effect.log)
const sink = Sink.loopCauseEffect(target, 0, (count, cause) => Effect.succeed([cause, count + 1] as const))Other public imports
These import paths expose the same declaration. Each page retains its own public name and signature.