Import
import { loopCause } from "@typed/fx/Sink";Signatures
export declare const loopCause: {
<B, A, C>(seed: B, f: (acc: B, a: Cause.Cause<A>) => readonly [
Cause.Cause<C>,
B
]): <E, R>(sink: Sink<A, C, R>) => Sink<A, E, R>;
<A, E, R, B, C>(sink: Sink<A, C, R>, seed: B, f: (acc: B, a: Cause.Cause<E>) => readonly [
Cause.Cause<C>,
B
]): Sink<A, E, R>;
};Why
Stateful error translation can retain retry or protocol context while preserving full Cause information.
Ownership and lifetime
Each adapted sink owns its seed. Failure callbacks update it synchronously in invocation order; successes pass through unchanged. Reusing the sink continues from its retained seed; create a new sink to reset. No resources are acquired.
Examples
import { Cause, Effect } from "effect"
import * as Sink from "@typed/fx/Sink"
const target: Sink.Sink<number, string> = Sink.make(Effect.logError, Effect.log)
const counted = Sink.loopCause(target, 0, (n, cause: Cause.Cause<string>) => [cause, n + 1])Other public imports
These import paths expose the same declaration. Each page retains its own public name and signature.