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

Function makeReducerFailFast

packages/effect/src/Option.ts:2551–2562  ·  view source on GitHub ↗
(reducer: Reducer.Reducer<A>)

Source from the content-addressed store, hash-verified

2549 * @since 4.0.0
2550 */
2551export function makeReducerFailFast<A>(reducer: Reducer.Reducer<A>): Reducer.Reducer<Option<A>> {
2552 const combine = makeCombinerFailFast(reducer).combine
2553 const initialValue = some(reducer.initialValue)
2554 return Reducer.make(combine, initialValue, (collection) => {
2555 let out = initialValue
2556 for (const value of collection) {
2557 out = combine(out, value)
2558 if (isNone(out)) return out
2559 }
2560 return out
2561 })
2562}

Callers

nothing calls this directly

Calls 5

isNoneFunction · 0.85
makeCombinerFailFastFunction · 0.70
someFunction · 0.70
makeMethod · 0.65
combineFunction · 0.50

Tested by

no test coverage detected