(self: TxPriorityQueue<A>)
| 441 | * @since 2.0.0 |
| 442 | */ |
| 443 | export const takeOption = <A>(self: TxPriorityQueue<A>): Effect.Effect<Option<A>> => |
| 444 | TxRef.modify(self.ref, (chunk) => { |
| 445 | const head = C.head(chunk) |
| 446 | if (O.isNone(head)) { |
| 447 | return [O.none<A>(), chunk] |
| 448 | } |
| 449 | return [O.some(head.value), C.drop(chunk, 1)] |
| 450 | }) |
| 451 | |
| 452 | /** |
| 453 | * Takes up to `n` elements from the queue in priority order. |