Package: effect
Module: TxHashSet
Converts the TxHashSet to an immutable HashSet snapshot.
Example (Taking a HashSet snapshot)
import { Effect, HashSet, TxHashSet } from "effect"
const program = Effect.gen(function*() {
const txSet = yield* TxHashSet.make("x", "y", "z")
const hashSet = yield* TxHashSet.toHashSet(txSet)
console.log(HashSet.size(hashSet)) // 3
console.log(HashSet.has(hashSet, "y")) // true
// hashSet is a snapshot - modifications to txSet don't affect it
yield* TxHashSet.add(txSet, "w")
console.log(HashSet.size(hashSet)) // 3 (unchanged)
console.log(yield* TxHashSet.size(txSet)) // 4
})
Signature
declare const toHashSet: <V>(self: TxHashSet<V>) => Effect.Effect<HashSet.HashSet<V>>
Since v2.0.0