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

Function makeReducerFailFast

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

Source from the content-addressed store, hash-verified

2470 * @since 4.0.0
2471 */
2472export function makeReducerFailFast<A>(reducer: Reducer.Reducer<A>): Reducer.Reducer<Option<A>> {
2473 const combine = makeCombinerFailFast(reducer).combine
2474 const initialValue = some(reducer.initialValue)
2475 return Reducer.make(combine, initialValue, (collection) => {
2476 let out = initialValue
2477 for (const value of collection) {
2478 out = combine(out, value)
2479 if (isNone(out)) return out
2480 }
2481 return out
2482 })
2483}

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