/**
* @since 1.0.0
*/
import type * as Option from "@effect/data/Option";
import type * as Order from "@effect/data/Order";
import type { Predicate } from "@effect/data/Predicate";
import type * as STM from "@effect/stm/STM";
/**
* @since 1.0.0
* @category symbols
*/
export declare const TArrayTypeId: unique symbol;
/**
* @since 1.0.0
* @category symbols
*/
export type TArrayTypeId = typeof TArrayTypeId;
/**
* @since 1.0.0
* @category models
*/
export interface TArray extends TArray.Variance {
}
/**
* @since 1.0.0
*/
export declare namespace TArray {
/**
* @since 1.0.0
* @category models
*/
interface Variance {
readonly [TArrayTypeId]: {
readonly _A: (_: never) => A;
};
}
}
/**
* Finds the result of applying a partial function to the first value in its
* domain.
*
* @since 1.0.0
* @category elements
*/
export declare const collectFirst: {
(pf: (a: A) => Option.Option): (self: TArray) => STM.STM>;
(self: TArray, pf: (a: A) => Option.Option): STM.STM>;
};
/**
* Finds the result of applying an transactional partial function to the first
* value in its domain.
*
* @since 1.0.0
* @category elements
*/
export declare const collectFirstSTM: {
(pf: (a: A) => Option.Option>): (self: TArray) => STM.STM>;
(self: TArray, pf: (a: A) => Option.Option>): STM.STM>;
};
/**
* Determine if the array contains a specified value.
*
* @macro trace
* @since 1.0.0
* @category elements
*/
export declare const contains: {
(value: A): (self: TArray) => STM.STM;
(self: TArray, value: A): STM.STM;
};
/**
* Count the values in the array matching a predicate.
*
* @macro trace
* @since 1.0.0
* @category folding
*/
export declare const count: {
(predicate: Predicate): (self: TArray) => STM.STM;
(self: TArray, predicate: Predicate): STM.STM;
};
/**
* Count the values in the array matching a transactional predicate.
*
* @macro trace
* @since 1.0.0
* @category folding
*/
export declare const countSTM: {
(predicate: (value: A) => STM.STM): (self: TArray) => STM.STM;
(self: TArray, predicate: (value: A) => STM.STM): STM.STM;
};
/**
* Makes an empty `TArray`.
*
* @since 1.0.0
* @category constructors
*/
export declare const empty: () => STM.STM>;
/**
* Atomically evaluate the conjunction of a predicate across the members of
* the array.
*
* @since 1.0.0
* @category elements
*/
export declare const every: {
(predicate: Predicate): (self: TArray) => STM.STM;
(self: TArray, predicate: Predicate): STM.STM;
};
/**
* Atomically evaluate the conjunction of a transactional predicate across the
* members of the array.
*
* @since 1.0.0
* @category elements
*/
export declare const everySTM: {
(predicate: (value: A) => STM.STM): (self: TArray) => STM.STM;
(self: TArray, predicate: (value: A) => STM.STM): STM.STM;
};
/**
* Find the first element in the array matching the specified predicate.
*
* @since 1.0.0
* @category elements
*/
export declare const findFirst: {
(predicate: Predicate): (self: TArray) => STM.STM>;
(self: TArray, predicate: Predicate): STM.STM>;
};
/**
* Get the first index of a specific value in the array.
*
* @since 1.0.0
* @category elements
*/
export declare const findFirstIndex: {
(value: A): (self: TArray) => STM.STM>;
(self: TArray, value: A): STM.STM>;
};
/**
* Get the first index of a specific value in the array starting from the
* specified index.
*
* @since 1.0.0
* @category elements
*/
export declare const findFirstIndexFrom: {
(value: A, from: number): (self: TArray) => STM.STM>;
(self: TArray, value: A, from: number): STM.STM>;
};
/**
* Get the index of the first entry in the array matching a predicate.
*
* @since 1.0.0
* @category elements
*/
export declare const findFirstIndexWhere: {
(predicate: Predicate): (self: TArray) => STM.STM>;
(self: TArray, predicate: Predicate): STM.STM>;
};
/**
* Get the index of the first entry in the array starting from the specified
* index, matching a predicate.
*
* @since 1.0.0
* @category elements
*/
export declare const findFirstIndexWhereFrom: {
(predicate: Predicate, from: number): (self: TArray) => STM.STM>;
(self: TArray, predicate: Predicate, from: number): STM.STM>;
};
/**
* Get the index of the next entry that matches a transactional predicate.
*
* @since 1.0.0
* @category elements
*/
export declare const findFirstIndexWhereSTM: {
(predicate: (value: A) => STM.STM): (self: TArray) => STM.STM>;
(self: TArray, predicate: (value: A) => STM.STM): STM.STM>;
};
/**
* Starting at specified index, get the index of the next entry that matches a
* transactional predicate.
*
* @since 1.0.0
* @category elements
*/
export declare const findFirstIndexWhereFromSTM: {
(predicate: (value: A) => STM.STM, from: number): (self: TArray) => STM.STM>;
(self: TArray, predicate: (value: A) => STM.STM, from: number): STM.STM>;
};
/**
* Find the first element in the array matching a transactional predicate.
*
* @since 1.0.0
* @category elements
*/
export declare const findFirstSTM: {
(predicate: (value: A) => STM.STM): (self: TArray) => STM.STM>;
(self: TArray, predicate: (value: A) => STM.STM): STM.STM>;
};
/**
* Find the last element in the array matching a predicate.
*
* @since 1.0.0
* @category elements
*/
export declare const findLast: {
(predicate: Predicate): (self: TArray) => STM.STM>;
(self: TArray, predicate: Predicate): STM.STM>;
};
/**
* Get the last index of a specific value in the array bounded above by a
* specific index.
*
* @since 1.0.0
* @category elements
*/
export declare const findLastIndex: {
(value: A): (self: TArray) => STM.STM>;
(self: TArray, value: A): STM.STM>;
};
/**
* Get the last index of a specific value in the array bounded above by a
* specific index.
*
* @since 1.0.0
* @category elements
*/
export declare const findLastIndexFrom: {
(value: A, end: number): (self: TArray) => STM.STM>;
(self: TArray, value: A, end: number): STM.STM>;
};
/**
* Find the last element in the array matching a transactional predicate.
*
* @since 1.0.0
* @category elements
*/
export declare const findLastSTM: {
(predicate: (value: A) => STM.STM): (self: TArray) => STM.STM>;
(self: TArray, predicate: (value: A) => STM.STM): STM.STM>;
};
/**
* Atomically performs transactional effect for each item in array.
*
* @since 1.0.0
* @category elements
*/
export declare const forEach: {
(f: (value: A) => STM.STM): (self: TArray) => STM.STM;
(self: TArray, f: (value: A) => STM.STM): STM.STM;
};
/**
* Makes a new `TArray` initialized with provided iterable.
*
* @since 1.0.0
* @category constructors
*/
export declare const fromIterable: (iterable: Iterable) => STM.STM>;
/**
* Extracts value from ref in array.
*
* @since 1.0.0
* @category elements
*/
export declare const get: {
(index: number): (self: TArray) => STM.STM;
(self: TArray, index: number): STM.STM;
};
/**
* The first entry of the array, if it exists.
*
* @since 1.0.0
* @category elements
*/
export declare const headOption: (self: TArray) => STM.STM>;
/**
* The last entry in the array, if it exists.
*
* @since 1.0.0
* @category elements
*/
export declare const lastOption: (self: TArray) => STM.STM>;
/**
* Makes a new `TArray` that is initialized with specified values.
*
* @since 1.0.0
* @category constructors
*/
export declare const make: ]>(...elements: Elements) => STM.STM>;
/**
* Atomically compute the greatest element in the array, if it exists.
*
* @since 1.0.0
* @category elements
*/
export declare const maxOption: {
(order: Order.Order): (self: TArray) => STM.STM>;
(self: TArray, order: Order.Order): STM.STM>;
};
/**
* Atomically compute the least element in the array, if it exists.
*
* @since 1.0.0
* @category elements
*/
export declare const minOption: {
(order: Order.Order): (self: TArray) => STM.STM>;
(self: TArray, order: Order.Order): STM.STM>;
};
/**
* Atomically folds using a pure function.
*
* @since 1.0.0
* @category folding
*/
export declare const reduce: {
(zero: Z, f: (accumulator: Z, current: A) => Z): (self: TArray) => STM.STM;
(self: TArray, zero: Z, f: (accumulator: Z, current: A) => Z): STM.STM;
};
/**
* Atomically reduce the array, if non-empty, by a binary operator.
*
* @since 1.0.0
* @category elements
*/
export declare const reduceOption: {
(f: (x: A, y: A) => A): (self: TArray) => STM.STM>;
(self: TArray, f: (x: A, y: A) => A): STM.STM>;
};
/**
* Atomically reduce the non-empty array using a transactional binary
* operator.
*
* @since 1.0.0
* @category elements
*/
export declare const reduceOptionSTM: {
(f: (x: A, y: A) => STM.STM): (self: TArray) => STM.STM>;
(self: TArray, f: (x: A, y: A) => STM.STM): STM.STM>;
};
/**
* Atomically folds using a transactional function.
*
* @macro trace
* @since 1.0.0
* @category folding
*/
export declare const reduceSTM: {
(zero: Z, f: (accumulator: Z, current: A) => STM.STM): (self: TArray) => STM.STM;
(self: TArray, zero: Z, f: (accumulator: Z, current: A) => STM.STM): STM.STM;
};
/**
* Returns the size of the `TArray`.
*
* @since 1.0.0
* @category getters
*/
export declare const size: (self: TArray) => number;
/**
* Determine if the array contains a value satisfying a predicate.
*
* @since 1.0.0
* @category elements
*/
export declare const some: {
(predicate: Predicate): (self: TArray) => STM.STM;
(self: TArray, predicate: Predicate): STM.STM;
};
/**
* Determine if the array contains a value satisfying a transactional
* predicate.
*
* @since 1.0.0
* @category elements
*/
export declare const someSTM: {
(predicate: (value: A) => STM.STM): (self: TArray) => STM.STM;
(self: TArray, predicate: (value: A) => STM.STM): STM.STM;
};
/**
* Collects all elements into a chunk.
*
* @since 1.0.0
* @since 1.0.0
* @category destructors
*/
export declare const toArray: (self: TArray) => STM.STM>;
/**
* Atomically updates all elements using a pure function.
*
* @since 1.0.0
* @category elements
*/
export declare const transform: {
(f: (value: A) => A): (self: TArray) => STM.STM;
(self: TArray, f: (value: A) => A): STM.STM;
};
/**
* Atomically updates all elements using a transactional effect.
*
* @since 1.0.0
* @category elements
*/
export declare const transformSTM: {
(f: (value: A) => STM.STM): (self: TArray) => STM.STM;
(self: TArray, f: (value: A) => STM.STM): STM.STM;
};
/**
* Updates element in the array with given function.
*
* @since 1.0.0
* @category elements
*/
export declare const update: {
(index: number, f: (value: A) => A): (self: TArray) => STM.STM;
(self: TArray, index: number, f: (value: A) => A): STM.STM;
};
/**
* Atomically updates element in the array with given transactional effect.
*
* @since 1.0.0
* @category elements
*/
export declare const updateSTM: {
(index: number, f: (value: A) => STM.STM): (self: TArray) => STM.STM;
(self: TArray, index: number, f: (value: A) => STM.STM): STM.STM;
};
//# sourceMappingURL=TArray.d.ts.map