# Fx.filterMapLoopEffect

Effectfully loops over an Fx with an accumulator, producing an optional new 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>(self: Fx<A, E | E2, R>) => Fx<C, E | E2, R | R2>;
    <A, E, R, B, R2, C>(self: Fx<A, E, R>, seed: B, f: (acc: B, a: A) => Effect.Effect<readonly [
        Option.Option<C>,
        B
    ], E, R2>): Fx<C, E, R | R2>;
};
```

## Why

`filterMapLoopEffect` makes the state transition Effectful while retaining zero-or-one output per
input. It adds no serialization: overlapping producer callbacks can read the same seed, complete
out of order, and overwrite one another's next state.

## Ownership and lifetime

One mutable seed belongs to each run. Callback Causes are delivered to the Sink, services remain
required, and interruption follows each delivery; callers need a serialized producer for atomic state.

## Examples

```ts
import { Effect, Option } from "effect"
import { Fx } from "@typed/fx"

const counted = Fx.fromIterable(["a", "b"]).pipe(
  Fx.filterMapLoopEffect(0, (count, value) => Effect.succeed([Option.some(`${count}:${value}`), count + 1])),
)
```
