/** * @since 2.0.0 */ import type * as Chunk from "./Chunk.js"; import type { LazyArg } from "./Function.js"; import type * as HashMap from "./HashMap.js"; import type * as Option from "./Option.js"; import type * as STM from "./STM.js"; import type * as Types from "./Types.js"; /** * @since 2.0.0 * @category symbols */ export declare const TMapTypeId: unique symbol; /** * @since 2.0.0 * @category symbols */ export type TMapTypeId = typeof TMapTypeId; /** * Transactional map implemented on top of `TRef` and `TArray`. Resolves * conflicts via chaining. * * @since 2.0.0 * @category models */ export interface TMap extends TMap.Variance { } /** * @since 2.0.0 */ export declare namespace TMap { /** * @since 2.0.0 * @category models */ interface Variance { readonly [TMapTypeId]: { readonly _K: Types.Invariant; readonly _V: Types.Invariant; }; } } /** * Makes an empty `TMap`. * * @since 2.0.0 * @category constructors */ export declare const empty: () => STM.STM>; /** * Finds the key/value pair matching the specified predicate, and uses the * provided function to extract a value out of it. * * @since 2.0.0 * @category elements */ export declare const find: { /** * Finds the key/value pair matching the specified predicate, and uses the * provided function to extract a value out of it. * * @since 2.0.0 * @category elements */ (pf: (key: K, value: V) => Option.Option): (self: TMap) => STM.STM>; /** * Finds the key/value pair matching the specified predicate, and uses the * provided function to extract a value out of it. * * @since 2.0.0 * @category elements */ (self: TMap, pf: (key: K, value: V) => Option.Option): STM.STM>; }; /** * Finds the key/value pair matching the specified predicate, and uses the * provided effectful function to extract a value out of it. * * @since 2.0.0 * @category elements */ export declare const findSTM: { /** * Finds the key/value pair matching the specified predicate, and uses the * provided effectful function to extract a value out of it. * * @since 2.0.0 * @category elements */ (f: (key: K, value: V) => STM.STM, R>): (self: TMap) => STM.STM, E, R>; /** * Finds the key/value pair matching the specified predicate, and uses the * provided effectful function to extract a value out of it. * * @since 2.0.0 * @category elements */ (self: TMap, f: (key: K, value: V) => STM.STM, R>): STM.STM, E, R>; }; /** * Finds all the key/value pairs matching the specified predicate, and uses * the provided function to extract values out them. * * @since 2.0.0 * @category elements */ export declare const findAll: { /** * Finds all the key/value pairs matching the specified predicate, and uses * the provided function to extract values out them. * * @since 2.0.0 * @category elements */ (pf: (key: K, value: V) => Option.Option): (self: TMap) => STM.STM>; /** * Finds all the key/value pairs matching the specified predicate, and uses * the provided function to extract values out them. * * @since 2.0.0 * @category elements */ (self: TMap, pf: (key: K, value: V) => Option.Option): STM.STM>; }; /** * Finds all the key/value pairs matching the specified predicate, and uses * the provided effectful function to extract values out of them.. * * @since 2.0.0 * @category elements */ export declare const findAllSTM: { /** * Finds all the key/value pairs matching the specified predicate, and uses * the provided effectful function to extract values out of them.. * * @since 2.0.0 * @category elements */ (pf: (key: K, value: V) => STM.STM, R>): (self: TMap) => STM.STM, E, R>; /** * Finds all the key/value pairs matching the specified predicate, and uses * the provided effectful function to extract values out of them.. * * @since 2.0.0 * @category elements */ (self: TMap, pf: (key: K, value: V) => STM.STM, R>): STM.STM, E, R>; }; /** * Atomically performs transactional-effect for each binding present in map. * * @since 2.0.0 * @category elements */ export declare const forEach: { /** * Atomically performs transactional-effect for each binding present in map. * * @since 2.0.0 * @category elements */ (f: (key: K, value: V) => STM.STM): (self: TMap) => STM.STM; /** * Atomically performs transactional-effect for each binding present in map. * * @since 2.0.0 * @category elements */ (self: TMap, f: (key: K, value: V) => STM.STM): STM.STM; }; /** * Creates a new `TMap` from an iterable collection of key/value pairs. * * @since 2.0.0 * @category constructors */ export declare const fromIterable: (iterable: Iterable) => STM.STM>; /** * Retrieves value associated with given key. * * @since 2.0.0 * @category elements */ export declare const get: { /** * Retrieves value associated with given key. * * @since 2.0.0 * @category elements */ (key: K): (self: TMap) => STM.STM>; /** * Retrieves value associated with given key. * * @since 2.0.0 * @category elements */ (self: TMap, key: K): STM.STM>; }; /** * Retrieves value associated with given key or default value, in case the key * isn't present. * * @since 2.0.0 * @category elements */ export declare const getOrElse: { /** * Retrieves value associated with given key or default value, in case the key * isn't present. * * @since 2.0.0 * @category elements */ (key: K, fallback: LazyArg): (self: TMap) => STM.STM; /** * Retrieves value associated with given key or default value, in case the key * isn't present. * * @since 2.0.0 * @category elements */ (self: TMap, key: K, fallback: LazyArg): STM.STM; }; /** * Tests whether or not map contains a key. * * @since 2.0.0 * @category elements */ export declare const has: { /** * Tests whether or not map contains a key. * * @since 2.0.0 * @category elements */ (key: K): (self: TMap) => STM.STM; /** * Tests whether or not map contains a key. * * @since 2.0.0 * @category elements */ (self: TMap, key: K): STM.STM; }; /** * Tests if the map is empty or not. * * @since 2.0.0 * @category getters */ export declare const isEmpty: (self: TMap) => STM.STM; /** * Collects all keys stored in map. * * @since 2.0.0 * @category elements */ export declare const keys: (self: TMap) => STM.STM>; /** * Makes a new `TMap` that is initialized with specified values. * * @since 2.0.0 * @category constructors */ export declare const make: (...entries: Array) => STM.STM>; /** * If the key is not already associated with a value, stores the provided value, * otherwise merge the existing value with the new one using function `f` and * store the result. * * @since 2.0.0 * @category mutations */ export declare const merge: { /** * If the key is not already associated with a value, stores the provided value, * otherwise merge the existing value with the new one using function `f` and * store the result. * * @since 2.0.0 * @category mutations */ (key: K, value: V, f: (x: V, y: V) => V): (self: TMap) => STM.STM; /** * If the key is not already associated with a value, stores the provided value, * otherwise merge the existing value with the new one using function `f` and * store the result. * * @since 2.0.0 * @category mutations */ (self: TMap, key: K, value: V, f: (x: V, y: V) => V): 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: (acc: Z, value: V, key: K) => Z): (self: TMap) => STM.STM; /** * Atomically folds using a pure function. * * @since 2.0.0 * @category folding */ (self: TMap, zero: Z, f: (acc: Z, value: V, key: K) => 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: (acc: Z, value: V, key: K) => STM.STM): (self: TMap) => STM.STM; /** * Atomically folds using a transactional function. * * @since 2.0.0 * @category folding */ (self: TMap, zero: Z, f: (acc: Z, value: V, key: K) => STM.STM): STM.STM; }; /** * Removes binding for given key. * * @since 2.0.0 * @category mutations */ export declare const remove: { /** * Removes binding for given key. * * @since 2.0.0 * @category mutations */ (key: K): (self: TMap) => STM.STM; /** * Removes binding for given key. * * @since 2.0.0 * @category mutations */ (self: TMap, key: K): STM.STM; }; /** * Deletes all entries associated with the specified keys. * * @since 2.0.0 * @category mutations */ export declare const removeAll: { /** * Deletes all entries associated with the specified keys. * * @since 2.0.0 * @category mutations */ (keys: Iterable): (self: TMap) => STM.STM; /** * Deletes all entries associated with the specified keys. * * @since 2.0.0 * @category mutations */ (self: TMap, keys: Iterable): STM.STM; }; /** * Removes entries from a `TMap` 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 `TMap` that satisfy the specified predicate and returns the removed entries * (or `void` if `discard = true`). * * @since 2.0.0 * @category mutations */ (predicate: (key: K, value: V) => boolean, options: { readonly discard: true; }): (self: TMap) => STM.STM; /** * Removes entries from a `TMap` that satisfy the specified predicate and returns the removed entries * (or `void` if `discard = true`). * * @since 2.0.0 * @category mutations */ (predicate: (key: K, value: V) => boolean, options?: { readonly discard: false; }): (self: TMap) => STM.STM>; /** * Removes entries from a `TMap` that satisfy the specified predicate and returns the removed entries * (or `void` if `discard = true`). * * @since 2.0.0 * @category mutations */ (self: TMap, predicate: (key: K, value: V) => boolean, options: { readonly discard: true; }): STM.STM; /** * Removes entries from a `TMap` that satisfy the specified predicate and returns the removed entries * (or `void` if `discard = true`). * * @since 2.0.0 * @category mutations */ (self: TMap, predicate: (key: K, value: V) => boolean, options?: { readonly discard: false; }): STM.STM>; }; /** * Retains entries in a `TMap` 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 `TMap` that satisfy the specified predicate and returns the removed entries * (or `void` if `discard = true`). * * @since 2.0.0 * @category mutations */ (predicate: (key: K, value: V) => boolean, options: { readonly discard: true; }): (self: TMap) => STM.STM; /** * Retains entries in a `TMap` that satisfy the specified predicate and returns the removed entries * (or `void` if `discard = true`). * * @since 2.0.0 * @category mutations */ (predicate: (key: K, value: V) => boolean, options?: { readonly discard: false; }): (self: TMap) => STM.STM>; /** * Retains entries in a `TMap` that satisfy the specified predicate and returns the removed entries * (or `void` if `discard = true`). * * @since 2.0.0 * @category mutations */ (self: TMap, predicate: (key: K, value: V) => boolean, options: { readonly discard: true; }): STM.STM; /** * Retains entries in a `TMap` that satisfy the specified predicate and returns the removed entries * (or `void` if `discard = true`). * * @since 2.0.0 * @category mutations */ (self: TMap, predicate: (key: K, value: V) => boolean, options?: { readonly discard: false; }): STM.STM>; }; /** * Stores new binding into the map. * * @since 2.0.0 * @category mutations */ export declare const set: { /** * Stores new binding into the map. * * @since 2.0.0 * @category mutations */ (key: K, value: V): (self: TMap) => STM.STM; /** * Stores new binding into the map. * * @since 2.0.0 * @category mutations */ (self: TMap, key: K, value: V): STM.STM; }; /** * Stores new binding in the map if it does not already exist. * * @since 2.0.0 * @category mutations */ export declare const setIfAbsent: { /** * Stores new binding in the map if it does not already exist. * * @since 2.0.0 * @category mutations */ (key: K, value: V): (self: TMap) => STM.STM; /** * Stores new binding in the map if it does not already exist. * * @since 2.0.0 * @category mutations */ (self: TMap, key: K, value: V): STM.STM; }; /** * Returns the number of bindings. * * @since 2.0.0 * @category getters */ export declare const size: (self: TMap) => 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: (key: K, value: V) => Option.Option): (self: TMap) => STM.STM; /** * Takes the first matching value, or retries until there is one. * * @since 2.0.0 * @category mutations */ (self: TMap, pf: (key: K, value: V) => 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: (key: K, value: V) => STM.STM, R>): (self: TMap) => STM.STM; /** * Takes the first matching value, or retries until there is one. * * @since 2.0.0 * @category mutations */ (self: TMap, pf: (key: K, value: V) => 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: (key: K, value: V) => Option.Option): (self: TMap) => STM.STM<[A, ...Array]>; /** * Takes all matching values, or retries until there is at least one. * * @since 2.0.0 * @category mutations */ (self: TMap, pf: (key: K, value: V) => Option.Option): STM.STM<[A, ...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: (key: K, value: V) => STM.STM, R>): (self: TMap) => STM.STM<[A, ...Array], E, R>; /** * Takes all matching values, or retries until there is at least one. * * @since 2.0.0 * @category mutations */ (self: TMap, pf: (key: K, value: V) => STM.STM, R>): STM.STM<[A, ...Array], E, R>; }; /** * Collects all bindings into a `Chunk`. * * @since 2.0.0 * @category destructors */ export declare const toChunk: (self: TMap) => STM.STM>; /** * Collects all bindings into a `HashMap`. * * @since 2.0.0 * @category destructors */ export declare const toHashMap: (self: TMap) => STM.STM>; /** * Collects all bindings into an `Array`. * * @since 2.0.0 * @category destructors */ export declare const toArray: (self: TMap) => STM.STM>; /** * Collects all bindings into a `Map`. * * @since 2.0.0 * @category destructors */ export declare const toMap: (self: TMap) => STM.STM>; /** * Atomically updates all bindings using a pure function. * * @since 2.0.0 * @category mutations */ export declare const transform: { /** * Atomically updates all bindings using a pure function. * * @since 2.0.0 * @category mutations */ (f: (key: K, value: V) => readonly [K, V]): (self: TMap) => STM.STM; /** * Atomically updates all bindings using a pure function. * * @since 2.0.0 * @category mutations */ (self: TMap, f: (key: K, value: V) => readonly [K, V]): STM.STM; }; /** * Atomically updates all bindings using a transactional function. * * @since 2.0.0 * @category mutations */ export declare const transformSTM: { /** * Atomically updates all bindings using a transactional function. * * @since 2.0.0 * @category mutations */ (f: (key: K, value: V) => STM.STM): (self: TMap) => STM.STM; /** * Atomically updates all bindings using a transactional function. * * @since 2.0.0 * @category mutations */ (self: TMap, f: (key: K, value: V) => STM.STM): STM.STM; }; /** * Atomically updates all values using a pure function. * * @since 2.0.0 * @category mutations */ export declare const transformValues: { /** * Atomically updates all values using a pure function. * * @since 2.0.0 * @category mutations */ (f: (value: V) => V): (self: TMap) => STM.STM; /** * Atomically updates all values using a pure function. * * @since 2.0.0 * @category mutations */ (self: TMap, f: (value: V) => V): STM.STM; }; /** * Atomically updates all values using a transactional function. * * @since 2.0.0 * @category mutations */ export declare const transformValuesSTM: { /** * Atomically updates all values using a transactional function. * * @since 2.0.0 * @category mutations */ (f: (value: V) => STM.STM): (self: TMap) => STM.STM; /** * Atomically updates all values using a transactional function. * * @since 2.0.0 * @category mutations */ (self: TMap, f: (value: V) => STM.STM): STM.STM; }; /** * Updates the mapping for the specified key with the specified function, * which takes the current value of the key as an input, if it exists, and * either returns `Some` with a new value to indicate to update the value in * the map or `None` to remove the value from the map. Returns `Some` with the * updated value or `None` if the value was removed from the map. * * @since 2.0.0 * @category mutations */ export declare const updateWith: { /** * Updates the mapping for the specified key with the specified function, * which takes the current value of the key as an input, if it exists, and * either returns `Some` with a new value to indicate to update the value in * the map or `None` to remove the value from the map. Returns `Some` with the * updated value or `None` if the value was removed from the map. * * @since 2.0.0 * @category mutations */ (key: K, f: (value: Option.Option) => Option.Option): (self: TMap) => STM.STM>; /** * Updates the mapping for the specified key with the specified function, * which takes the current value of the key as an input, if it exists, and * either returns `Some` with a new value to indicate to update the value in * the map or `None` to remove the value from the map. Returns `Some` with the * updated value or `None` if the value was removed from the map. * * @since 2.0.0 * @category mutations */ (self: TMap, key: K, f: (value: Option.Option) => Option.Option): STM.STM>; }; /** * Collects all values stored in map. * * @since 2.0.0 * @category elements */ export declare const values: (self: TMap) => STM.STM>; //# sourceMappingURL=TMap.d.ts.map