MCPcopy
hub / github.com/Effect-TS/effect / evaluate

Method evaluate

packages/effect/src/Micro.ts:513–538  ·  view source on GitHub ↗
(effect: Primitive)

Source from the content-addressed store, hash-verified

511 }
512
513 evaluate(effect: Primitive): void {
514 if (this._exit) {
515 return
516 } else if (this._yielded !== undefined) {
517 const yielded = this._yielded as () => void
518 this._yielded = undefined
519 yielded()
520 }
521 const exit = this.runLoop(effect)
522 if (exit === Yield) {
523 return
524 }
525
526 // the interruptChildren middlware is added in Micro.fork, so it can be
527 // tree-shaken if not used
528 const interruptChildren = fiberMiddleware.interruptChildren && fiberMiddleware.interruptChildren(this)
529 if (interruptChildren !== undefined) {
530 return this.evaluate(flatMap(interruptChildren, () => exit) as any)
531 }
532
533 this._exit = exit
534 for (let i = 0; i < this._observers.length; i++) {
535 this._observers[i](exit)
536 }
537 this._observers.length = 0
538 }
539
540 runLoop(effect: Primitive): MicroExit<A, E> | Yield {
541 let yielding = false

Callers 3

unsafeInterruptMethod · 0.95
unsafeForkFunction · 0.95
runForkFunction · 0.95

Calls 1

runLoopMethod · 0.95

Tested by

no test coverage detected