TPriorityQueue.ts overview
Since v2.0.0
Exports Grouped by Category
constructors
empty
Constructs a new empty TPriorityQueue
with the specified Order
.
Signature
declare const empty: <A>(order: Order.Order<A>) => STM.STM<TPriorityQueue<A>>
Since v2.0.0
fromIterable
Creates a new TPriorityQueue
from an iterable collection of values.
Signature
declare const fromIterable: <A>(order: Order.Order<A>) => (iterable: Iterable<A>) => STM.STM<TPriorityQueue<A>>
Since v2.0.0
make
Makes a new TPriorityQueue
that is initialized with specified values.
Signature
declare const make: <A>(order: Order.Order<A>) => (...elements: Array<A>) => STM.STM<TPriorityQueue<A>>
Since v2.0.0
destructors
toArray
Collects all values into an array.
Signature
declare const toArray: <A>(self: TPriorityQueue<A>) => STM.STM<Array<A>>
Since v2.0.0
toChunk
Collects all values into a Chunk
.
Signature
declare const toChunk: <A>(self: TPriorityQueue<A>) => STM.STM<Chunk.Chunk<A>>
Since v2.0.0
getters
isEmpty
Checks whether the queue is empty.
Signature
declare const isEmpty: <A>(self: TPriorityQueue<A>) => STM.STM<boolean>
Since v2.0.0
isNonEmpty
Checks whether the queue is not empty.
Signature
declare const isNonEmpty: <A>(self: TPriorityQueue<A>) => STM.STM<boolean>
Since v2.0.0
peek
Peeks at the first value in the queue without removing it, retrying until a value is in the queue.
Signature
declare const peek: <A>(self: TPriorityQueue<A>) => STM.STM<A>
Since v2.0.0
peekOption
Peeks at the first value in the queue without removing it, returning None
if there is not a value in the queue.
Signature
declare const peekOption: <A>(self: TPriorityQueue<A>) => STM.STM<Option.Option<A>>
Since v2.0.0
removeIf
Removes all elements from the queue matching the specified predicate.
Signature
declare const removeIf: {
<A>(predicate: Predicate<A>): (self: TPriorityQueue<A>) => STM.STM<void>
<A>(self: TPriorityQueue<A>, predicate: Predicate<A>): STM.STM<void>
}
Since v2.0.0
retainIf
Retains only elements from the queue matching the specified predicate.
Signature
declare const retainIf: {
<A>(predicate: Predicate<A>): (self: TPriorityQueue<A>) => STM.STM<void>
<A>(self: TPriorityQueue<A>, predicate: Predicate<A>): STM.STM<void>
}
Since v2.0.0
size
Returns the size of the queue.
Signature
declare const size: <A>(self: TPriorityQueue<A>) => STM.STM<number>
Since v2.0.0
models
TPriorityQueue (interface)
A TPriorityQueue
contains values of type A
that an Order
is defined on. Unlike a TQueue
, take
returns the highest priority value (the value that is first in the specified ordering) as opposed to the first value offered to the queue. The ordering that elements with the same priority will be taken from the queue is not guaranteed.
Signature
export interface TPriorityQueue<in out A> extends TPriorityQueue.Variance<A> {}
Since v2.0.0
mutations
offer
Offers the specified value to the queue.
Signature
declare const offer: {
<A>(value: A): (self: TPriorityQueue<A>) => STM.STM<void>
<A>(self: TPriorityQueue<A>, value: A): STM.STM<void>
}
Since v2.0.0
offerAll
Offers all of the elements in the specified collection to the queue.
Signature
declare const offerAll: {
<A>(values: Iterable<A>): (self: TPriorityQueue<A>) => STM.STM<void>
<A>(self: TPriorityQueue<A>, values: Iterable<A>): STM.STM<void>
}
Since v2.0.0
take
Takes a value from the queue, retrying until a value is in the queue.
Signature
declare const take: <A>(self: TPriorityQueue<A>) => STM.STM<A>
Since v2.0.0
takeAll
Takes all values from the queue.
Signature
declare const takeAll: <A>(self: TPriorityQueue<A>) => STM.STM<Array<A>>
Since v2.0.0
takeOption
Takes a value from the queue, returning None
if there is not a value in the queue.
Signature
declare const takeOption: <A>(self: TPriorityQueue<A>) => STM.STM<Option.Option<A>>
Since v2.0.0
takeUpTo
Takes up to the specified maximum number of elements from the queue.
Signature
declare const takeUpTo: {
(n: number): <A>(self: TPriorityQueue<A>) => STM.STM<Array<A>>
<A>(self: TPriorityQueue<A>, n: number): STM.STM<Array<A>>
}
Since v2.0.0
symbols
TPriorityQueueTypeId
Signature
declare const TPriorityQueueTypeId: unique symbol
Since v2.0.0
TPriorityQueueTypeId (type alias)
Signature
type TPriorityQueueTypeId = typeof TPriorityQueueTypeId
Since v2.0.0
utils
TPriorityQueue (namespace)
Since v2.0.0
Variance (interface)
Signature
export interface Variance<in out A> {
readonly [TPriorityQueueTypeId]: {
readonly _A: Types.Invariant<A>
}
}
Since v2.0.0