Import
import { filterMapLoop } from "@typed/fx/Sink";Signatures
export declare const filterMapLoop: {
<B, A, C>(seed: B, f: (acc: B, a: A) => readonly [
Option.Option<C>,
B
]): <E, R>(sink: Sink<C, E, R>) => Sink<A, E, R>;
<A, E, R, B, C>(sink: Sink<C, E, R>, seed: B, f: (acc: B, a: A) => readonly [
Option.Option<C>,
B
]): Sink<A, E, R>;
};Why
It combines consumer-side state, filtering, and mapping in one ordered transition.
Ownership and lifetime
Each adapted sink owns its seed. Every input updates state synchronously; Some emits once and
None emits nothing. Failures pass through. Reusing the sink continues from its retained seed;
create a new sink to reset. The adapter acquires no resources.
Examples
import { Effect, Option } from "effect"
import * as Sink from "@typed/fx/Sink"
const target = Sink.make(Effect.logError, Effect.log)
const everyOther = Sink.filterMapLoop(target, false, (skip, n: number) => [skip ? Option.none() : Option.some(n), !skip])Other public imports
These import paths expose the same declaration. Each page retains its own public name and signature.