MCPcopy Index your code
hub / github.com/Effect-TS/effect / updateWith

Function updateWith

packages/effect/src/internal/differ.ts:155–174  ·  view source on GitHub ↗
(f: (x: A, y: A) => A)

Source from the content-addressed store, hash-verified

153
154/** @internal */
155export 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 */
177export const zip = Dual.dual<

Callers 1

updateFunction · 0.85

Calls 5

constantFunction · 0.85
makeFunction · 0.70
firstFunction · 0.70
fFunction · 0.50
patchFunction · 0.50

Tested by

no test coverage detected