| 153 | |
| 154 | /** @internal */ |
| 155 | export const updateWith = <A>(f: (x: A, y: A) => A): Differ.Differ<A, (a: A) => A> => |
| 156 | make({ |
| 157 | empty: identity, |
| 158 | combine: (first, second) => { |
| 159 | if (first === identity) { |
| 160 | return second |
| 161 | } |
| 162 | if (second === identity) { |
| 163 | return first |
| 164 | } |
| 165 | return (a) => second(first(a)) |
| 166 | }, |
| 167 | diff: (oldValue, newValue) => { |
| 168 | if (Equal.equals(oldValue, newValue)) { |
| 169 | return identity |
| 170 | } |
| 171 | return constant(newValue) |
| 172 | }, |
| 173 | patch: (patch, oldValue) => f(oldValue, patch(oldValue)) |
| 174 | }) |
| 175 | |
| 176 | /** @internal */ |
| 177 | export const zip = Dual.dual< |