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

Function flatMapConcurrent

repos/effect/packages/effect/src/Channel.ts:2359–2389  ·  view source on GitHub ↗
(
  self: Channel<OutElem, OutErr, OutDone, InElem, InErr, InDone, Env>,
  f: (d: OutElem) => Channel<OutElem1, OutErr1, OutDone1, InElem1, InErr1, InDone1, Env1>,
  options: {
    readonly concurrency: number | "unbounded"
    readonly bufferSize?: number | undefined
  }
)

Source from the content-addressed store, hash-verified

2357 * // FlatMap each number to create new channels
2358 * const flatMappedChannel = Channel.flatMap(
2359 * numberChannel,
2360 * (n) =>
2361 * Channel.fromIterable(Array.from({ length: n }, (_, i) => `item-${n}-${i}`))
2362 * )
2363 *
2364 * Effect.runSync(Channel.runCollect(flatMappedChannel)) // => ["item-1-0", "item-2-0", "item-2-1", "item-3-0", "item-3-1", "item-3-2"]
2365 * ```
2366 *
2367 * @category sequencing
2368 * @since 2.0.0
2369 */
2370export const flatMap: {
2371 <OutElem, OutElem1, OutErr1, OutDone1, InElem1, InErr1, InDone1, Env1>(
2372 f: (d: OutElem) => Channel<OutElem1, OutErr1, OutDone1, InElem1, InErr1, InDone1, Env1>,
2373 options?: {
2374 readonly concurrency?: number | "unbounded" | undefined
2375 readonly bufferSize?: number | undefined
2376 }
2377 ): <OutErr, OutDone, InElem, InErr, InDone, Env>(
2378 self: Channel<OutElem, OutErr, OutDone, InElem, InErr, InDone, Env>
2379 ) => Channel<
2380 OutElem1,
2381 OutErr1 | OutErr,
2382 OutDone,
2383 InElem & InElem1,
2384 InErr & InErr1,
2385 InDone & InDone1,
2386 Env1 | Env
2387 >
2388 <
2389 OutElem,
2390 OutErr,
2391 OutDone,
2392 InElem,

Callers 1

Channel.tsFile · 0.85

Calls 3

mergeAllFunction · 0.70
pipeMethod · 0.65
mapFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…