Package: effect
Module: Queue
Peeks at the next item without removing it.
Details
Blocks until an item is available. If the queue is done or fails, the error is propagated.
Example (Peeking at the next value)
import { Cause, Effect, Queue } from "effect"
const program = Effect.gen(function*() {
const queue = yield* Queue.bounded<number>(10)
yield* Queue.offer(queue, 42)
// Peek at the next item without removing it
const item = yield* Queue.peek(queue)
console.log(item) // 42
})
Signature
declare const peek: <A, E>(self: Dequeue<A, E>) => Effect<A, E>
Since v4.0.0