MCPcopy Create free account
hub / github.com/effect-app/libs / insert_

Function insert_

packages/effect-app/src/Set.ts:458–469  ·  view source on GitHub ↗
(E: Equivalence.Equivalence<A>)

Source from the content-addressed store, hash-verified

456 * Insert a value into a set
457 */
458export function insert_<A>(E: Equivalence.Equivalence<A>): (set: Set<A>, a: A) => Set<A> {
459 const elemE = elem_(E)
460 return (set, a) => {
461 if (!elemE(set, a)) {
462 const r = new Set(set)
463 r.add(a)
464 return r
465 } else {
466 return set
467 }
468 }
469}
470
471/**
472 * Delete a value from a set

Callers 2

insertFunction · 0.85
make_Function · 0.85

Calls 2

elem_Function · 0.85
addMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…