/**
* @since 1.0.0
*/
import type { Predicate, Refinement } from "@fp-ts/core/Predicate";
import type { Equal } from "@fp-ts/data/Equal";
declare const TypeId: unique symbol;
/**
* @since 1.0.0
* @category symbol
*/
export type TypeId = typeof TypeId;
/**
* @since 1.0.0
* @category models
*/
export interface HashSet extends Iterable, Equal {
readonly _id: TypeId;
}
/**
* @since 1.0.0
* @category refinements
*/
export declare const isHashSet: {
(u: Iterable): u is HashSet;
(u: unknown): u is HashSet;
};
/**
* Creates an empty `HashSet`.
*
* @since 1.0.0
* @category constructors
*/
export declare const empty: () => HashSet;
/**
* Construct a new `HashSet` from a `Collection` of values
*
* @since 1.0.0
* @category constructors
*/
export declare const fromIterable: (elements: Iterable) => HashSet;
/**
* Construct a new `HashSet` from a variable number of values.
*
* @since 1.0.0
* @category constructors
*/
export declare const make: >(...elements: As) => HashSet;
/**
* Checks if the specified value exists in the `HashSet`.
*
* @since 1.0.0
* @category elements
*/
export declare const has: {
(self: HashSet, value: A): boolean;
(value: A): (self: HashSet) => boolean;
};
/**
* Returns `true` if any value in the `HashSet` matches the specified predicate.
*
* @since 1.0.0
* @category elements
*/
export declare const some: {
(self: HashSet, f: Predicate): boolean;
(f: Predicate): (self: HashSet) => boolean;
};
/**
* Returns `true` only if all values in the `HashSet` match the specified
* predicate.
*
* @since 1.0.0
* @category elements
*/
export declare const every: {
(self: HashSet, f: Predicate): boolean;
(f: Predicate): (self: HashSet) => boolean;
};
/**
* Returns `true` if and only if every element in the this `HashSet` is an
* element of the second set,
*
* **NOTE**: the hash and equal of both sets must be the same.
*
* @since 1.0.0
* @category elements
*/
export declare const isSubset: {
(self: HashSet, that: HashSet): boolean;
(that: HashSet): (self: HashSet) => boolean;
};
/**
* Returns an `IterableIterator` of the values in the `HashSet`.
*
* @since 1.0.0
* @category getters
*/
export declare const values: (self: HashSet) => IterableIterator;
/**
* Calculates the number of values in the `HashSet`.
*
* @since 1.0.0
* @category getters
*/
export declare const size: (self: HashSet) => number;
/**
* Marks the `HashSet` as mutable.
*
* @since 1.0.0
* @category mutations
*/
export declare const beginMutation: (self: HashSet) => HashSet;
/**
* Marks the `HashSet` as immutable.
*
* @since 1.0.0
* @category mutations
*/
export declare const endMutation: (self: HashSet) => HashSet;
/**
* Mutates the `HashSet` within the context of the provided function.
*
* @since 1.0.0
* @category mutations
*/
export declare const mutate: {
(self: HashSet, f: (set: HashSet) => void): HashSet;
(f: (set: HashSet) => void): (self: HashSet) => HashSet;
};
/**
* Adds a value to the `HashSet`.
*
* @since 1.0.0
* @category mutations
*/
export declare const add: {
(self: HashSet, value: A): HashSet;
(value: A): (self: HashSet) => HashSet;
};
/**
* Removes a value from the `HashSet`.
*
* @since 1.0.0
* @category mutations
*/
export declare const remove: {
(self: HashSet, value: A): HashSet;
(value: A): (self: HashSet) => HashSet;
};
/**
* Computes the set difference between this `HashSet` and the specified
* `Iterable`.
*
* **NOTE**: the hash and equal of the values in both the set and the iterable
* must be the same.
*
* @since 1.0.0
* @category mutations
*/
export declare const difference: {
(self: HashSet, that: Iterable): HashSet;
(that: Iterable): (self: HashSet) => HashSet;
};
/**
* Returns a `HashSet` of values which are present in both this set and that
* `Iterable`.
*
* **NOTE**: the hash and equal of the values in both the set and the iterable
* must be the same.
*
* @since 1.0.0
* @category mutations
*/
export declare const intersection: {
(self: HashSet, that: Iterable): HashSet;
(that: Iterable): (self: HashSet) => HashSet;
};
/**
* Computes the set union `(`self` + `that`)` between this `HashSet` and the
* specified `Iterable`.
*
* **NOTE**: the hash and equal of the values in both the set and the iterable
* must be the same.
*
* @since 1.0.0
* @category mutations
*/
export declare const union: {
(self: HashSet, that: Iterable): HashSet;
(that: Iterable): (self: HashSet) => HashSet;
};
/**
* Checks if a value is present in the `HashSet`. If it is present, the value
* will be removed from the `HashSet`, otherwise the value will be added to the
* `HashSet`.
*
* @since 1.0.0
* @category mutations
*/
export declare const toggle: {
(self: HashSet, value: A): HashSet;
(value: A): (self: HashSet) => HashSet;
};
/**
* Maps over the values of the `HashSet` using the specified function.
*
* @since 1.0.0
* @category mapping
*/
export declare const map: {
(self: HashSet, f: (a: A) => B): HashSet;
(f: (a: A) => B): (self: HashSet) => HashSet;
};
/**
* Chains over the values of the `HashSet` using the specified function.
*
* @since 1.0.0
* @category sequencing
*/
export declare const flatMap: {
(self: HashSet, f: (a: A) => Iterable): HashSet;
(f: (a: A) => Iterable): (self: HashSet) => HashSet;
};
/**
* Applies the specified function to the values of the `HashSet`.
*
* @since 1.0.0
* @category traversing
*/
export declare const forEach: {
(self: HashSet, f: (value: A) => void): void;
(f: (value: A) => void): (self: HashSet) => void;
};
/**
* Reduces the specified state over the values of the `HashSet`.
*
* @since 1.0.0
* @category folding
*/
export declare const reduce: {
(self: HashSet, zero: Z, f: (accumulator: Z, value: A) => Z): Z;
(zero: Z, f: (accumulator: Z, value: A) => Z): (self: HashSet) => Z;
};
/**
* Filters values out of a `HashSet` using the specified predicate.
*
* @since 1.0.0
* @category filtering
*/
export declare const filter: {
(self: HashSet, f: Refinement): HashSet;
(self: HashSet, f: Predicate): HashSet;
(f: Refinement): (self: HashSet) => HashSet;
(f: Predicate): (self: HashSet) => HashSet;
};
/**
* Partition the values of a `HashSet` using the specified predicate.
*
* If a value matches the predicate, it will be placed into the `HashSet` on the
* right side of the resulting `Tuple`, otherwise the value will be placed into
* the left side.
*
* @since 1.0.0
* @category partitioning
*/
export declare const partition: {
(self: HashSet, f: Refinement): readonly [HashSet, HashSet];
(self: HashSet, f: Predicate): readonly [HashSet, HashSet];
(f: Refinement): (self: HashSet) => readonly [HashSet, HashSet];
(f: Predicate): (self: HashSet) => readonly [HashSet, HashSet];
};
export {};
//# sourceMappingURL=HashSet.d.ts.map