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

Function makeReducer

packages/effect/src/Option.ts:2396–2402  ·  view source on GitHub ↗
(combiner: Combiner.Combiner<A>)

Source from the content-addressed store, hash-verified

2394 * @since 4.0.0
2395 */
2396export function makeReducer<A>(combiner: Combiner.Combiner<A>): Reducer.Reducer<Option<A>> {
2397 return Reducer.make((self, that) => {
2398 if (isNone(self)) return that
2399 if (isNone(that)) return self
2400 return some(combiner.combine(self.value, that.value))
2401 }, none())
2402}
2403
2404/**
2405 * Creates a `Combiner` for `Option<A>` with fail-fast semantics: returns `None`

Callers

nothing calls this directly

Calls 5

isNoneFunction · 0.85
someFunction · 0.70
noneFunction · 0.70
makeMethod · 0.65
combineMethod · 0.65

Tested by

no test coverage detected