MCPcopy
hub / github.com/Effect-TS/effect / waitForValue

Function waitForValue

packages/effect/test/Queue.test.ts:13–15  ·  view source on GitHub ↗
(ref: Effect.Effect<A>, value: A)

Source from the content-addressed store, hash-verified

11import { Array, Cause, Chunk, Deferred, Effect, Exit, Fiber, identity, pipe, Queue, Ref } from "effect"
12
13export const waitForValue = <A>(ref: Effect.Effect<A>, value: A): Effect.Effect<A> => {
14 return ref.pipe(Effect.zipLeft(Effect.yieldNow()), Effect.repeat({ until: (a) => value === a }))
15}
16
17export const waitForSize = <A>(queue: Queue.Queue<A>, size: number): Effect.Effect<number> => {
18 return waitForValue(Queue.size(queue), size)

Callers 1

waitForSizeFunction · 0.85

Calls 1

pipeMethod · 0.65

Tested by

no test coverage detected