<V, U>(f: (value: V) => U): (self: HashSet<V>) => HashSet<U>
<V, U>(self: HashSet<V>, f: (value: V) => U): HashSet<U>Maps each value in the HashSet using the provided function.
Example (Mapping HashSet values)
import { HashSet } from "effect"
const numbers = HashSet.make(1, 2, 3)
const doubled = HashSet.map(numbers, (n) => n * 2)
console.log(Array.from(doubled).sort()) // [2, 4, 6]
console.log(HashSet.size(doubled)) // 3
// Mapping can reduce size if function produces duplicates
const strings = HashSet.make("apple", "banana", "cherry")
const lengths = HashSet.map(strings, (s) => s.length)
console.log(Array.from(lengths).sort()) // [5, 6] (apple=5, banana=6, cherry=6)export const const map: {
<V, U>(f: (value: V) => U): (
self: HashSet<V>
) => HashSet<U>
<V, U>(
self: HashSet<V>,
f: (value: V) => U
): HashSet<U>
}
Maps each value in the HashSet using the provided function.
Example (Mapping HashSet values)
import { HashSet } from "effect"
const numbers = HashSet.make(1, 2, 3)
const doubled = HashSet.map(numbers, (n) => n * 2)
console.log(Array.from(doubled).sort()) // [2, 4, 6]
console.log(HashSet.size(doubled)) // 3
// Mapping can reduce size if function produces duplicates
const strings = HashSet.make("apple", "banana", "cherry")
const lengths = HashSet.map(strings, (s) => s.length)
console.log(Array.from(lengths).sort()) // [5, 6] (apple=5, banana=6, cherry=6)
map: {
<function (type parameter) V in <V, U>(f: (value: V) => U): (self: HashSet<V>) => HashSet<U>V, function (type parameter) U in <V, U>(f: (value: V) => U): (self: HashSet<V>) => HashSet<U>U>(f: (value: V) => Uf: (value: Vvalue: function (type parameter) V in <V, U>(f: (value: V) => U): (self: HashSet<V>) => HashSet<U>V) => function (type parameter) U in <V, U>(f: (value: V) => U): (self: HashSet<V>) => HashSet<U>U): (self: HashSet<V>(parameter) self: {
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 HashSet<out Value>A HashSet is an immutable set data structure that provides efficient storage
and retrieval of unique values. It uses a HashMap internally for optimal performance.
Example (Creating and updating a HashSet)
import { HashSet } from "effect"
// Create a HashSet
const set = HashSet.make("apple", "banana", "cherry")
// Check membership
console.log(HashSet.has(set, "apple")) // true
console.log(HashSet.has(set, "grape")) // false
// Add values (returns new HashSet)
const updated = HashSet.add(set, "grape")
console.log(HashSet.size(updated)) // 4
// Remove values (returns new HashSet)
const smaller = HashSet.remove(set, "banana")
console.log(HashSet.size(smaller)) // 2
The HashSet namespace contains type-level utilities and helper types
for working with HashSet instances.
Example (Extracting value types from a HashSet)
import { HashSet } from "effect"
// Create a concrete HashSet for type extraction
const fruits = HashSet.make("apple", "banana", "cherry")
// Extract the value type for reuse
type Fruit = HashSet.HashSet.Value<typeof fruits> // string
// Use extracted type in functions
const processFruit = (fruit: Fruit) => {
return `Processing ${fruit}`
}
HashSet<function (type parameter) V in <V, U>(f: (value: V) => U): (self: HashSet<V>) => HashSet<U>V>) => interface HashSet<out Value>A HashSet is an immutable set data structure that provides efficient storage
and retrieval of unique values. It uses a HashMap internally for optimal performance.
Example (Creating and updating a HashSet)
import { HashSet } from "effect"
// Create a HashSet
const set = HashSet.make("apple", "banana", "cherry")
// Check membership
console.log(HashSet.has(set, "apple")) // true
console.log(HashSet.has(set, "grape")) // false
// Add values (returns new HashSet)
const updated = HashSet.add(set, "grape")
console.log(HashSet.size(updated)) // 4
// Remove values (returns new HashSet)
const smaller = HashSet.remove(set, "banana")
console.log(HashSet.size(smaller)) // 2
The HashSet namespace contains type-level utilities and helper types
for working with HashSet instances.
Example (Extracting value types from a HashSet)
import { HashSet } from "effect"
// Create a concrete HashSet for type extraction
const fruits = HashSet.make("apple", "banana", "cherry")
// Extract the value type for reuse
type Fruit = HashSet.HashSet.Value<typeof fruits> // string
// Use extracted type in functions
const processFruit = (fruit: Fruit) => {
return `Processing ${fruit}`
}
HashSet<function (type parameter) U in <V, U>(f: (value: V) => U): (self: HashSet<V>) => HashSet<U>U>
<function (type parameter) V in <V, U>(self: HashSet<V>, f: (value: V) => U): HashSet<U>V, function (type parameter) U in <V, U>(self: HashSet<V>, f: (value: V) => U): HashSet<U>U>(self: HashSet<V>(parameter) self: {
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 HashSet<out Value>A HashSet is an immutable set data structure that provides efficient storage
and retrieval of unique values. It uses a HashMap internally for optimal performance.
Example (Creating and updating a HashSet)
import { HashSet } from "effect"
// Create a HashSet
const set = HashSet.make("apple", "banana", "cherry")
// Check membership
console.log(HashSet.has(set, "apple")) // true
console.log(HashSet.has(set, "grape")) // false
// Add values (returns new HashSet)
const updated = HashSet.add(set, "grape")
console.log(HashSet.size(updated)) // 4
// Remove values (returns new HashSet)
const smaller = HashSet.remove(set, "banana")
console.log(HashSet.size(smaller)) // 2
The HashSet namespace contains type-level utilities and helper types
for working with HashSet instances.
Example (Extracting value types from a HashSet)
import { HashSet } from "effect"
// Create a concrete HashSet for type extraction
const fruits = HashSet.make("apple", "banana", "cherry")
// Extract the value type for reuse
type Fruit = HashSet.HashSet.Value<typeof fruits> // string
// Use extracted type in functions
const processFruit = (fruit: Fruit) => {
return `Processing ${fruit}`
}
HashSet<function (type parameter) V in <V, U>(self: HashSet<V>, f: (value: V) => U): HashSet<U>V>, f: (value: V) => Uf: (value: Vvalue: function (type parameter) V in <V, U>(self: HashSet<V>, f: (value: V) => U): HashSet<U>V) => function (type parameter) U in <V, U>(self: HashSet<V>, f: (value: V) => U): HashSet<U>U): interface HashSet<out Value>A HashSet is an immutable set data structure that provides efficient storage
and retrieval of unique values. It uses a HashMap internally for optimal performance.
Example (Creating and updating a HashSet)
import { HashSet } from "effect"
// Create a HashSet
const set = HashSet.make("apple", "banana", "cherry")
// Check membership
console.log(HashSet.has(set, "apple")) // true
console.log(HashSet.has(set, "grape")) // false
// Add values (returns new HashSet)
const updated = HashSet.add(set, "grape")
console.log(HashSet.size(updated)) // 4
// Remove values (returns new HashSet)
const smaller = HashSet.remove(set, "banana")
console.log(HashSet.size(smaller)) // 2
The HashSet namespace contains type-level utilities and helper types
for working with HashSet instances.
Example (Extracting value types from a HashSet)
import { HashSet } from "effect"
// Create a concrete HashSet for type extraction
const fruits = HashSet.make("apple", "banana", "cherry")
// Extract the value type for reuse
type Fruit = HashSet.HashSet.Value<typeof fruits> // string
// Use extracted type in functions
const processFruit = (fruit: Fruit) => {
return `Processing ${fruit}`
}
HashSet<function (type parameter) U in <V, U>(self: HashSet<V>, f: (value: V) => U): HashSet<U>U>
} = import DualDual.dual<
<function (type parameter) V in <V, U>(f: (value: V) => U): (self: HashSet<V>) => HashSet<U>V, function (type parameter) U in <V, U>(f: (value: V) => U): (self: HashSet<V>) => HashSet<U>U>(f: (value: V) => Uf: (value: Vvalue: function (type parameter) V in <V, U>(f: (value: V) => U): (self: HashSet<V>) => HashSet<U>V) => function (type parameter) U in <V, U>(f: (value: V) => U): (self: HashSet<V>) => HashSet<U>U) => (self: HashSet<V>(parameter) self: {
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 HashSet<out Value>A HashSet is an immutable set data structure that provides efficient storage
and retrieval of unique values. It uses a HashMap internally for optimal performance.
Example (Creating and updating a HashSet)
import { HashSet } from "effect"
// Create a HashSet
const set = HashSet.make("apple", "banana", "cherry")
// Check membership
console.log(HashSet.has(set, "apple")) // true
console.log(HashSet.has(set, "grape")) // false
// Add values (returns new HashSet)
const updated = HashSet.add(set, "grape")
console.log(HashSet.size(updated)) // 4
// Remove values (returns new HashSet)
const smaller = HashSet.remove(set, "banana")
console.log(HashSet.size(smaller)) // 2
The HashSet namespace contains type-level utilities and helper types
for working with HashSet instances.
Example (Extracting value types from a HashSet)
import { HashSet } from "effect"
// Create a concrete HashSet for type extraction
const fruits = HashSet.make("apple", "banana", "cherry")
// Extract the value type for reuse
type Fruit = HashSet.HashSet.Value<typeof fruits> // string
// Use extracted type in functions
const processFruit = (fruit: Fruit) => {
return `Processing ${fruit}`
}
HashSet<function (type parameter) V in <V, U>(f: (value: V) => U): (self: HashSet<V>) => HashSet<U>V>) => interface HashSet<out Value>A HashSet is an immutable set data structure that provides efficient storage
and retrieval of unique values. It uses a HashMap internally for optimal performance.
Example (Creating and updating a HashSet)
import { HashSet } from "effect"
// Create a HashSet
const set = HashSet.make("apple", "banana", "cherry")
// Check membership
console.log(HashSet.has(set, "apple")) // true
console.log(HashSet.has(set, "grape")) // false
// Add values (returns new HashSet)
const updated = HashSet.add(set, "grape")
console.log(HashSet.size(updated)) // 4
// Remove values (returns new HashSet)
const smaller = HashSet.remove(set, "banana")
console.log(HashSet.size(smaller)) // 2
The HashSet namespace contains type-level utilities and helper types
for working with HashSet instances.
Example (Extracting value types from a HashSet)
import { HashSet } from "effect"
// Create a concrete HashSet for type extraction
const fruits = HashSet.make("apple", "banana", "cherry")
// Extract the value type for reuse
type Fruit = HashSet.HashSet.Value<typeof fruits> // string
// Use extracted type in functions
const processFruit = (fruit: Fruit) => {
return `Processing ${fruit}`
}
HashSet<function (type parameter) U in <V, U>(f: (value: V) => U): (self: HashSet<V>) => HashSet<U>U>,
<function (type parameter) V in <V, U>(self: HashSet<V>, f: (value: V) => U): HashSet<U>V, function (type parameter) U in <V, U>(self: HashSet<V>, f: (value: V) => U): HashSet<U>U>(self: HashSet<V>(parameter) self: {
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 HashSet<out Value>A HashSet is an immutable set data structure that provides efficient storage
and retrieval of unique values. It uses a HashMap internally for optimal performance.
Example (Creating and updating a HashSet)
import { HashSet } from "effect"
// Create a HashSet
const set = HashSet.make("apple", "banana", "cherry")
// Check membership
console.log(HashSet.has(set, "apple")) // true
console.log(HashSet.has(set, "grape")) // false
// Add values (returns new HashSet)
const updated = HashSet.add(set, "grape")
console.log(HashSet.size(updated)) // 4
// Remove values (returns new HashSet)
const smaller = HashSet.remove(set, "banana")
console.log(HashSet.size(smaller)) // 2
The HashSet namespace contains type-level utilities and helper types
for working with HashSet instances.
Example (Extracting value types from a HashSet)
import { HashSet } from "effect"
// Create a concrete HashSet for type extraction
const fruits = HashSet.make("apple", "banana", "cherry")
// Extract the value type for reuse
type Fruit = HashSet.HashSet.Value<typeof fruits> // string
// Use extracted type in functions
const processFruit = (fruit: Fruit) => {
return `Processing ${fruit}`
}
HashSet<function (type parameter) V in <V, U>(self: HashSet<V>, f: (value: V) => U): HashSet<U>V>, f: (value: V) => Uf: (value: Vvalue: function (type parameter) V in <V, U>(self: HashSet<V>, f: (value: V) => U): HashSet<U>V) => function (type parameter) U in <V, U>(self: HashSet<V>, f: (value: V) => U): HashSet<U>U) => interface HashSet<out Value>A HashSet is an immutable set data structure that provides efficient storage
and retrieval of unique values. It uses a HashMap internally for optimal performance.
Example (Creating and updating a HashSet)
import { HashSet } from "effect"
// Create a HashSet
const set = HashSet.make("apple", "banana", "cherry")
// Check membership
console.log(HashSet.has(set, "apple")) // true
console.log(HashSet.has(set, "grape")) // false
// Add values (returns new HashSet)
const updated = HashSet.add(set, "grape")
console.log(HashSet.size(updated)) // 4
// Remove values (returns new HashSet)
const smaller = HashSet.remove(set, "banana")
console.log(HashSet.size(smaller)) // 2
The HashSet namespace contains type-level utilities and helper types
for working with HashSet instances.
Example (Extracting value types from a HashSet)
import { HashSet } from "effect"
// Create a concrete HashSet for type extraction
const fruits = HashSet.make("apple", "banana", "cherry")
// Extract the value type for reuse
type Fruit = HashSet.HashSet.Value<typeof fruits> // string
// Use extracted type in functions
const processFruit = (fruit: Fruit) => {
return `Processing ${fruit}`
}
HashSet<function (type parameter) U in <V, U>(self: HashSet<V>, f: (value: V) => U): HashSet<U>U>
>(2, import internalinternal.const map: <V, U>(
self: internal.HashSet<V>,
f: (value: V) => U
) => internal.HashSet<U>
map)