(combiner: Combiner.Combiner<A>)
| 2471 | * @since 4.0.0 |
| 2472 | */ |
| 2473 | export function makeReducer<A>(combiner: Combiner.Combiner<A>): Reducer.Reducer<Option<A>> { |
| 2474 | return Reducer.make((self, that) => { |
| 2475 | if (isNone(self)) return that |
| 2476 | if (isNone(that)) return self |
| 2477 | return some(combiner.combine(self.value, that.value)) |
| 2478 | }, none()) |
| 2479 | } |
| 2480 | |
| 2481 | /** |
| 2482 | * Creates a `Combiner` for `Option<A>` with fail-fast semantics: returns `None` |