Hyperlinkv0.8.0-beta.28

HashSet

HashSet.unionconsteffect/HashSet.ts:366
<V1>(that: HashSet<V1>): <V0>(self: HashSet<V0>) => HashSet<V1 | V0>
<V0, V1>(self: HashSet<V0>, that: HashSet<V1>): HashSet<V0 | V1>

Creates the union of two HashSets.

Example (Combining HashSets)

import { HashSet } from "effect"

const set1 = HashSet.make("a", "b")
const set2 = HashSet.make("b", "c")
const combined = HashSet.union(set1, set2)

console.log(Array.from(combined).sort()) // ["a", "b", "c"]
console.log(HashSet.size(combined)) // 3
combinators
Source effect/HashSet.ts:3667 lines
export const union: {
  <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.union)
Referenced by 1 symbols