MCPcopy Create free account
hub / github.com/Effect-TS/effect / take

Function take

packages/effect/src/TxPriorityQueue.ts:388–397  ·  view source on GitHub ↗
(self: TxPriorityQueue<A>)

Source from the content-addressed store, hash-verified

386 * @since 2.0.0
387 */
388export const take = <A>(self: TxPriorityQueue<A>): Effect.Effect<A> =>
389 Effect.gen(function*() {
390 const chunk = yield* TxRef.get(self.ref)
391 const head = C.head(chunk)
392 if (O.isNone(head)) {
393 return yield* Effect.txRetry
394 }
395 yield* TxRef.set(self.ref, C.drop(chunk, 1))
396 return head.value
397 }).pipe(Effect.tx)
398
399/**
400 * Takes all elements from the queue, returning them in priority order.

Callers

nothing calls this directly

Calls 3

pipeMethod · 0.65
getMethod · 0.65
setMethod · 0.65

Tested by

no test coverage detected