A purely functional Priority Queue implementation based on a binomial heap (Okasaki)
Assumes an Order instance is in scope for A
- Companion
- object
Value members
Concrete methods
Inherited methods
Enqueues the given element, possibly semantically blocking until sufficient capacity becomes available.
Enqueues the given element, possibly semantically blocking until sufficient capacity becomes available.
O(log(n))
- Value Params
- a
the element to be put in the PQueue
- Inherited from
- PQueueSink
Dequeues the least element from the PQueue, possibly semantically blocking until an element becomes available.
Dequeues the least element from the PQueue, possibly semantically blocking until an element becomes available.
O(log(n))
Note: If there are multiple elements with least priority, the order in which they are
dequeued is undefined. If you want to break ties with FIFO order you will need an
additional Ref[F, Long] to track insertion, and embed that information into your instance
for Order[A].
- Inherited from
- PQueueSource
Attempts to enqueue the given element without semantically blocking.
Attempts to enqueue the given element without semantically blocking.
O(log(n))
- Value Params
- a
the element to be put in the PQueue
- Returns
an effect that describes whether the enqueuing of the given element succeeded without blocking
- Inherited from
- PQueueSink
Attempts to dequeue the least element from the PQueue, if one is available without semantically blocking.
Attempts to dequeue the least element from the PQueue, if one is available without semantically blocking.
O(log(n))
- Returns
an effect that describes whether the dequeueing of an element from the PQueue succeeded without blocking, with
Nonedenoting that no element was available Note: If there are multiple elements with least priority, the order in which they are dequeued is undefined. If you want to break ties with FIFO order you will need an additionalRef[F, Long]to track insertion, and embed that information into your instance forOrder[A].- Inherited from
- PQueueSource