MCPcopy Create free account
hub / github.com/Effect-TS/effect / makeReducer

Function makeReducer

packages/effect/src/UndefinedOr.ts:171–177  ·  view source on GitHub ↗
(combiner: Combiner.Combiner<A>)

Source from the content-addressed store, hash-verified

169 * @since 4.0.0
170 */
171export function makeReducer<A>(combiner: Combiner.Combiner<A>): Reducer.Reducer<A | undefined> {
172 return Reducer.make((self, that) => {
173 if (self === undefined) return that
174 if (that === undefined) return self
175 return combiner.combine(self, that)
176 }, undefined as A | undefined)
177}
178
179/**
180 * Creates a `Combiner` for `A | undefined` that combines values only when both

Callers

nothing calls this directly

Calls 2

makeMethod · 0.65
combineMethod · 0.65

Tested by

no test coverage detected