(combiner: Combiner.Combiner<A>)
| 2394 | * @since 4.0.0 |
| 2395 | */ |
| 2396 | export 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` |