# map

Maps successful and every optimistic value while preserving state structure.

## Signatures

```ts
export declare const map: {
    <A, B>(f: (a: A) => B): <E>(data: AsyncData<A, E>) => AsyncData<B, E>;
    <A, E, B>(data: AsyncData<A, E>, f: (a: A) => B): AsyncData<B, E>;
};
```

## Why

Value transformations should not erase progress, Causes, or optimistic rollback history. Cyclic history throws `TypeError`.

## Ownership and lifetime

This pure transformation acquires no resources and returns new plain wrappers.

## Examples

```ts
import { map, success } from "@typed/async-data"
const state = map(success(2), (n) => n * 2)
```
