Skip to content

TPriorityQueue

22 exports Added in v2.0.0 Source

Constructors

empty

Added in v2.0.0 Source

Constructs a new empty TPriorityQueue with the specified Order.

Signature

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

fromIterable

Added in v2.0.0 Source

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

make

Added in v2.0.0 Source

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

toArray

Added in v2.0.0 Source

Collects all values into an array.

Signature

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

toChunk

Added in v2.0.0 Source

Collects all values into a Chunk.

Signature

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

Getters

isEmpty

Added in v2.0.0 Source

Checks whether the queue is empty.

Signature

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

isNonEmpty

Added in v2.0.0 Source

Checks whether the queue is not empty.

Signature

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

peek

Added in v2.0.0 Source

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

peekOption

Added in v2.0.0 Source

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

removeIf

Added in v2.0.0 Source

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

retainIf

Added in v2.0.0 Source

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

size

Added in v2.0.0 Source

Returns the size of the queue.

Signature

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

Models

TPriorityQueue interface

Added in v2.0.0 Source

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

offer

Added in v2.0.0 Source

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

offerAll

Added in v2.0.0 Source

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

take

Added in v2.0.0 Source

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

takeAll

Added in v2.0.0 Source

Takes all values from the queue.

Signature

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

takeOption

Added in v2.0.0 Source

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

takeUpTo

Added in v2.0.0 Source

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;

TPriorityQueueTypeId type

Added in v2.0.0 Source

Signature

type TPriorityQueueTypeId = typeof TPriorityQueueTypeId;