# Fx.catchIf

Recovers a typed failure only when a predicate accepts it.

## Signatures

```ts
export declare const catchIf: {
    <E, A2, E2, R2>(predicate: (e: E) => boolean, f: (e: E) => Fx<A2, E2, R2>): <A, R>(self: Fx<A, E, R>) => Fx<A | A2, E | E2, R | R2>;
    <A, E, R, A2, E2, R2>(self: Fx<A, E, R>, predicate: (e: E) => boolean, f: (e: E) => Fx<A2, E2, R2>): Fx<A | A2, E | E2, R | R2>;
};
```

## Why

Some typed errors are distinguished by values rather than tags. Predicate
recovery handles that subset while retaining `E` in the result because a
rejected error can still escape.

## Ownership and lifetime

The predicate is evaluated on the first Fail found anywhere in the source
Cause. A match starts one lazy fallback and replaces that entire Cause,
including any defects or interrupts composed with the Fail. A rejection, or
a Cause containing no Fail, forwards the original Cause unchanged. The
fallback contributes its errors and services and shares the subscription.

## Examples

```ts
import { catchIf } from "@typed/fx/Fx"
import { fail, succeed } from "@typed/fx/Fx"

const recovered = catchIf(fail(404), (status) => status === 404, () => succeed("missing"))
```
