effect-io-ai

Package: effect
Module: TxHashSet

TxHashSet.empty

Creates an empty TxHashSet.

Example (Creating an empty transactional hash set)

import { Effect, TxHashSet } from "effect"

const program = Effect.gen(function*() {
  const txSet = yield* TxHashSet.empty<string>()

  console.log(yield* TxHashSet.size(txSet)) // 0
  console.log(yield* TxHashSet.isEmpty(txSet)) // true

  // Add some values
  yield* TxHashSet.add(txSet, "hello")
  yield* TxHashSet.add(txSet, "world")
  console.log(yield* TxHashSet.size(txSet)) // 2
})

Signature

declare const empty: <V = never>() => Effect.Effect<TxHashSet<V>>

Source

Since v2.0.0