import type { LazyArg } from "@effect/data/Function"; import type * as HashMap from "@effect/data/HashMap"; import type * as Option from "@effect/data/Option"; import type * as STM from "@effect/stm/STM"; /** * @since 1.0.0 * @category symbols */ export declare const TMapTypeId: unique symbol; /** * @since 1.0.0 * @category symbols */ export type TMapTypeId = typeof TMapTypeId; /** * Transactional map implemented on top of `TRef` and `TArray`. Resolves * conflicts via chaining. * * @since 1.0.0 * @category models */ export interface TMap extends TMap.Variance { } /** * @since 1.0.0 */ export declare namespace TMap { /** * @since 1.0.0 * @category models */ interface Variance { readonly [TMapTypeId]: { readonly _K: (_: never) => K; readonly _V: (_: never) => V; }; } } /** * Makes an empty `TMap`. * * @since 1.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 1.0.0 * @category elements */ export declare const find: { (pf: (key: K, value: V) => Option.Option): (self: TMap) => STM.STM>; (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 1.0.0 * @category elements */ export declare const findSTM: { (f: (key: K, value: V) => STM.STM, A>): (self: TMap) => STM.STM>; (self: TMap, f: (key: K, value: V) => STM.STM, A>): STM.STM>; }; /** * Finds all the key/value pairs matching the specified predicate, and uses * the provided function to extract values out them. * * @since 1.0.0 * @category elements */ export declare const findAll: { (pf: (key: K, value: V) => Option.Option): (self: TMap) => STM.STM>; (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 1.0.0 * @category elements */ export declare const findAllSTM: { (pf: (key: K, value: V) => STM.STM, A>): (self: TMap) => STM.STM>; (self: TMap, pf: (key: K, value: V) => STM.STM, A>): STM.STM>; }; /** * Atomically performs transactional-effect for each binding present in map. * * @since 1.0.0 * @category elements */ export declare const forEach: { (f: (key: K, value: V) => STM.STM): (self: TMap) => STM.STM; (self: TMap, f: (key: K, value: V) => STM.STM): STM.STM; }; /** * Makes a new `TMap` initialized with provided iterable. * * @since 1.0.0 * @category constructors */ export declare const fromIterable: (iterable: Iterable) => STM.STM>; /** * Retrieves value associated with given key. * * @since 1.0.0 * @category elements */ export declare const get: { (key: K): (self: TMap) => STM.STM>; (self: TMap, key: K): STM.STM>; }; /** * Retrieves value associated with given key or default value, in case the key * isn't present. * * @since 1.0.0 * @category elements */ export declare const getOrElse: { (key: K, fallback: LazyArg): (self: TMap) => STM.STM; (self: TMap, key: K, fallback: LazyArg): STM.STM; }; /** * Tests whether or not map contains a key. * * @since 1.0.0 * @category elements */ export declare const has: { (key: K): (self: TMap) => STM.STM; (self: TMap, key: K): STM.STM; }; /** * Tests if the map is empty or not. * * @since 1.0.0 * @category getters */ export declare const isEmpty: (self: TMap) => STM.STM; /** * Collects all keys stored in map. * * @since 1.0.0 * @category elements */ export declare const keys: (self: TMap) => STM.STM>; /** * Makes a new `TMap` that is initialized with specified values. * * @since 1.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 1.0.0 * @category mutations */ export declare const merge: { (key: K, value: V, f: (x: V, y: V) => V): (self: TMap) => STM.STM; (self: TMap, key: K, value: V, f: (x: V, y: V) => V): STM.STM; }; /** * Atomically folds using a pure function. * * @since 1.0.0 * @category folding */ export declare const reduce: { (zero: Z, f: (acc: Z, value: V) => Z): (self: TMap) => STM.STM; (self: TMap, zero: Z, f: (acc: Z, value: V) => Z): STM.STM; }; /** * Atomically folds using a transactional function. * * @since 1.0.0 * @category folding */ export declare const reduceSTM: { (zero: Z, f: (acc: Z, value: V) => STM.STM): (self: TMap) => STM.STM; (self: TMap, zero: Z, f: (acc: Z, value: V) => STM.STM): STM.STM; }; /** * Atomically folds using a pure function. * * @since 1.0.0 * @category folding */ export declare const reduceWithIndex: { (zero: Z, f: (acc: Z, value: V, key: K) => Z): (self: TMap) => STM.STM; (self: TMap, zero: Z, f: (acc: Z, value: V, key: K) => Z): STM.STM; }; /** * Atomically folds using a transactional function. * * @since 1.0.0 * @category folding */ export declare const reduceWithIndexSTM: { (zero: Z, f: (acc: Z, value: V, key: K) => STM.STM): (self: TMap) => STM.STM; (self: TMap, zero: Z, f: (acc: Z, value: V, key: K) => STM.STM): STM.STM; }; /** * Removes binding for given key. * * @since 1.0.0 * @category mutations */ export declare const remove: { (key: K): (self: TMap) => STM.STM; (self: TMap, key: K): STM.STM; }; /** * Deletes all entries associated with the specified keys. * * @since 1.0.0 * @category mutations */ export declare const removeAll: { (keys: Iterable): (self: TMap) => STM.STM; (self: TMap, keys: Iterable): STM.STM; }; /** * Removes bindings matching predicate and returns the removed entries. * * @since 1.0.0 * @category mutations */ export declare const removeIf: { (predicate: (key: K, value: V) => boolean): (self: TMap) => STM.STM>; (self: TMap, predicate: (key: K, value: V) => boolean): STM.STM>; }; /** * Removes bindings matching predicate. * * @since 1.0.0 * @category mutations */ export declare const removeIfDiscard: { (predicate: (key: K, value: V) => boolean): (self: TMap) => STM.STM; (self: TMap, predicate: (key: K, value: V) => boolean): STM.STM; }; /** * Retains bindings matching predicate and returns removed bindings. * * @since 1.0.0 * @category mutations */ export declare const retainIf: { (predicate: (key: K, value: V) => boolean): (self: TMap) => STM.STM>; (self: TMap, predicate: (key: K, value: V) => boolean): STM.STM>; }; /** * Retains bindings matching predicate. * * @since 1.0.0 * @category mutations */ export declare const retainIfDiscard: { (predicate: (key: K, value: V) => boolean): (self: TMap) => STM.STM; (self: TMap, predicate: (key: K, value: V) => boolean): STM.STM; }; /** * Stores new binding into the map. * * @since 1.0.0 * @category mutations */ export declare const set: { (key: K, value: V): (self: TMap) => STM.STM; (self: TMap, key: K, value: V): STM.STM; }; /** * Stores new binding in the map if it does not already exist. * * @since 1.0.0 * @category mutations */ export declare const setIfAbsent: { (key: K, value: V): (self: TMap) => STM.STM; (self: TMap, key: K, value: V): STM.STM; }; /** * Returns the number of bindings. * * @since 1.0.0 * @category getters */ export declare const size: (self: TMap) => STM.STM; /** * Takes the first matching value, or retries until there is one. * * @since 1.0.0 * @category mutations */ export declare const takeFirst: { (pf: (key: K, value: V) => Option.Option): (self: TMap) => STM.STM; (self: TMap, pf: (key: K, value: V) => Option.Option): STM.STM; }; /** * Takes the first matching value, or retries until there is one. * * @since 1.0.0 * @category mutations */ export declare const takeFirstSTM: { (pf: (key: K, value: V) => STM.STM, A>): (self: TMap) => STM.STM; (self: TMap, pf: (key: K, value: V) => STM.STM, A>): STM.STM; }; /** * Takes all matching values, or retries until there is at least one. * * @since 1.0.0 * @category mutations */ export declare const takeSome: { (pf: (key: K, value: V) => Option.Option): (self: TMap) => STM.STM]>; (self: TMap, pf: (key: K, value: V) => Option.Option): STM.STM]>; }; /** * Takes all matching values, or retries until there is at least one. * * @since 1.0.0 * @category mutations */ export declare const takeSomeSTM: { (pf: (key: K, value: V) => STM.STM, A>): (self: TMap) => STM.STM]>; (self: TMap, pf: (key: K, value: V) => STM.STM, A>): STM.STM]>; }; /** * Collects all bindings into a `Chunk`. * * @since 1.0.0 * @category destructors */ export declare const toChunk: (self: TMap) => STM.STM>; /** * Collects all bindings into a `HashMap`. * * @since 1.0.0 * @category destructors */ export declare const toHashMap: (self: TMap) => STM.STM>; /** * Collects all bindings into a `ReadonlyArray`. * * @since 1.0.0 * @category destructors */ export declare const toReadonlyArray: (self: TMap) => STM.STM>; /** * Collects all bindings into a `ReadonlyMap`. * * @since 1.0.0 * @category destructors */ export declare const toReadonlyMap: (self: TMap) => STM.STM>; /** * Atomically updates all bindings using a pure function. * * @since 1.0.0 * @category mutations */ export declare const transform: { (f: (key: K, value: V) => readonly [K, V]): (self: TMap) => STM.STM; (self: TMap, f: (key: K, value: V) => readonly [K, V]): STM.STM; }; /** * Atomically updates all bindings using a transactional function. * * @since 1.0.0 * @category mutations */ export declare const transformSTM: { (f: (key: K, value: V) => STM.STM): (self: TMap) => STM.STM; (self: TMap, f: (key: K, value: V) => STM.STM): STM.STM; }; /** * Atomically updates all values using a pure function. * * @since 1.0.0 * @category mutations */ export declare const transformValues: { (f: (value: V) => V): (self: TMap) => STM.STM; (self: TMap, f: (value: V) => V): STM.STM; }; /** * Atomically updates all values using a transactional function. * * @since 1.0.0 * @category mutations */ export declare const transformValuesSTM: { (f: (value: V) => STM.STM): (self: TMap) => STM.STM; (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 1.0.0 * @category mutations */ export declare const updateWith: { (key: K, f: (value: Option.Option) => Option.Option): (self: TMap) => STM.STM>; (self: TMap, key: K, f: (value: Option.Option) => Option.Option): STM.STM>; }; /** * Collects all values stored in map. * * @since 1.0.0 * @category elements */ export declare const values: (self: TMap) => STM.STM>; //# sourceMappingURL=TMap.d.ts.map