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

Function onDecision

packages/effect/src/internal/channel.ts:1627–1667  ·  view source on GitHub ↗
(
            decision: MergeDecision.MergeDecision<
              Env | Env1,
              Err2,
              Done2,
              OutErr2 | OutErr3,
              OutDone2 | OutDone3
            >
          )

Source from the content-addressed store, hash-verified

1625 Env | Env1
1626 > => {
1627 function onDecision(
1628 decision: MergeDecision.MergeDecision<
1629 Env | Env1,
1630 Err2,
1631 Done2,
1632 OutErr2 | OutErr3,
1633 OutDone2 | OutDone3
1634 >
1635 ): Effect.Effect<
1636 Channel.Channel<
1637 OutElem | OutElem1,
1638 unknown,
1639 OutErr2 | OutErr3,
1640 unknown,
1641 OutDone2 | OutDone3,
1642 unknown,
1643 Env | Env1
1644 >
1645 > {
1646 const op = decision as mergeDecision.Primitive
1647 if (op._tag === MergeDecisionOpCodes.OP_DONE) {
1648 return Effect.succeed(
1649 core.fromEffect(
1650 Effect.zipRight(
1651 Fiber.interrupt(fiber),
1652 op.effect
1653 )
1654 )
1655 )
1656 }
1657 return Effect.map(
1658 Fiber.await(fiber),
1659 Exit.match({
1660 onFailure: (cause) => core.fromEffect(op.f(Exit.failCause(cause))),
1661 onSuccess: Either.match({
1662 onLeft: (done) => core.fromEffect(op.f(Exit.succeed(done))),
1663 onRight: (elem) => zipRight(core.write(elem), go(single(op.f)))
1664 })
1665 })
1666 )
1667 }
1668
1669 return Exit.match(exit, {
1670 onFailure: (cause) => onDecision(done(Exit.failCause(cause))),

Callers 1

handleSideFunction · 0.85

Calls 10

fromEffectMethod · 0.80
failCauseMethod · 0.80
goFunction · 0.70
mapMethod · 0.65
fMethod · 0.65
writeMethod · 0.65
zipRightFunction · 0.50
singleFunction · 0.50
interruptMethod · 0.45
awaitMethod · 0.45

Tested by

no test coverage detected