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

Function diff

packages/effect/src/internal/differ/hashSetPatch.ts:103–117  ·  view source on GitHub ↗
(
  oldValue: HashSet.HashSet<Value>,
  newValue: HashSet.HashSet<Value>
)

Source from the content-addressed store, hash-verified

101
102/** @internal */
103export const diff = <Value>(
104 oldValue: HashSet.HashSet<Value>,
105 newValue: HashSet.HashSet<Value>
106): Differ.HashSet.Patch<Value> => {
107 const [removed, patch] = HashSet.reduce(
108 [oldValue, empty<Value>()] as const,
109 ([set, patch], value: Value) => {
110 if (HashSet.has(value)(set)) {
111 return [HashSet.remove(value)(set), patch] as const
112 }
113 return [set, combine(makeAdd(value))(patch)] as const
114 }
115 )(newValue)
116 return HashSet.reduce(patch, (patch, value: Value) => combine(makeRemove(value))(patch))(removed)
117}
118
119/** @internal */
120export const combine = Dual.dual<

Callers

nothing calls this directly

Calls 5

emptyFunction · 0.70
makeAddFunction · 0.70
makeRemoveFunction · 0.70
removeMethod · 0.65
combineFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…