MCPcopy Create free account
hub / github.com/Effect-TS/effect / makePull

Function makePull

packages/effect/src/Channel.ts:3406–3418  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3404 Effect.sync(() => {
3405 let currentPull: Pull.Pull<OutElem, E, OutDone2, Env | R> | undefined
3406 const makePull = (): Pull.Pull<OutElem, E, OutDone2, Env | R> => {
3407 const runScope = Scope.forkUnsafe(scope)
3408 return Effect.flatMap(toTransform(self)(upstream, runScope), (pull) => {
3409 currentPull = Effect.catchCause(pull, (cause) => {
3410 const exit = Pull.doneExitFromCause(cause) as Exit.Exit<OutDone, OutErr>
3411 return Scope.close(runScope, exit).pipe(
3412 Effect.flatMap(() => onExit(exit, scope)),
3413 Effect.flatMap(makePull)
3414 )
3415 })
3416 return currentPull
3417 })
3418 }
3419 return Effect.suspend(() => currentPull ?? makePull())
3420 })
3421 )

Callers 1

repeatLoopFunction · 0.70

Calls 4

toTransformFunction · 0.85
onExitFunction · 0.70
pipeMethod · 0.65
closeMethod · 0.65

Tested by

no test coverage detected