# catch

Recovers typed failures and lifts the recovery result into `Some`.

## Signatures

```ts
export { catchAll as catch };
```

```ts
export declare const catchAll: {
    <E, O2, E2, R2>(f: (e: E) => Effect.Effect<O2, E2, R2>): <I, O, R>(guard: GuardInput<I, O, E, R>) => Guard<I, O | O2, E2, R | R2>;
    <I, O, E, R, O2, E2, R2>(guard: GuardInput<I, O, E, R>, f: (e: E) => Effect.Effect<O2, E2, R2>): Guard<I, O | O2, E2, R | R2>;
};
```

## Why

Typed recovery leaves defects and interruption untouched and does not confuse successful `None` with failure. The exported `catch` name is an alias of this declaration.

## Ownership and lifetime

Construction acquires no resources; recovery starts only for typed failure during the source invocation.

## Examples

```ts
import { catchAll } from "@typed/guard"
import type { Guard } from "@typed/guard"
import { Effect } from "effect"
const source: Guard<string, string, string> = (input) => input ? Effect.succeedSome(input) : Effect.fail("empty")
const recovered = catchAll(source, (error) => Effect.succeed(error.length))
```
