effect-io-ai

Package: effect
Module: Record

Record.makeReducerUnion

Creates a Reducer for combining Records using union, with values for keys that exist in both records combined using the provided Combiner.

When to use

Use to build a reusable reducer for accumulating many records into one union-shaped record, preserving keys from every input and combining overlapping values with the supplied combiner.

Details

The returned reducer uses Record.union for combine and an empty record as initialValue, so the default combineAll folds from {} and accumulates keys from each input record.

See

Signature

declare const makeReducerUnion: <K extends string, A>(combiner: Combiner.Combiner<A>) => Reducer.Reducer<Record<K, A>>

Source

Since v4.0.0