Hyperlinkv0.8.0-beta.28

HashSet

HashSet.intersectionconsteffect/HashSet.ts:393
<V1>(that: HashSet<V1>): <V0>(self: HashSet<V0>) => HashSet<V1 & V0>
<V0, V1>(self: HashSet<V0>, that: HashSet<V1>): HashSet<V0 & V1>

Creates the intersection of two HashSets.

Example (Finding common HashSet values)

import { HashSet } from "effect"

const set1 = HashSet.make("a", "b", "c")
const set2 = HashSet.make("b", "c", "d")
const common = HashSet.intersection(set1, set2)

console.log(Array.from(common).sort()) // ["b", "c"]
console.log(HashSet.size(common)) // 2
combinators
Source effect/HashSet.ts:3937 lines
export const intersection: {
  <V1>(that: HashSet<V1>): <V0>(self: HashSet<V0>) => HashSet<V1 & V0>
  <V0, V1>(self: HashSet<V0>, that: HashSet<V1>): HashSet<V0 & V1>
} = Dual.dual<
  <V1>(that: HashSet<V1>) => <V0>(self: HashSet<V0>) => HashSet<V1 & V0>,
  <V0, V1>(self: HashSet<V0>, that: HashSet<V1>) => HashSet<V0 & V1>
>(2, internal.intersection)
Referenced by 1 symbols