# Acc


Accumulator effect: emit/emitAll/collect for incremental list building.

## `collect`

_collect: read the acc effect's currently accumulated items as a list; impure request returning the contents captured so far._

```
collect : Computation [a]
```

Read the current accumulated items as a list. Returns whatever has been
emitted within the surrounding handled scope.

## `emit`

_emit: append a single item to the acc effect's accumulator; issues an impure effect request whose result is null._

```
emit : a -> Computation null
```

Append a single item to the accumulator. Pairs with `collect` to read
back all items emitted within the surrounding handled scope.

## `emitAll`

_emitAll: append a list of items to the acc effect's accumulator in a single impure request; one bind instead of N from mapping emit._

```
emitAll : [a] -> Computation null
```

Append a list of items to the accumulator in a single effect request.
Equivalent to mapping `emit` over the list but cheaper at runtime.

## `handler`

_acc.handler: standard accumulator handler implementing emit/emitAll/collect over a list state with `[]` as the initial value._

Standard accumulator handler. State is the list of accumulated items,
starting at `[]`.

```nix
handle { handlers = acc.handler; state = []; } comp
```

