<V>(key: V): (self: MutableHashSet<V>) => boolean
<V>(self: MutableHashSet<V>, key: V): booleanChecks whether the MutableHashSet contains the specified value.
When to use
Use to test whether a mutable set currently contains a value.
Details
Membership follows the same hashing and equality rules as the underlying
MutableHashMap.
Example (Checking for a value)
import { MutableHashSet } from "effect"
const set = MutableHashSet.make("apple", "banana", "cherry")
console.log(MutableHashSet.has(set, "apple")) // true
console.log(MutableHashSet.has(set, "grape")) // false
// Pipe-able version
const hasApple = MutableHashSet.has("apple")
console.log(hasApple(set)) // true
// Check after adding
MutableHashSet.add(set, "grape")
console.log(MutableHashSet.has(set, "grape")) // trueexport const const has: {
<V>(key: V): (
self: MutableHashSet<V>
) => boolean
<V>(self: MutableHashSet<V>, key: V): boolean
}
Checks whether the MutableHashSet contains the specified value.
When to use
Use to test whether a mutable set currently contains a value.
Details
Membership follows the same hashing and equality rules as the underlying
MutableHashMap.
Example (Checking for a value)
import { MutableHashSet } from "effect"
const set = MutableHashSet.make("apple", "banana", "cherry")
console.log(MutableHashSet.has(set, "apple")) // true
console.log(MutableHashSet.has(set, "grape")) // false
// Pipe-able version
const hasApple = MutableHashSet.has("apple")
console.log(hasApple(set)) // true
// Check after adding
MutableHashSet.add(set, "grape")
console.log(MutableHashSet.has(set, "grape")) // true
has: {
<function (type parameter) V in <V>(key: V): (self: MutableHashSet<V>) => booleanV>(key: Vkey: function (type parameter) V in <V>(key: V): (self: MutableHashSet<V>) => booleanV): (self: MutableHashSet<V>(parameter) self: {
keyMap: MutableHashMap.MutableHashMap<V, boolean>;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
toString: () => string;
toJSON: () => unknown;
}
self: interface MutableHashSet<out V>A mutable hash set for storing unique values with Effect structural equality
support.
When to use
Use to store and mutate a collection of unique values with Effect hashing and
equality semantics.
Details
Operations mutate the set in place. Values that implement Equal / Hash
can be de-duplicated structurally; other values use normal JavaScript
reference or primitive equality.
Example (Using a mutable hash set)
import { MutableHashSet } from "effect"
// Create a mutable hash set
const set: MutableHashSet.MutableHashSet<string> = MutableHashSet.make(
"apple",
"banana"
)
// Add elements
MutableHashSet.add(set, "cherry")
// Check if elements exist
console.log(MutableHashSet.has(set, "apple")) // true
console.log(MutableHashSet.has(set, "grape")) // false
// Iterate over elements
for (const value of set) {
console.log(value) // "apple", "banana", "cherry"
}
// Get size
console.log(MutableHashSet.size(set)) // 3
MutableHashSet<function (type parameter) V in <V>(key: V): (self: MutableHashSet<V>) => booleanV>) => boolean
<function (type parameter) V in <V>(self: MutableHashSet<V>, key: V): booleanV>(self: MutableHashSet<V>(parameter) self: {
keyMap: MutableHashMap.MutableHashMap<V, boolean>;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
toString: () => string;
toJSON: () => unknown;
}
self: interface MutableHashSet<out V>A mutable hash set for storing unique values with Effect structural equality
support.
When to use
Use to store and mutate a collection of unique values with Effect hashing and
equality semantics.
Details
Operations mutate the set in place. Values that implement Equal / Hash
can be de-duplicated structurally; other values use normal JavaScript
reference or primitive equality.
Example (Using a mutable hash set)
import { MutableHashSet } from "effect"
// Create a mutable hash set
const set: MutableHashSet.MutableHashSet<string> = MutableHashSet.make(
"apple",
"banana"
)
// Add elements
MutableHashSet.add(set, "cherry")
// Check if elements exist
console.log(MutableHashSet.has(set, "apple")) // true
console.log(MutableHashSet.has(set, "grape")) // false
// Iterate over elements
for (const value of set) {
console.log(value) // "apple", "banana", "cherry"
}
// Get size
console.log(MutableHashSet.size(set)) // 3
MutableHashSet<function (type parameter) V in <V>(self: MutableHashSet<V>, key: V): booleanV>, key: Vkey: function (type parameter) V in <V>(self: MutableHashSet<V>, key: V): booleanV): boolean
} = import DualDual.dual<
<function (type parameter) V in <V>(key: V): (self: MutableHashSet<V>) => booleanV>(key: Vkey: function (type parameter) V in <V>(key: V): (self: MutableHashSet<V>) => booleanV) => (self: MutableHashSet<V>(parameter) self: {
keyMap: MutableHashMap.MutableHashMap<V, boolean>;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
toString: () => string;
toJSON: () => unknown;
}
self: interface MutableHashSet<out V>A mutable hash set for storing unique values with Effect structural equality
support.
When to use
Use to store and mutate a collection of unique values with Effect hashing and
equality semantics.
Details
Operations mutate the set in place. Values that implement Equal / Hash
can be de-duplicated structurally; other values use normal JavaScript
reference or primitive equality.
Example (Using a mutable hash set)
import { MutableHashSet } from "effect"
// Create a mutable hash set
const set: MutableHashSet.MutableHashSet<string> = MutableHashSet.make(
"apple",
"banana"
)
// Add elements
MutableHashSet.add(set, "cherry")
// Check if elements exist
console.log(MutableHashSet.has(set, "apple")) // true
console.log(MutableHashSet.has(set, "grape")) // false
// Iterate over elements
for (const value of set) {
console.log(value) // "apple", "banana", "cherry"
}
// Get size
console.log(MutableHashSet.size(set)) // 3
MutableHashSet<function (type parameter) V in <V>(key: V): (self: MutableHashSet<V>) => booleanV>) => boolean,
<function (type parameter) V in <V>(self: MutableHashSet<V>, key: V): booleanV>(self: MutableHashSet<V>(parameter) self: {
keyMap: MutableHashMap.MutableHashMap<V, boolean>;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
toString: () => string;
toJSON: () => unknown;
}
self: interface MutableHashSet<out V>A mutable hash set for storing unique values with Effect structural equality
support.
When to use
Use to store and mutate a collection of unique values with Effect hashing and
equality semantics.
Details
Operations mutate the set in place. Values that implement Equal / Hash
can be de-duplicated structurally; other values use normal JavaScript
reference or primitive equality.
Example (Using a mutable hash set)
import { MutableHashSet } from "effect"
// Create a mutable hash set
const set: MutableHashSet.MutableHashSet<string> = MutableHashSet.make(
"apple",
"banana"
)
// Add elements
MutableHashSet.add(set, "cherry")
// Check if elements exist
console.log(MutableHashSet.has(set, "apple")) // true
console.log(MutableHashSet.has(set, "grape")) // false
// Iterate over elements
for (const value of set) {
console.log(value) // "apple", "banana", "cherry"
}
// Get size
console.log(MutableHashSet.size(set)) // 3
MutableHashSet<function (type parameter) V in <V>(self: MutableHashSet<V>, key: V): booleanV>, key: Vkey: function (type parameter) V in <V>(self: MutableHashSet<V>, key: V): booleanV) => boolean
>(2, (self: MutableHashSet<V>(parameter) self: {
keyMap: MutableHashMap.MutableHashMap<V, boolean>;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
toString: () => string;
toJSON: () => unknown;
}
self, key: anykey) => import MutableHashMapMutableHashMap.has(self: MutableHashSet<V>(parameter) self: {
keyMap: MutableHashMap.MutableHashMap<V, boolean>;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
toString: () => string;
toJSON: () => unknown;
}
self.keyMap, key: anykey))