Hyperlinkv0.8.0-beta.28

HashSet

HashSet.differenceconsteffect/HashSet.ts:420
<V1>(that: HashSet<V1>): <V0>(self: HashSet<V0>) => HashSet<V0>
<V0, V1>(self: HashSet<V0>, that: HashSet<V1>): HashSet<V0>

Creates the difference of two HashSets (elements in the first set that are not in the second).

Example (Finding HashSet differences)

import { HashSet } from "effect"

const set1 = HashSet.make("a", "b", "c")
const set2 = HashSet.make("b", "d")
const diff = HashSet.difference(set1, set2)

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