# Fx.loopCause

Loops over the failure causes of an Fx with an accumulator.

## Signatures

```ts
export declare const loopCause: {
    <B, A, C>(seed: B, f: (acc: B, a: Cause.Cause<A>) => readonly [
        Cause.Cause<C>,
        B
    ]): <E, R>(self: Fx<A, E, R>) => Fx<A, C, R>;
    <A, E, R, B, C>(self: Fx<A, E, R>, seed: B, f: (acc: B, a: Cause.Cause<E>) => readonly [
        Cause.Cause<C>,
        B
    ]): Fx<A, C, R>;
};
```

## Why

`loopCause` is the stateful counterpart of error mapping over full Effect causes. Successful
values pass unchanged; each cause is synchronously transformed and advances the error state.

## Ownership and lifetime

A fresh state begins for each run and is discarded afterward. The callback owns no resources and
sees typed failures, defects, and interruption represented by `Cause`.

## Examples

```ts
import { Cause } from "effect"
import { Fx } from "@typed/fx"

const numbered = Fx.fail("offline").pipe(Fx.loopCause(0, (n, cause) => [Cause.map(cause, (e) => `${n}:${e}`), n + 1]))
```
