effect-io-ai

Package: effect
Module: TxPriorityQueue

TxPriorityQueue.takeAll

Takes all elements from the queue, returning them in priority order.

Example (Taking all values in priority order)

import { Effect, Order, TxPriorityQueue } from "effect"

const program = Effect.gen(function*() {
  const pq = yield* TxPriorityQueue.fromIterable(Order.Number, [3, 1, 2])
  const all = yield* TxPriorityQueue.takeAll(pq)
  console.log(all) // [1, 2, 3]
})

Signature

declare const takeAll: <A>(self: TxPriorityQueue<A>) => Effect.Effect<Array<A>>

Source

Since v2.0.0