# Sink.filterMapLoopEffect

Threads state through an effectful success transition and optionally forwards its value.

## Signatures

```ts
export declare const filterMapLoopEffect: {
    <B, A, E2, R2, C>(seed: B, f: (acc: B, a: A) => Effect.Effect<readonly [
        Option.Option<C>,
        B
    ], E2, R2>): <E, R>(sink: Sink<C, E, R>) => Sink<A, E | E2, R | R2>;
    <A, E, R, B, R2, C>(sink: Sink<C, E, R>, seed: B, f: (acc: B, a: A) => Effect.Effect<readonly [
        Option.Option<C>,
        B
    ], E, R2>): Sink<A, E, R | R2>;
};
```

## Why

One transition can perform service-backed work, update state, and decide whether the consumer
should observe a value.

## Ownership and lifetime

Callback invocation constructs a transition Effect from the seed visible at that moment. The
adapter does not serialize those Effects: overlapping callbacks can read the same seed, and
successful transitions commit in completion order. `Some` then invokes the wrapped sink once,
`None` not at all, and failure invokes its failure callback without committing. The sink instance
retains its seed across producer runs; construct a new one to reset it.

## Examples

```ts
import { Effect, Option } from "effect"
import * as Sink from "@typed/fx/Sink"
const target = Sink.make(Effect.logError, Effect.log)
const sink = Sink.filterMapLoopEffect(target, 0, (count, n: number) => Effect.succeed([Option.some(n), count + 1] as const))
```
