Navigation

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 [].

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