MCPcopy Index your code
hub / github.com/Effect-TS/effect / merge

Function merge

packages/effect/src/internal/channel.ts:1568–1819  ·  view source on GitHub ↗
(scope: Scope.Scope)

Source from the content-addressed store, hash-verified

1566 Env1 | Env
1567> => {
1568 function merge(scope: Scope.Scope) {
1569 return Effect.gen(function*() {
1570 type State = MergeState.MergeState<
1571 Env | Env1,
1572 OutErr,
1573 OutErr1,
1574 OutErr2 | OutErr3,
1575 OutElem | OutElem1,
1576 OutDone,
1577 OutDone1,
1578 OutDone2 | OutDone3
1579 >
1580
1581 const input = yield* singleProducerAsyncInput.make<
1582 InErr & InErr1,
1583 InElem & InElem1,
1584 InDone & InDone1
1585 >()
1586 const queueReader = fromInput(input)
1587 const pullL = yield* toPullIn(core.pipeTo(queueReader, self), scope)
1588 const pullR = yield* toPullIn(core.pipeTo(queueReader, options.other), scope)
1589
1590 function handleSide<Err, Done, Err2, Done2>(
1591 exit: Exit.Exit<Either.Either<OutElem | OutElem1, Done>, Err>,
1592 fiber: Fiber.Fiber<Either.Either<OutElem | OutElem1, Done2>, Err2>,
1593 pull: Effect.Effect<Either.Either<OutElem | OutElem1, Done>, Err, Env | Env1>
1594 ) {
1595 return (
1596 done: (
1597 ex: Exit.Exit<Done, Err>
1598 ) => MergeDecision.MergeDecision<
1599 Env | Env1,
1600 Err2,
1601 Done2,
1602 OutErr2 | OutErr3,
1603 OutDone2 | OutDone3
1604 >,
1605 both: (
1606 f1: Fiber.Fiber<Either.Either<OutElem | OutElem1, Done>, Err>,
1607 f2: Fiber.Fiber<Either.Either<OutElem | OutElem1, Done2>, Err2>
1608 ) => State,
1609 single: (
1610 f: (
1611 ex: Exit.Exit<Done2, Err2>
1612 ) => Effect.Effect<OutDone2 | OutDone3, OutErr2 | OutErr3, Env | Env1>
1613 ) => State
1614 ): Effect.Effect<
1615 Channel.Channel<
1616 OutElem | OutElem1,
1617 unknown,
1618 OutErr2 | OutErr3,
1619 unknown,
1620 OutDone2 | OutDone3,
1621 unknown,
1622 Env | Env1
1623 >,
1624 never,
1625 Env | Env1

Callers

nothing calls this directly

Calls 6

fromEffectMethod · 0.80
transferChildrenMethod · 0.80
scopeMethod · 0.80
fromInputFunction · 0.70
makeMethod · 0.65
pipeMethod · 0.65

Tested by

no test coverage detected