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