TArray
Constructors
Signature
declare const empty: <A>() => STM.STM<TArray<A>>;fromIterable
Creates a new TArray from an iterable collection of values.
Signature
declare const fromIterable: <A>(iterable: Iterable<A>) => STM.STM<TArray<A>>;Makes a new TArray that is initialized with specified values.
Signature
declare const make: <Elements extends [any, ...Array<any>]>(
...elements: Elements
) => STM.STM<TArray<Elements[number]>>;Destructors
Elements
collectFirst
Finds the result of applying a partial function to the first value in its domain.
Signature
declare const collectFirst: {
<A, B>(pf: (a: A) => Option<B>): (self: TArray<A>) => STM<Option<B>>;
<A, B>(self: TArray<A>, pf: (a: A) => Option<B>): STM<Option<B>>;
};collectFirstSTM
Finds the result of applying an transactional partial function to the first value in its domain.
Signature
declare const collectFirstSTM: {
<A, B, E, R>(pf: (a: A) => Option<STM<B, E, R>>): (self: TArray<A>) => STM<Option<B>, E, R>;
<A, B, E, R>(self: TArray<A>, pf: (a: A) => Option<STM<B, E, R>>): STM<Option<B>, E, R>;
};Determine if the array contains a specified value.
Signature
declare const contains: {
<A>(value: A): (self: TArray<A>) => STM<boolean>;
<A>(self: TArray<A>, value: A): STM<boolean>;
};Atomically evaluate the conjunction of a predicate across the members of the array.
Signature
declare const every: {
<A>(predicate: Predicate<A>): (self: TArray<A>) => STM<boolean>;
<A>(self: TArray<A>, predicate: Predicate<A>): STM<boolean>;
};Atomically evaluate the conjunction of a transactional predicate across the members of the array.
Signature
declare const everySTM: {
<A, R, E>(predicate: (value: A) => STM<boolean, E, R>): (self: TArray<A>) => STM<boolean, E, R>;
<A, R, E>(self: TArray<A>, predicate: (value: A) => STM<boolean, E, R>): STM<boolean, E, R>;
};Find the first element in the array matching the specified predicate.
Signature
declare const findFirst: {
<A>(predicate: Predicate<A>): (self: TArray<A>) => STM<Option<A>>;
<A>(self: TArray<A>, predicate: Predicate<A>): STM<Option<A>>;
};findFirstIndex
Get the first index of a specific value in the array.
Signature
declare const findFirstIndex: {
<A>(value: A): (self: TArray<A>) => STM<Option<number>>;
<A>(self: TArray<A>, value: A): STM<Option<number>>;
};findFirstIndexFrom
Get the first index of a specific value in the array starting from the specified index.
Signature
declare const findFirstIndexFrom: {
<A>(value: A, from: number): (self: TArray<A>) => STM<Option<number>>;
<A>(self: TArray<A>, value: A, from: number): STM<Option<number>>;
};findFirstIndexWhere
Get the index of the first entry in the array matching a predicate.
Signature
declare const findFirstIndexWhere: {
<A>(predicate: Predicate<A>): (self: TArray<A>) => STM<Option<number>>;
<A>(self: TArray<A>, predicate: Predicate<A>): STM<Option<number>>;
};findFirstIndexWhereFrom
Get the index of the first entry in the array starting from the specified index, matching a predicate.
Signature
declare const findFirstIndexWhereFrom: {
<A>(predicate: Predicate<A>, from: number): (self: TArray<A>) => STM<Option<number>>;
<A>(self: TArray<A>, predicate: Predicate<A>, from: number): STM<Option<number>>;
};findFirstIndexWhereFromSTM
Starting at specified index, get the index of the next entry that matches a transactional predicate.
Signature
declare const findFirstIndexWhereFromSTM: {
<A, R, E>(
predicate: (value: A) => STM<boolean, E, R>,
from: number,
): (self: TArray<A>) => STM<Option<number>, E, R>;
<A, R, E>(
self: TArray<A>,
predicate: (value: A) => STM<boolean, E, R>,
from: number,
): STM<Option<number>, E, R>;
};findFirstIndexWhereSTM
Get the index of the next entry that matches a transactional predicate.
Signature
declare const findFirstIndexWhereSTM: {
<A, R, E>(
predicate: (value: A) => STM<boolean, E, R>,
): (self: TArray<A>) => STM<Option<number>, E, R>;
<A, R, E>(
self: TArray<A>,
predicate: (value: A) => STM<boolean, E, R>,
): STM<Option<number>, E, R>;
};findFirstSTM
Find the first element in the array matching a transactional predicate.
Signature
declare const findFirstSTM: {
<A, R, E>(predicate: (value: A) => STM<boolean, E, R>): (self: TArray<A>) => STM<Option<A>, E, R>;
<A, R, E>(self: TArray<A>, predicate: (value: A) => STM<boolean, E, R>): STM<Option<A>, E, R>;
};Find the last element in the array matching a predicate.
Signature
declare const findLast: {
<A>(predicate: Predicate<A>): (self: TArray<A>) => STM<Option<A>>;
<A>(self: TArray<A>, predicate: Predicate<A>): STM<Option<A>>;
};findLastIndex
Get the last index of a specific value in the array bounded above by a specific index.
Signature
declare const findLastIndex: {
<A>(value: A): (self: TArray<A>) => STM<Option<number>>;
<A>(self: TArray<A>, value: A): STM<Option<number>>;
};findLastIndexFrom
Get the last index of a specific value in the array bounded above by a specific index.
Signature
declare const findLastIndexFrom: {
<A>(value: A, end: number): (self: TArray<A>) => STM<Option<number>>;
<A>(self: TArray<A>, value: A, end: number): STM<Option<number>>;
};findLastSTM
Find the last element in the array matching a transactional predicate.
Signature
declare const findLastSTM: {
<A, R, E>(predicate: (value: A) => STM<boolean, E, R>): (self: TArray<A>) => STM<Option<A>, E, R>;
<A, R, E>(self: TArray<A>, predicate: (value: A) => STM<boolean, E, R>): STM<Option<A>, E, R>;
};Atomically performs transactional effect for each item in array.
Signature
declare const forEach: {
<A, R, E>(f: (value: A) => STM<void, E, R>): (self: TArray<A>) => STM<void, E, R>;
<A, R, E>(self: TArray<A>, f: (value: A) => STM<void, E, R>): STM<void, E, R>;
};Extracts value from ref in array.
Signature
declare const get: {
(index: number): <A>(self: TArray<A>) => STM<A>;
<A>(self: TArray<A>, index: number): STM<A>;
};headOption
The first entry of the array, if it exists.
Signature
declare const headOption: <A>(self: TArray<A>) => STM.STM<Option.Option<A>>;lastOption
The last entry in the array, if it exists.
Signature
declare const lastOption: <A>(self: TArray<A>) => STM.STM<Option.Option<A>>;Atomically compute the greatest element in the array, if it exists.
Signature
declare const maxOption: {
<A>(order: Order<A>): (self: TArray<A>) => STM<Option<A>>;
<A>(self: TArray<A>, order: Order<A>): STM<Option<A>>;
};Atomically compute the least element in the array, if it exists.
Signature
declare const minOption: {
<A>(order: Order<A>): (self: TArray<A>) => STM<Option<A>>;
<A>(self: TArray<A>, order: Order<A>): STM<Option<A>>;
};reduceOption
Atomically reduce the array, if non-empty, by a binary operator.
Signature
declare const reduceOption: {
<A>(f: (x: A, y: A) => A): (self: TArray<A>) => STM<Option<A>>;
<A>(self: TArray<A>, f: (x: A, y: A) => A): STM<Option<A>>;
};reduceOptionSTM
Atomically reduce the non-empty array using a transactional binary operator.
Signature
declare const reduceOptionSTM: {
<A, R, E>(f: (x: A, y: A) => STM<A, E, R>): (self: TArray<A>) => STM<Option<A>, E, R>;
<A, R, E>(self: TArray<A>, f: (x: A, y: A) => STM<A, E, R>): STM<Option<A>, E, R>;
};Determine if the array contains a value satisfying a predicate.
Signature
declare const some: {
<A>(predicate: Predicate<A>): (self: TArray<A>) => STM<boolean>;
<A>(self: TArray<A>, predicate: Predicate<A>): STM<boolean>;
};Determine if the array contains a value satisfying a transactional predicate.
Signature
declare const someSTM: {
<A, R, E>(predicate: (value: A) => STM<boolean, E, R>): (self: TArray<A>) => STM<boolean, E, R>;
<A, R, E>(self: TArray<A>, predicate: (value: A) => STM<boolean, E, R>): STM<boolean, E, R>;
};Atomically updates all elements using a pure function.
Signature
declare const transform: {
<A>(f: (value: A) => A): (self: TArray<A>) => STM<void>;
<A>(self: TArray<A>, f: (value: A) => A): STM<void>;
};transformSTM
Atomically updates all elements using a transactional effect.
Signature
declare const transformSTM: {
<A, R, E>(f: (value: A) => STM<A, E, R>): (self: TArray<A>) => STM<void, E, R>;
<A, R, E>(self: TArray<A>, f: (value: A) => STM<A, E, R>): STM<void, E, R>;
};Updates element in the array with given function.
Signature
declare const update: {
<A>(index: number, f: (value: A) => A): (self: TArray<A>) => STM<void>;
<A>(self: TArray<A>, index: number, f: (value: A) => A): STM<void>;
};Atomically updates element in the array with given transactional effect.
Signature
declare const updateSTM: {
<A, R, E>(index: number, f: (value: A) => STM<A, E, R>): (self: TArray<A>) => STM<void, E, R>;
<A, R, E>(self: TArray<A>, index: number, f: (value: A) => STM<A, E, R>): STM<void, E, R>;
};Folding
Count the values in the array matching a predicate.
Signature
declare const count: {
<A>(predicate: Predicate<A>): (self: TArray<A>) => STM<number>;
<A>(self: TArray<A>, predicate: Predicate<A>): STM<number>;
};Count the values in the array matching a transactional predicate.
Signature
declare const countSTM: {
<A, R, E>(predicate: (value: A) => STM<boolean, E, R>): (self: TArray<A>) => STM<number, E, R>;
<A, R, E>(self: TArray<A>, predicate: (value: A) => STM<boolean, E, R>): STM<number, E, R>;
};Atomically folds using a pure function.
Signature
declare const reduce: {
<Z, A>(zero: Z, f: (accumulator: Z, current: A) => Z): (self: TArray<A>) => STM<Z>;
<Z, A>(self: TArray<A>, zero: Z, f: (accumulator: Z, current: A) => Z): STM<Z>;
};Atomically folds using a transactional function.
Signature
declare const reduceSTM: {
<Z, A, R, E>(
zero: Z,
f: (accumulator: Z, current: A) => STM<Z, E, R>,
): (self: TArray<A>) => STM<Z, E, R>;
<Z, A, R, E>(
self: TArray<A>,
zero: Z,
f: (accumulator: Z, current: A) => STM<Z, E, R>,
): STM<Z, E, R>;
};Getters
Models
Other
Symbols
TArrayTypeId
Signature
declare const TArrayTypeId: unique symbol;TArrayTypeId type
Signature
type TArrayTypeId = typeof TArrayTypeId;
Makes an empty
TArray.