MCPcopy Create free account
hub / github.com/effect-app/libs / makeReducerFailFast

Function makeReducerFailFast

repos/effect/packages/effect/src/UndefinedOr.ts:228–239  ·  view source on GitHub ↗
(reducer: Reducer.Reducer<A>)

Source from the content-addressed store, hash-verified

226 * @since 4.0.0
227 */
228export function makeReducerFailFast<A>(reducer: Reducer.Reducer<A>): Reducer.Reducer<A | undefined> {
229 const combine = makeCombinerFailFast(reducer).combine
230 const initialValue = reducer.initialValue as A | undefined
231 return Reducer.make(combine, initialValue, (collection) => {
232 let out = initialValue
233 for (const value of collection) {
234 out = combine(out, value)
235 if (out === undefined) return out
236 }
237 return out
238 })
239}

Callers

nothing calls this directly

Calls 3

makeCombinerFailFastFunction · 0.70
combineFunction · 0.70
makeMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…