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

Function chain_

packages/effect-app/src/Set.ts:205–220  ·  view source on GitHub ↗
(
  E: Equivalence.Equivalence<B>
)

Source from the content-addressed store, hash-verified

203 * Map + Flatten
204 */
205export function chain_<B>(
206 E: Equivalence.Equivalence<B>
207): <A>(set: Set<A>, f: (x: A) => Set<B>) => Set<B> {
208 const elemE = elem_(E)
209 return (set, f) => {
210 const r = new Set<B>()
211 set.forEach((e) => {
212 f(e).forEach((e) => {
213 if (!elemE(r, e)) {
214 r.add(e)
215 }
216 })
217 })
218 return r
219 }
220}
221
222/**
223 * `true` if and only if every element in the first set is an element of the second set

Callers 1

chainFunction · 0.85

Calls 4

elem_Function · 0.85
fFunction · 0.70
forEachMethod · 0.65
addMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…