Hyperlinkv0.8.0-beta.28

TxHashSet

TxHashSet.isEmptyconsteffect/TxHashSet.ts:478
<V>(self: TxHashSet<V>): Effect.Effect<boolean>

Checks whether the TxHashSet is empty.

Example (Checking whether a set is empty)

import { Effect, TxHashSet } from "effect"

const program = Effect.gen(function*() {
  const empty = yield* TxHashSet.empty<string>()
  console.log(yield* TxHashSet.isEmpty(empty)) // true

  const nonEmpty = yield* TxHashSet.make("a")
  console.log(yield* TxHashSet.isEmpty(nonEmpty)) // false
})
getters
export const isEmpty = <V>(self: TxHashSet<V>): Effect.Effect<boolean> =>
  Effect.gen(function*() {
    const set = yield* TxRef.get(self.ref)
    return HashSet.isEmpty(set)
  })