TPriorityQueue overview
Added in v2.0.0
Table of contents
constructors
empty
Constructs a new empty TPriorityQueue
with the specified Order
.
Signature
export declare const empty: <A>(order: Order.Order<A>) => STM.STM<TPriorityQueue<A>>
Added in v2.0.0
fromIterable
Creates a new TPriorityQueue
from an iterable collection of values.
Signature
export declare const fromIterable: <A>(order: Order.Order<A>) => (iterable: Iterable<A>) => STM.STM<TPriorityQueue<A>>
Added in v2.0.0
make
Makes a new TPriorityQueue
that is initialized with specified values.
Signature
export declare const make: <A>(order: Order.Order<A>) => (...elements: Array<A>) => STM.STM<TPriorityQueue<A>>
Added in v2.0.0
destructors
toArray
Collects all values into an array.
Signature
export declare const toArray: <A>(self: TPriorityQueue<A>) => STM.STM<Array<A>>
Added in v2.0.0
toChunk
Collects all values into a Chunk
.
Signature
export declare const toChunk: <A>(self: TPriorityQueue<A>) => STM.STM<Chunk.Chunk<A>>
Added in v2.0.0
getters
isEmpty
Checks whether the queue is empty.
Signature
export declare const isEmpty: <A>(self: TPriorityQueue<A>) => STM.STM<boolean>
Added in v2.0.0
isNonEmpty
Checks whether the queue is not empty.
Signature
export declare const isNonEmpty: <A>(self: TPriorityQueue<A>) => STM.STM<boolean>
Added in v2.0.0
peek
Peeks at the first value in the queue without removing it, retrying until a value is in the queue.
Signature
export declare const peek: <A>(self: TPriorityQueue<A>) => STM.STM<A>
Added in 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
export declare const peekOption: <A>(self: TPriorityQueue<A>) => STM.STM<Option.Option<A>>
Added in v2.0.0
removeIf
Removes all elements from the queue matching the specified predicate.
Signature
export declare const removeIf: {
<A>(predicate: Predicate<A>): (self: TPriorityQueue<A>) => STM.STM<void>
<A>(self: TPriorityQueue<A>, predicate: Predicate<A>): STM.STM<void>
}
Added in v2.0.0
retainIf
Retains only elements from the queue matching the specified predicate.
Signature
export declare const retainIf: {
<A>(predicate: Predicate<A>): (self: TPriorityQueue<A>) => STM.STM<void>
<A>(self: TPriorityQueue<A>, predicate: Predicate<A>): STM.STM<void>
}
Added in v2.0.0
size
Returns the size of the queue.
Signature
export declare const size: <A>(self: TPriorityQueue<A>) => STM.STM<number>
Added in 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> {}
Added in v2.0.0
mutations
offer
Offers the specified value to the queue.
Signature
export declare const offer: {
<A>(value: A): (self: TPriorityQueue<A>) => STM.STM<void>
<A>(self: TPriorityQueue<A>, value: A): STM.STM<void>
}
Added in v2.0.0
offerAll
Offers all of the elements in the specified collection to the queue.
Signature
export declare const offerAll: {
<A>(values: Iterable<A>): (self: TPriorityQueue<A>) => STM.STM<void>
<A>(self: TPriorityQueue<A>, values: Iterable<A>): STM.STM<void>
}
Added in v2.0.0
take
Takes a value from the queue, retrying until a value is in the queue.
Signature
export declare const take: <A>(self: TPriorityQueue<A>) => STM.STM<A>
Added in v2.0.0
takeAll
Takes all values from the queue.
Signature
export declare const takeAll: <A>(self: TPriorityQueue<A>) => STM.STM<Array<A>>
Added in v2.0.0
takeOption
Takes a value from the queue, returning None
if there is not a value in the queue.
Signature
export declare const takeOption: <A>(self: TPriorityQueue<A>) => STM.STM<Option.Option<A>>
Added in v2.0.0
takeUpTo
Takes up to the specified maximum number of elements from the queue.
Signature
export declare const takeUpTo: {
(n: number): <A>(self: TPriorityQueue<A>) => STM.STM<Array<A>>
<A>(self: TPriorityQueue<A>, n: number): STM.STM<Array<A>>
}
Added in v2.0.0
symbols
TPriorityQueueTypeId
Signature
export declare const TPriorityQueueTypeId: typeof TPriorityQueueTypeId
Added in v2.0.0
TPriorityQueueTypeId (type alias)
Signature
export type TPriorityQueueTypeId = typeof TPriorityQueueTypeId
Added in v2.0.0
utils
TPriorityQueue (namespace)
Added in v2.0.0
Variance (interface)
Signature
export interface Variance<in out A> {
readonly [TPriorityQueueTypeId]: {
readonly _A: Types.Invariant<A>
}
}
Added in v2.0.0