Skip to content
Effect 4.0 is here. One ecosystem. Zero dependencies.

TPriorityQueue

22 exports Since v2.0.0 Source

Constructors

Since v2.0.0

Constructs a new empty TPriorityQueue with the specified Order.

Signature

declare const empty: <A>(order: Order.Order<A>) => STM.STM<TPriorityQueue<A>>

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

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>>

Destructors

Since v2.0.0

Collects all values into an array.

Signature

declare const toArray: <A>(self: TPriorityQueue<A>) => STM.STM<Array<A>>
Since v2.0.0

Collects all values into a Chunk.

Signature

declare const toChunk: <A>(self: TPriorityQueue<A>) => STM.STM<Chunk.Chunk<A>>

Getters

Since v2.0.0

Checks whether the queue is empty.

Signature

declare const isEmpty: <A>(self: TPriorityQueue<A>) => STM.STM<boolean>

Checks whether the queue is not empty.

Signature

declare const isNonEmpty: <A>(self: TPriorityQueue<A>) => STM.STM<boolean>
Since v2.0.0

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>

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

Removes all elements from the queue matching the specified predicate.

Signature

declare const removeIf: {
<A>(predicate: Predicate<A>): (self: TPriorityQueue<A>) => STM<void>;
<A>(self: TPriorityQueue<A>, predicate: Predicate<A>): STM<void>;
}
Since v2.0.0

Retains only elements from the queue matching the specified predicate.

Signature

declare const retainIf: {
<A>(predicate: Predicate<A>): (self: TPriorityQueue<A>) => STM<void>;
<A>(self: TPriorityQueue<A>, predicate: Predicate<A>): STM<void>;
}
Since v2.0.0

Returns the size of the queue.

Signature

declare const size: <A>(self: TPriorityQueue<A>) => STM.STM<number>

Models

Since v2.0.0

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

interface TPriorityQueue<in out A> extends Variance<A> {}

Mutations

Since v2.0.0

Offers the specified value to the queue.

Signature

declare const offer: {
<A>(value: A): (self: TPriorityQueue<A>) => STM<void>;
<A>(self: TPriorityQueue<A>, value: A): STM<void>;
}
Since v2.0.0

Offers all of the elements in the specified collection to the queue.

Signature

declare const offerAll: {
<A>(values: Iterable<A>): (self: TPriorityQueue<A>) => STM<void>;
<A>(self: TPriorityQueue<A>, values: Iterable<A>): STM<void>;
}
Since v2.0.0

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

Takes all values from the queue.

Signature

declare const takeAll: <A>(self: TPriorityQueue<A>) => STM.STM<Array<A>>

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

Takes up to the specified maximum number of elements from the queue.

Signature

declare const takeUpTo: {
(n: number): <A>(self: TPriorityQueue<A>) => STM<Array<A>>;
<A>(self: TPriorityQueue<A>, n: number): STM<Array<A>>;
}

Other

Symbols

Signature

declare const TPriorityQueueTypeId: unique symbol

Signature

type TPriorityQueueTypeId = typeof TPriorityQueueTypeId