MCPcopy Create free account
hub / github.com/effect-app/libs / callbackArray

Function callbackArray

repos/effect/packages/effect/src/Channel.ts:510–517  ·  view source on GitHub ↗
(
  f: (queue: Queue.Queue<A, E | Cause.Done>) => Effect.Effect<unknown, E, R | Scope.Scope>,
  options?: {
    readonly bufferSize?: number | undefined
    readonly strategy?: "sliding" | "dropping" | "suspend" | undefined
  }
)

Source from the content-addressed store, hash-verified

508 *
509 * **Example** (Creating array channels from callbacks)
510 *
511 * ```ts import.meta.vitest
512 * import { Channel, Effect, Queue } from "effect"
513 *
514 * const channel = Channel.callbackArray<number>(Effect.fn(function*(queue) {
515 * yield* Queue.offer(queue, 1)
516 * yield* Queue.offer(queue, 2)
517 * yield* Queue.end(queue)
518 * }))
519 * await Effect.runPromise(Channel.runCollect(channel)) // => [[1, 2]]
520 * ```

Callers

nothing calls this directly

Calls 3

asyncQueueFunction · 0.85
fromTransformFunction · 0.70
mapMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…