/** * @since 2.0.0 */ import type * as Chunk from "./Chunk.js"; import type * as HashSet from "./HashSet.js"; import type * as Option from "./Option.js"; import type { Predicate } from "./Predicate.js"; import type * as STM from "./STM.js"; import type * as Types from "./Types.js"; /** * @since 2.0.0 * @category symbols */ export declare const TSetTypeId: unique symbol; /** * @since 2.0.0 * @category symbols */ export type TSetTypeId = typeof TSetTypeId; /** * Transactional set implemented on top of `TMap`. * * @since 2.0.0 * @category models */ export interface TSet extends TSet.Variance { } /** * @since 2.0.0 */ export declare namespace TSet { /** * @since 2.0.0 * @category models */ interface Variance { readonly [TSetTypeId]: { readonly _A: Types.Invariant; }; } } /** * Stores new element in the set. * * @since 2.0.0 * @category mutations */ export declare const add: { /** * Stores new element in the set. * * @since 2.0.0 * @category mutations */ (value: A): (self: TSet) => STM.STM; /** * Stores new element in the set. * * @since 2.0.0 * @category mutations */ (self: TSet, value: A): STM.STM; }; /** * Atomically transforms the set into the difference of itself and the * provided set. * * @since 2.0.0 * @category mutations */ export declare const difference: { /** * Atomically transforms the set into the difference of itself and the * provided set. * * @since 2.0.0 * @category mutations */ (other: TSet): (self: TSet) => STM.STM; /** * Atomically transforms the set into the difference of itself and the * provided set. * * @since 2.0.0 * @category mutations */ (self: TSet, other: TSet): STM.STM; }; /** * Makes an empty `TSet`. * * @since 2.0.0 * @category constructors */ export declare const empty: () => STM.STM>; /** * Atomically performs transactional-effect for each element in set. * * @since 2.0.0 * @category elements */ export declare const forEach: { /** * Atomically performs transactional-effect for each element in set. * * @since 2.0.0 * @category elements */ (f: (value: A) => STM.STM): (self: TSet) => STM.STM; /** * Atomically performs transactional-effect for each element in set. * * @since 2.0.0 * @category elements */ (self: TSet, f: (value: A) => STM.STM): STM.STM; }; /** * Creates a new `TSet` from an iterable collection of values. * * @since 2.0.0 * @category constructors */ export declare const fromIterable: (iterable: Iterable) => STM.STM>; /** * Tests whether or not set contains an element. * * @since 2.0.0 * @category elements */ export declare const has: { /** * Tests whether or not set contains an element. * * @since 2.0.0 * @category elements */ (value: A): (self: TSet) => STM.STM; /** * Tests whether or not set contains an element. * * @since 2.0.0 * @category elements */ (self: TSet, value: A): STM.STM; }; /** * Atomically transforms the set into the intersection of itself and the * provided set. * * @since 2.0.0 * @category mutations */ export declare const intersection: { /** * Atomically transforms the set into the intersection of itself and the * provided set. * * @since 2.0.0 * @category mutations */ (other: TSet): (self: TSet) => STM.STM; /** * Atomically transforms the set into the intersection of itself and the * provided set. * * @since 2.0.0 * @category mutations */ (self: TSet, other: TSet): STM.STM; }; /** * Tests if the set is empty or not * * @since 2.0.0 * @category getters */ export declare const isEmpty: (self: TSet) => STM.STM; /** * Makes a new `TSet` that is initialized with specified values. * * @since 2.0.0 * @category constructors */ export declare const make: >(...elements: Elements) => STM.STM>; /** * Atomically folds using a pure function. * * @since 2.0.0 * @category folding */ export declare const reduce: { /** * Atomically folds using a pure function. * * @since 2.0.0 * @category folding */ (zero: Z, f: (accumulator: Z, value: A) => Z): (self: TSet) => STM.STM; /** * Atomically folds using a pure function. * * @since 2.0.0 * @category folding */ (self: TSet, zero: Z, f: (accumulator: Z, value: A) => Z): STM.STM; }; /** * Atomically folds using a transactional function. * * @since 2.0.0 * @category folding */ export declare const reduceSTM: { /** * Atomically folds using a transactional function. * * @since 2.0.0 * @category folding */ (zero: Z, f: (accumulator: Z, value: A) => STM.STM): (self: TSet) => STM.STM; /** * Atomically folds using a transactional function. * * @since 2.0.0 * @category folding */ (self: TSet, zero: Z, f: (accumulator: Z, value: A) => STM.STM): STM.STM; }; /** * Removes a single element from the set. * * @since 2.0.0 * @category mutations */ export declare const remove: { /** * Removes a single element from the set. * * @since 2.0.0 * @category mutations */ (value: A): (self: TSet) => STM.STM; /** * Removes a single element from the set. * * @since 2.0.0 * @category mutations */ (self: TSet, value: A): STM.STM; }; /** * Removes elements from the set. * * @since 2.0.0 * @category mutations */ export declare const removeAll: { /** * Removes elements from the set. * * @since 2.0.0 * @category mutations */ (iterable: Iterable): (self: TSet) => STM.STM; /** * Removes elements from the set. * * @since 2.0.0 * @category mutations */ (self: TSet, iterable: Iterable): STM.STM; }; /** * Removes entries from a `TSet` that satisfy the specified predicate and returns the removed entries * (or `void` if `discard = true`). * * @since 2.0.0 * @category mutations */ export declare const removeIf: { /** * Removes entries from a `TSet` that satisfy the specified predicate and returns the removed entries * (or `void` if `discard = true`). * * @since 2.0.0 * @category mutations */ (predicate: Predicate, options: { readonly discard: true; }): (self: TSet) => STM.STM; /** * Removes entries from a `TSet` that satisfy the specified predicate and returns the removed entries * (or `void` if `discard = true`). * * @since 2.0.0 * @category mutations */ (predicate: Predicate, options?: { readonly discard: false; }): (self: TSet) => STM.STM>; /** * Removes entries from a `TSet` that satisfy the specified predicate and returns the removed entries * (or `void` if `discard = true`). * * @since 2.0.0 * @category mutations */ (self: TSet, predicate: Predicate, options: { readonly discard: true; }): STM.STM; /** * Removes entries from a `TSet` that satisfy the specified predicate and returns the removed entries * (or `void` if `discard = true`). * * @since 2.0.0 * @category mutations */ (self: TSet, predicate: Predicate, options?: { readonly discard: false; }): STM.STM>; }; /** * Retains entries in a `TSet` that satisfy the specified predicate and returns the removed entries * (or `void` if `discard = true`). * * @since 2.0.0 * @category mutations */ export declare const retainIf: { /** * Retains entries in a `TSet` that satisfy the specified predicate and returns the removed entries * (or `void` if `discard = true`). * * @since 2.0.0 * @category mutations */ (predicate: Predicate, options: { readonly discard: true; }): (self: TSet) => STM.STM; /** * Retains entries in a `TSet` that satisfy the specified predicate and returns the removed entries * (or `void` if `discard = true`). * * @since 2.0.0 * @category mutations */ (predicate: Predicate, options?: { readonly discard: false; }): (self: TSet) => STM.STM>; /** * Retains entries in a `TSet` that satisfy the specified predicate and returns the removed entries * (or `void` if `discard = true`). * * @since 2.0.0 * @category mutations */ (self: TSet, predicate: Predicate, options: { readonly discard: true; }): STM.STM; /** * Retains entries in a `TSet` that satisfy the specified predicate and returns the removed entries * (or `void` if `discard = true`). * * @since 2.0.0 * @category mutations */ (self: TSet, predicate: Predicate, options?: { readonly discard: false; }): STM.STM>; }; /** * Returns the set's cardinality. * * @since 2.0.0 * @category getters */ export declare const size: (self: TSet) => STM.STM; /** * Takes the first matching value, or retries until there is one. * * @since 2.0.0 * @category mutations */ export declare const takeFirst: { /** * Takes the first matching value, or retries until there is one. * * @since 2.0.0 * @category mutations */ (pf: (a: A) => Option.Option): (self: TSet) => STM.STM; /** * Takes the first matching value, or retries until there is one. * * @since 2.0.0 * @category mutations */ (self: TSet, pf: (a: A) => Option.Option): STM.STM; }; /** * Takes the first matching value, or retries until there is one. * * @since 2.0.0 * @category mutations */ export declare const takeFirstSTM: { /** * Takes the first matching value, or retries until there is one. * * @since 2.0.0 * @category mutations */ (pf: (a: A) => STM.STM, R>): (self: TSet) => STM.STM; /** * Takes the first matching value, or retries until there is one. * * @since 2.0.0 * @category mutations */ (self: TSet, pf: (a: A) => STM.STM, R>): STM.STM; }; /** * Takes all matching values, or retries until there is at least one. * * @since 2.0.0 * @category mutations */ export declare const takeSome: { /** * Takes all matching values, or retries until there is at least one. * * @since 2.0.0 * @category mutations */ (pf: (a: A) => Option.Option): (self: TSet) => STM.STM<[B, ...Array]>; /** * Takes all matching values, or retries until there is at least one. * * @since 2.0.0 * @category mutations */ (self: TSet, pf: (a: A) => Option.Option): STM.STM<[B, ...Array]>; }; /** * Takes all matching values, or retries until there is at least one. * * @since 2.0.0 * @category mutations */ export declare const takeSomeSTM: { /** * Takes all matching values, or retries until there is at least one. * * @since 2.0.0 * @category mutations */ (pf: (a: A) => STM.STM, R>): (self: TSet) => STM.STM<[B, ...Array], E, R>; /** * Takes all matching values, or retries until there is at least one. * * @since 2.0.0 * @category mutations */ (self: TSet, pf: (a: A) => STM.STM, R>): STM.STM<[B, ...Array], E, R>; }; /** * Collects all elements into a `Chunk`. * * @since 2.0.0 * @category destructors */ export declare const toChunk: (self: TSet) => STM.STM>; /** * Collects all elements into a `HashSet`. * * @since 2.0.0 * @category destructors */ export declare const toHashSet: (self: TSet) => STM.STM>; /** * Collects all elements into a `Array`. * * @since 2.0.0 * @category destructors */ export declare const toArray: (self: TSet) => STM.STM>; /** * Collects all elements into a `ReadonlySet`. * * @since 2.0.0 * @category destructors */ export declare const toReadonlySet: (self: TSet) => STM.STM>; /** * Atomically updates all elements using a pure function. * * @since 2.0.0 * @category mutations */ export declare const transform: { /** * Atomically updates all elements using a pure function. * * @since 2.0.0 * @category mutations */ (f: (a: A) => A): (self: TSet) => STM.STM; /** * Atomically updates all elements using a pure function. * * @since 2.0.0 * @category mutations */ (self: TSet, f: (a: A) => A): STM.STM; }; /** * Atomically updates all elements using a transactional function. * * @since 2.0.0 * @category mutations */ export declare const transformSTM: { /** * Atomically updates all elements using a transactional function. * * @since 2.0.0 * @category mutations */ (f: (a: A) => STM.STM): (self: TSet) => STM.STM; /** * Atomically updates all elements using a transactional function. * * @since 2.0.0 * @category mutations */ (self: TSet, f: (a: A) => STM.STM): STM.STM; }; /** * Atomically transforms the set into the union of itself and the provided * set. * * @since 2.0.0 * @category mutations */ export declare const union: { /** * Atomically transforms the set into the union of itself and the provided * set. * * @since 2.0.0 * @category mutations */ (other: TSet): (self: TSet) => STM.STM; /** * Atomically transforms the set into the union of itself and the provided * set. * * @since 2.0.0 * @category mutations */ (self: TSet, other: TSet): STM.STM; }; //# sourceMappingURL=TSet.d.ts.map