@fncts/io 0.0.47 → 0.0.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Cached/api.d.ts +1 -1
- package/Channel/api.d.ts +80 -80
- package/Channel/core-api.d.ts +26 -26
- package/Console/definition.d.ts +1 -0
- package/CountdownLatch.d.ts +1 -0
- package/Fiber/FiberMessage.d.ts +6 -28
- package/Fiber/FiberRuntime.d.ts +108 -77
- package/Fiber/api/interruptAs.d.ts +2 -2
- package/Fiber/definition.d.ts +2 -0
- package/FiberScope/definition.d.ts +3 -0
- package/FiberSet.d.ts +2 -1
- package/Future/State.d.ts +59 -0
- package/Future/api.d.ts +8 -3
- package/Future/constructors.d.ts +1 -1
- package/Future/definition.d.ts +1 -17
- package/Future.d.ts +1 -0
- package/Hub/api.d.ts +15 -15
- package/IO/api/array.d.ts +22 -0
- package/IO/api/awaitAllChildren.d.ts +6 -0
- package/IO/api/cachedInvalidate.d.ts +15 -0
- package/IO/api/forkDaemon.d.ts +1 -1
- package/IO/api/onTermination.d.ts +1 -2
- package/IO/api/transplant.d.ts +11 -1
- package/IO/api.d.ts +247 -225
- package/IO/definition.d.ts +12 -25
- package/IO.d.ts +3 -1
- package/Random/definition.d.ts +1 -0
- package/Ref/Synchronized/api.d.ts +1 -1
- package/Semaphore/Reservation.d.ts +15 -0
- package/Semaphore/constructors.d.ts +13 -0
- package/Semaphore/definition.d.ts +29 -0
- package/Semaphore.d.ts +3 -40
- package/Stream/api.d.ts +164 -164
- package/_cjs/Cached/api.cjs +1 -2
- package/_cjs/Cached/api.cjs.map +1 -1
- package/_cjs/Cached/internal.cjs +1 -2
- package/_cjs/Cached/internal.cjs.map +1 -1
- package/_cjs/Channel/api/interruptWhen.cjs +1 -2
- package/_cjs/Channel/api/interruptWhen.cjs.map +1 -1
- package/_cjs/Channel/api/mapOutConcurrentIO.cjs +2 -3
- package/_cjs/Channel/api/mapOutConcurrentIO.cjs.map +1 -1
- package/_cjs/Channel/api/mergeAll.cjs +1 -2
- package/_cjs/Channel/api/mergeAll.cjs.map +1 -1
- package/_cjs/Channel/api/mergeAllUnboundedWith.cjs +1 -2
- package/_cjs/Channel/api/mergeAllUnboundedWith.cjs.map +1 -1
- package/_cjs/Channel/api/mergeAllWith.cjs +2 -3
- package/_cjs/Channel/api/mergeAllWith.cjs.map +1 -1
- package/_cjs/Channel/api/mergeMap.cjs +1 -2
- package/_cjs/Channel/api/mergeMap.cjs.map +1 -1
- package/_cjs/Channel/api/mergeWith.cjs +1 -2
- package/_cjs/Channel/api/mergeWith.cjs.map +1 -1
- package/_cjs/Channel/api/run.cjs +1 -2
- package/_cjs/Channel/api/run.cjs.map +1 -1
- package/_cjs/Channel/api/runCollect.cjs +1 -2
- package/_cjs/Channel/api/runCollect.cjs.map +1 -1
- package/_cjs/Channel/api/runDrain.cjs +1 -2
- package/_cjs/Channel/api/runDrain.cjs.map +1 -1
- package/_cjs/Channel/api/runScoped.cjs +3 -4
- package/_cjs/Channel/api/runScoped.cjs.map +1 -1
- package/_cjs/Channel/api/toPull.cjs +2 -3
- package/_cjs/Channel/api/toPull.cjs.map +1 -1
- package/_cjs/Channel/api/zipConcurrent.cjs +1 -2
- package/_cjs/Channel/api/zipConcurrent.cjs.map +1 -1
- package/_cjs/Channel/api.cjs +206 -207
- package/_cjs/Channel/api.cjs.map +1 -1
- package/_cjs/Channel/core-api.cjs +43 -42
- package/_cjs/Channel/core-api.cjs.map +1 -1
- package/_cjs/Channel/internal/AsyncInputConsumer.cjs +0 -4
- package/_cjs/Channel/internal/AsyncInputProducer.cjs +0 -4
- package/_cjs/Channel/internal/ChannelExecutor.cjs +4 -5
- package/_cjs/Channel/internal/ChannelExecutor.cjs.map +1 -1
- package/_cjs/Channel/internal/ChannelState.cjs +1 -2
- package/_cjs/Channel/internal/ChannelState.cjs.map +1 -1
- package/_cjs/Channel/internal/SingleProducerAsyncInput.cjs +1 -2
- package/_cjs/Channel/internal/SingleProducerAsyncInput.cjs.map +1 -1
- package/_cjs/Clock/api.cjs +1 -2
- package/_cjs/Clock/api.cjs.map +1 -1
- package/_cjs/Clock/definition.cjs +1 -2
- package/_cjs/Clock/definition.cjs.map +1 -1
- package/_cjs/Clock/live.cjs +1 -2
- package/_cjs/Clock/live.cjs.map +1 -1
- package/_cjs/Console/api.cjs +1 -2
- package/_cjs/Console/api.cjs.map +1 -1
- package/_cjs/Console/definition.cjs +2 -2
- package/_cjs/Console/definition.cjs.map +1 -1
- package/_cjs/Console/live.cjs +1 -2
- package/_cjs/Console/live.cjs.map +1 -1
- package/_cjs/CountdownLatch.cjs +3 -3
- package/_cjs/CountdownLatch.cjs.map +1 -1
- package/_cjs/Differ/api.cjs +1 -2
- package/_cjs/Differ/api.cjs.map +1 -1
- package/_cjs/Fiber/FiberMessage.cjs +3 -24
- package/_cjs/Fiber/FiberMessage.cjs.map +1 -1
- package/_cjs/Fiber/FiberRuntime.cjs +879 -636
- package/_cjs/Fiber/FiberRuntime.cjs.map +1 -1
- package/_cjs/Fiber/api/awaitAll.cjs +1 -2
- package/_cjs/Fiber/api/awaitAll.cjs.map +1 -1
- package/_cjs/Fiber/api/collectAll.cjs +2 -3
- package/_cjs/Fiber/api/collectAll.cjs.map +1 -1
- package/_cjs/Fiber/api/fromIO.cjs +1 -2
- package/_cjs/Fiber/api/fromIO.cjs.map +1 -1
- package/_cjs/Fiber/api/interrupt.cjs +2 -3
- package/_cjs/Fiber/api/interrupt.cjs.map +1 -1
- package/_cjs/Fiber/api/interruptAll.cjs +2 -3
- package/_cjs/Fiber/api/interruptAll.cjs.map +1 -1
- package/_cjs/Fiber/api/interruptAs.cjs +5 -10
- package/_cjs/Fiber/api/interruptAs.cjs.map +1 -1
- package/_cjs/Fiber/api/interruptFork.cjs +2 -3
- package/_cjs/Fiber/api/interruptFork.cjs.map +1 -1
- package/_cjs/Fiber/api/join.cjs +1 -2
- package/_cjs/Fiber/api/join.cjs.map +1 -1
- package/_cjs/Fiber/api/joinAll.cjs +1 -2
- package/_cjs/Fiber/api/joinAll.cjs.map +1 -1
- package/_cjs/Fiber/api/mapFiber.cjs +1 -2
- package/_cjs/Fiber/api/mapFiber.cjs.map +1 -1
- package/_cjs/Fiber/api/mapIO.cjs +2 -3
- package/_cjs/Fiber/api/mapIO.cjs.map +1 -1
- package/_cjs/Fiber/api/zipWith.cjs +2 -3
- package/_cjs/Fiber/api/zipWith.cjs.map +1 -1
- package/_cjs/Fiber/constructors.cjs +2 -3
- package/_cjs/Fiber/constructors.cjs.map +1 -1
- package/_cjs/Fiber/definition.cjs +6 -4
- package/_cjs/Fiber/definition.cjs.map +1 -1
- package/_cjs/FiberRef/api/locallyScoped.cjs +1 -2
- package/_cjs/FiberRef/api/locallyScoped.cjs.map +1 -1
- package/_cjs/FiberRef/api/locallyScopedWith.cjs +1 -2
- package/_cjs/FiberRef/api/locallyScopedWith.cjs.map +1 -1
- package/_cjs/FiberRef/constructors.cjs +1 -2
- package/_cjs/FiberRef/constructors.cjs.map +1 -1
- package/_cjs/FiberRef/definition.cjs +1 -2
- package/_cjs/FiberRef/definition.cjs.map +1 -1
- package/_cjs/FiberRef/operations.cjs +1 -2
- package/_cjs/FiberRef/operations.cjs.map +1 -1
- package/_cjs/FiberRef/unsafe.cjs +1 -2
- package/_cjs/FiberRef/unsafe.cjs.map +1 -1
- package/_cjs/FiberRefs/Patch.cjs +1 -2
- package/_cjs/FiberRefs/Patch.cjs.map +1 -1
- package/_cjs/FiberRefs/api.cjs +1 -2
- package/_cjs/FiberRefs/api.cjs.map +1 -1
- package/_cjs/FiberRefs/definition.cjs +1 -2
- package/_cjs/FiberRefs/definition.cjs.map +1 -1
- package/_cjs/FiberScope/definition.cjs +29 -6
- package/_cjs/FiberScope/definition.cjs.map +1 -1
- package/_cjs/FiberSet.cjs +16 -15
- package/_cjs/FiberSet.cjs.map +1 -1
- package/_cjs/FiberStatus/definition.cjs +1 -2
- package/_cjs/FiberStatus/definition.cjs.map +1 -1
- package/_cjs/Future/State.cjs +108 -0
- package/_cjs/Future/State.cjs.map +1 -0
- package/_cjs/Future/api.cjs +71 -64
- package/_cjs/Future/api.cjs.map +1 -1
- package/_cjs/Future/constructors.cjs +3 -4
- package/_cjs/Future/constructors.cjs.map +1 -1
- package/_cjs/Future/definition.cjs +1 -15
- package/_cjs/Future/definition.cjs.map +1 -1
- package/_cjs/Future.cjs +11 -0
- package/_cjs/Future.cjs.map +1 -1
- package/_cjs/Hub/api.cjs +56 -57
- package/_cjs/Hub/api.cjs.map +1 -1
- package/_cjs/Hub/internal.cjs +1 -2
- package/_cjs/Hub/internal.cjs.map +1 -1
- package/_cjs/IO/api/acquireRelease.cjs +1 -2
- package/_cjs/IO/api/acquireRelease.cjs.map +1 -1
- package/_cjs/IO/api/acquireReleaseExit.cjs +1 -2
- package/_cjs/IO/api/acquireReleaseExit.cjs.map +1 -1
- package/_cjs/IO/api/acquireReleaseInterruptible.cjs +1 -2
- package/_cjs/IO/api/acquireReleaseInterruptible.cjs.map +1 -1
- package/_cjs/IO/api/acquireReleaseInterruptibleExit.cjs +1 -2
- package/_cjs/IO/api/acquireReleaseInterruptibleExit.cjs.map +1 -1
- package/_cjs/IO/api/addFinalizer.cjs +1 -2
- package/_cjs/IO/api/addFinalizer.cjs.map +1 -1
- package/_cjs/IO/api/addFinalizerExit.cjs +1 -2
- package/_cjs/IO/api/addFinalizerExit.cjs.map +1 -1
- package/_cjs/IO/api/all.cjs +1 -2
- package/_cjs/IO/api/all.cjs.map +1 -1
- package/_cjs/IO/api/array.cjs +51 -0
- package/_cjs/IO/api/array.cjs.map +1 -0
- package/_cjs/IO/api/asyncIO.cjs +1 -2
- package/_cjs/IO/api/asyncIO.cjs.map +1 -1
- package/_cjs/IO/api/asyncInterrupt.cjs +1 -2
- package/_cjs/IO/api/asyncInterrupt.cjs.map +1 -1
- package/_cjs/IO/api/awaitAllChildren.cjs +17 -0
- package/_cjs/IO/api/awaitAllChildren.cjs.map +1 -0
- package/_cjs/IO/api/blocking.cjs +1 -2
- package/_cjs/IO/api/blocking.cjs.map +1 -1
- package/_cjs/IO/api/bracket.cjs +1 -2
- package/_cjs/IO/api/bracket.cjs.map +1 -1
- package/_cjs/IO/api/bracketExit.cjs +1 -2
- package/_cjs/IO/api/bracketExit.cjs.map +1 -1
- package/_cjs/IO/api/cachedInvalidate.cjs +47 -0
- package/_cjs/IO/api/cachedInvalidate.cjs.map +1 -0
- package/_cjs/IO/api/clockWith.cjs +1 -2
- package/_cjs/IO/api/clockWith.cjs.map +1 -1
- package/_cjs/IO/api/concurrency.cjs +1 -2
- package/_cjs/IO/api/concurrency.cjs.map +1 -1
- package/_cjs/IO/api/concurrentFinalizers.cjs +1 -2
- package/_cjs/IO/api/concurrentFinalizers.cjs.map +1 -1
- package/_cjs/IO/api/consoleWith.cjs +1 -2
- package/_cjs/IO/api/consoleWith.cjs.map +1 -1
- package/_cjs/IO/api/daemonChildren.cjs +1 -2
- package/_cjs/IO/api/daemonChildren.cjs.map +1 -1
- package/_cjs/IO/api/delay.cjs +1 -2
- package/_cjs/IO/api/delay.cjs.map +1 -1
- package/_cjs/IO/api/descriptor.cjs +1 -2
- package/_cjs/IO/api/descriptor.cjs.map +1 -1
- package/_cjs/IO/api/diffFiberRefs.cjs +1 -2
- package/_cjs/IO/api/diffFiberRefs.cjs.map +1 -1
- package/_cjs/IO/api/disconnect.cjs +2 -3
- package/_cjs/IO/api/disconnect.cjs.map +1 -1
- package/_cjs/IO/api/ensuringChildren.cjs +1 -2
- package/_cjs/IO/api/ensuringChildren.cjs.map +1 -1
- package/_cjs/IO/api/environment.cjs +1 -2
- package/_cjs/IO/api/environment.cjs.map +1 -1
- package/_cjs/IO/api/foreachConcurrent.cjs +36 -30
- package/_cjs/IO/api/foreachConcurrent.cjs.map +1 -1
- package/_cjs/IO/api/foreachExec.cjs +1 -2
- package/_cjs/IO/api/foreachExec.cjs.map +1 -1
- package/_cjs/IO/api/fork.cjs +2 -3
- package/_cjs/IO/api/fork.cjs.map +1 -1
- package/_cjs/IO/api/forkAll.cjs +1 -2
- package/_cjs/IO/api/forkAll.cjs.map +1 -1
- package/_cjs/IO/api/forkDaemon.cjs +5 -6
- package/_cjs/IO/api/forkDaemon.cjs.map +1 -1
- package/_cjs/IO/api/forkIn.cjs +1 -2
- package/_cjs/IO/api/forkIn.cjs.map +1 -1
- package/_cjs/IO/api/forkScoped.cjs +1 -2
- package/_cjs/IO/api/forkScoped.cjs.map +1 -1
- package/_cjs/IO/api/fulfill.cjs +1 -2
- package/_cjs/IO/api/fulfill.cjs.map +1 -1
- package/_cjs/IO/api/interrupt.cjs +4 -5
- package/_cjs/IO/api/interrupt.cjs.map +1 -1
- package/_cjs/IO/api/memoize.cjs +1 -2
- package/_cjs/IO/api/memoize.cjs.map +1 -1
- package/_cjs/IO/api/onTermination.cjs +2 -3
- package/_cjs/IO/api/onTermination.cjs.map +1 -1
- package/_cjs/IO/api/once.cjs +1 -2
- package/_cjs/IO/api/once.cjs.map +1 -1
- package/_cjs/IO/api/patchFiberRefs.cjs +1 -2
- package/_cjs/IO/api/patchFiberRefs.cjs.map +1 -1
- package/_cjs/IO/api/provideLayer.cjs +1 -2
- package/_cjs/IO/api/provideLayer.cjs.map +1 -1
- package/_cjs/IO/api/provideScope.cjs +1 -2
- package/_cjs/IO/api/provideScope.cjs.map +1 -1
- package/_cjs/IO/api/provideSomeLayer.cjs +1 -2
- package/_cjs/IO/api/provideSomeLayer.cjs.map +1 -1
- package/_cjs/IO/api/provideSomeRuntime.cjs +1 -2
- package/_cjs/IO/api/provideSomeRuntime.cjs.map +1 -1
- package/_cjs/IO/api/race.cjs +2 -3
- package/_cjs/IO/api/race.cjs.map +1 -1
- package/_cjs/IO/api/raceFirst.cjs +1 -2
- package/_cjs/IO/api/raceFirst.cjs.map +1 -1
- package/_cjs/IO/api/raceWith.cjs +1 -2
- package/_cjs/IO/api/raceWith.cjs.map +1 -1
- package/_cjs/IO/api/randomWith.cjs +1 -2
- package/_cjs/IO/api/randomWith.cjs.map +1 -1
- package/_cjs/IO/api/repeat.cjs +1 -2
- package/_cjs/IO/api/repeat.cjs.map +1 -1
- package/_cjs/IO/api/retry.cjs +1 -2
- package/_cjs/IO/api/retry.cjs.map +1 -1
- package/_cjs/IO/api/schedule.cjs +1 -2
- package/_cjs/IO/api/schedule.cjs.map +1 -1
- package/_cjs/IO/api/scope.cjs +1 -2
- package/_cjs/IO/api/scope.cjs.map +1 -1
- package/_cjs/IO/api/scopeWith.cjs +1 -2
- package/_cjs/IO/api/scopeWith.cjs.map +1 -1
- package/_cjs/IO/api/scoped.cjs +1 -2
- package/_cjs/IO/api/scoped.cjs.map +1 -1
- package/_cjs/IO/api/sleep.cjs +1 -2
- package/_cjs/IO/api/sleep.cjs.map +1 -1
- package/_cjs/IO/api/stateful.cjs +1 -2
- package/_cjs/IO/api/stateful.cjs.map +1 -1
- package/_cjs/IO/api/supervised.cjs +1 -2
- package/_cjs/IO/api/supervised.cjs.map +1 -1
- package/_cjs/IO/api/timeout.cjs +9 -11
- package/_cjs/IO/api/timeout.cjs.map +1 -1
- package/_cjs/IO/api/transplant.cjs +22 -7
- package/_cjs/IO/api/transplant.cjs.map +1 -1
- package/_cjs/IO/api/whenFiberRef.cjs +1 -2
- package/_cjs/IO/api/whenFiberRef.cjs.map +1 -1
- package/_cjs/IO/api/whenRef.cjs +1 -2
- package/_cjs/IO/api/whenRef.cjs.map +1 -1
- package/_cjs/IO/api/withChildren.cjs +1 -2
- package/_cjs/IO/api/withChildren.cjs.map +1 -1
- package/_cjs/IO/api/withEarlyRelease.cjs +1 -2
- package/_cjs/IO/api/withEarlyRelease.cjs.map +1 -1
- package/_cjs/IO/api/withFinalizer.cjs +1 -2
- package/_cjs/IO/api/withFinalizer.cjs.map +1 -1
- package/_cjs/IO/api/withFinalizerExit.cjs +1 -2
- package/_cjs/IO/api/withFinalizerExit.cjs.map +1 -1
- package/_cjs/IO/api/zipConcurrent.cjs +5 -6
- package/_cjs/IO/api/zipConcurrent.cjs.map +1 -1
- package/_cjs/IO/api.cjs +522 -473
- package/_cjs/IO/api.cjs.map +1 -1
- package/_cjs/IO/definition.cjs +2 -3
- package/_cjs/IO/definition.cjs.map +1 -1
- package/_cjs/IO/runtime.cjs +9 -10
- package/_cjs/IO/runtime.cjs.map +1 -1
- package/_cjs/IO.cjs +33 -11
- package/_cjs/IO.cjs.map +1 -1
- package/_cjs/IOEnv/definition.cjs +1 -2
- package/_cjs/IOEnv/definition.cjs.map +1 -1
- package/_cjs/IOEnv/live.cjs +1 -2
- package/_cjs/IOEnv/live.cjs.map +1 -1
- package/_cjs/IOEnv/services.cjs +1 -2
- package/_cjs/IOEnv/services.cjs.map +1 -1
- package/_cjs/Layer/MemoMap.cjs +1 -2
- package/_cjs/Layer/MemoMap.cjs.map +1 -1
- package/_cjs/Layer/api.cjs +1 -2
- package/_cjs/Layer/api.cjs.map +1 -1
- package/_cjs/Logger/api.cjs +1 -2
- package/_cjs/Logger/api.cjs.map +1 -1
- package/_cjs/Logger/constructors.cjs +1 -2
- package/_cjs/Logger/constructors.cjs.map +1 -1
- package/_cjs/MVar/api.cjs +1 -2
- package/_cjs/MVar/api.cjs.map +1 -1
- package/_cjs/Push/api.cjs +2 -3
- package/_cjs/Push/api.cjs.map +1 -1
- package/_cjs/Push/internal.cjs +1 -2
- package/_cjs/Push/internal.cjs.map +1 -1
- package/_cjs/Queue/api/dimapIO.cjs +1 -2
- package/_cjs/Queue/api/dimapIO.cjs.map +1 -1
- package/_cjs/Queue/api/filterInputIO.cjs +1 -2
- package/_cjs/Queue/api/filterInputIO.cjs.map +1 -1
- package/_cjs/Queue/api/filterOutputIO.cjs +1 -2
- package/_cjs/Queue/api/filterOutputIO.cjs.map +1 -1
- package/_cjs/Queue/api/poll.cjs +1 -2
- package/_cjs/Queue/api/poll.cjs.map +1 -1
- package/_cjs/Queue/api/takeBetween.cjs +1 -2
- package/_cjs/Queue/api/takeBetween.cjs.map +1 -1
- package/_cjs/Queue/api/takeN.cjs +1 -2
- package/_cjs/Queue/api/takeN.cjs.map +1 -1
- package/_cjs/Queue/api/zipWithIO.cjs +1 -2
- package/_cjs/Queue/api/zipWithIO.cjs.map +1 -1
- package/_cjs/Queue/constructors.cjs +1 -2
- package/_cjs/Queue/constructors.cjs.map +1 -1
- package/_cjs/Queue/internal.cjs +1 -2
- package/_cjs/Queue/internal.cjs.map +1 -1
- package/_cjs/Queue/strategy.cjs +1 -2
- package/_cjs/Queue/strategy.cjs.map +1 -1
- package/_cjs/Random/api.cjs +1 -2
- package/_cjs/Random/api.cjs.map +1 -1
- package/_cjs/Random/definition.cjs +2 -2
- package/_cjs/Random/definition.cjs.map +1 -1
- package/_cjs/Random/live.cjs +1 -2
- package/_cjs/Random/live.cjs.map +1 -1
- package/_cjs/Ref/Atomic.cjs +1 -2
- package/_cjs/Ref/Atomic.cjs.map +1 -1
- package/_cjs/Ref/Derived.cjs +1 -2
- package/_cjs/Ref/Derived.cjs.map +1 -1
- package/_cjs/Ref/DerivedAll.cjs +1 -2
- package/_cjs/Ref/DerivedAll.cjs.map +1 -1
- package/_cjs/Ref/Synchronized/api.cjs +2 -3
- package/_cjs/Ref/Synchronized/api.cjs.map +1 -1
- package/_cjs/Ref/Synchronized/constructors.cjs +2 -3
- package/_cjs/Ref/Synchronized/constructors.cjs.map +1 -1
- package/_cjs/Ref/Synchronized/definition.cjs +2 -3
- package/_cjs/Ref/Synchronized/definition.cjs.map +1 -1
- package/_cjs/Ref/api/collect.cjs +1 -2
- package/_cjs/Ref/api/collect.cjs.map +1 -1
- package/_cjs/Ref/api/dimap.cjs +1 -2
- package/_cjs/Ref/api/dimap.cjs.map +1 -1
- package/_cjs/Ref/api/filter.cjs +1 -2
- package/_cjs/Ref/api/filter.cjs.map +1 -1
- package/_cjs/Ref/api/modify.cjs +1 -2
- package/_cjs/Ref/api/modify.cjs.map +1 -1
- package/_cjs/Ref/api.cjs +1 -2
- package/_cjs/Ref/api.cjs.map +1 -1
- package/_cjs/Ref/constructors.cjs +1 -2
- package/_cjs/Ref/constructors.cjs.map +1 -1
- package/_cjs/RefSubject/Atomic.cjs +1 -2
- package/_cjs/RefSubject/Atomic.cjs.map +1 -1
- package/_cjs/RefSubject/Synchronized/api.cjs +1 -2
- package/_cjs/RefSubject/Synchronized/api.cjs.map +1 -1
- package/_cjs/RefSubject/Synchronized/definition.cjs +1 -2
- package/_cjs/RefSubject/Synchronized/definition.cjs.map +1 -1
- package/_cjs/RefSubject/api.cjs +1 -2
- package/_cjs/RefSubject/api.cjs.map +1 -1
- package/_cjs/Reloadable/api.cjs +1 -2
- package/_cjs/Reloadable/api.cjs.map +1 -1
- package/_cjs/Reloadable/constructors.cjs +1 -2
- package/_cjs/Reloadable/constructors.cjs.map +1 -1
- package/_cjs/Reloadable/definition.cjs +1 -2
- package/_cjs/Reloadable/definition.cjs.map +1 -1
- package/_cjs/RuntimeFlag.cjs +0 -4
- package/_cjs/RuntimeFlags/Patch.cjs +1 -2
- package/_cjs/RuntimeFlags/Patch.cjs.map +1 -1
- package/_cjs/RuntimeFlags/RuntimeFlags.cjs +1 -2
- package/_cjs/RuntimeFlags/RuntimeFlags.cjs.map +1 -1
- package/_cjs/STM/api/atomically.cjs +1 -2
- package/_cjs/STM/api/atomically.cjs.map +1 -1
- package/_cjs/STM/api/core-api.cjs +1 -2
- package/_cjs/STM/api/core-api.cjs.map +1 -1
- package/_cjs/STM/api.cjs +1 -2
- package/_cjs/STM/api.cjs.map +1 -1
- package/_cjs/STM/definition.cjs +2 -3
- package/_cjs/STM/definition.cjs.map +1 -1
- package/_cjs/STM/driver.cjs +1 -2
- package/_cjs/STM/driver.cjs.map +1 -1
- package/_cjs/STM/internal/CommitState.cjs +1 -2
- package/_cjs/STM/internal/CommitState.cjs.map +1 -1
- package/_cjs/STM/internal/Journal.cjs +1 -2
- package/_cjs/STM/internal/Journal.cjs.map +1 -1
- package/_cjs/Schedule/Decision.cjs +1 -2
- package/_cjs/Schedule/Decision.cjs.map +1 -1
- package/_cjs/Schedule/api/driver.cjs +1 -2
- package/_cjs/Schedule/api/driver.cjs.map +1 -1
- package/_cjs/Schedule/api.cjs +1 -2
- package/_cjs/Schedule/api.cjs.map +1 -1
- package/_cjs/Scope/Finalizer/definition.cjs +1 -2
- package/_cjs/Scope/Finalizer/definition.cjs.map +1 -1
- package/_cjs/Scope/ReleaseMap/api/releaseAll.cjs +1 -2
- package/_cjs/Scope/ReleaseMap/api/releaseAll.cjs.map +1 -1
- package/_cjs/Scope/ReleaseMap/api.cjs +1 -2
- package/_cjs/Scope/ReleaseMap/api.cjs.map +1 -1
- package/_cjs/Scope/ReleaseMap/constructors.cjs +1 -2
- package/_cjs/Scope/ReleaseMap/constructors.cjs.map +1 -1
- package/_cjs/Scope/ReleaseMap/definition.cjs +1 -2
- package/_cjs/Scope/ReleaseMap/definition.cjs.map +1 -1
- package/_cjs/Scope/api.cjs +1 -2
- package/_cjs/Scope/api.cjs.map +1 -1
- package/_cjs/Scope/definition.cjs +1 -2
- package/_cjs/Scope/definition.cjs.map +1 -1
- package/_cjs/ScopedRef/api.cjs +2 -3
- package/_cjs/ScopedRef/api.cjs.map +1 -1
- package/_cjs/Semaphore/Reservation.cjs +24 -0
- package/_cjs/Semaphore/Reservation.cjs.map +1 -0
- package/_cjs/Semaphore/constructors.cjs +25 -0
- package/_cjs/Semaphore/constructors.cjs.map +1 -0
- package/_cjs/Semaphore/definition.cjs +149 -0
- package/_cjs/Semaphore/definition.cjs.map +1 -0
- package/_cjs/Semaphore.cjs +31 -138
- package/_cjs/Semaphore.cjs.map +1 -1
- package/_cjs/Sink/api.cjs +1 -2
- package/_cjs/Sink/api.cjs.map +1 -1
- package/_cjs/State/api.cjs +1 -2
- package/_cjs/State/api.cjs.map +1 -1
- package/_cjs/Stream/api/zipAllWith.cjs +1 -2
- package/_cjs/Stream/api/zipAllWith.cjs.map +1 -1
- package/_cjs/Stream/api/zipWith.cjs +1 -2
- package/_cjs/Stream/api/zipWith.cjs.map +1 -1
- package/_cjs/Stream/api/zipWithChunks.cjs +1 -2
- package/_cjs/Stream/api/zipWithChunks.cjs.map +1 -1
- package/_cjs/Stream/api.cjs +702 -703
- package/_cjs/Stream/api.cjs.map +1 -1
- package/_cjs/Stream/internal/Handoff.cjs +1 -2
- package/_cjs/Stream/internal/Handoff.cjs.map +1 -1
- package/_cjs/Stream/internal/Pull.cjs +1 -2
- package/_cjs/Stream/internal/Pull.cjs.map +1 -1
- package/_cjs/Stream/internal/Take.cjs +1 -2
- package/_cjs/Stream/internal/Take.cjs.map +1 -1
- package/_cjs/Stream/internal/util.cjs +1 -2
- package/_cjs/Stream/internal/util.cjs.map +1 -1
- package/_cjs/Subject/Atomic.cjs +1 -2
- package/_cjs/Subject/Atomic.cjs.map +1 -1
- package/_cjs/Subject/api.cjs +1 -2
- package/_cjs/Subject/api.cjs.map +1 -1
- package/_cjs/SubscriptionRef.cjs +2 -3
- package/_cjs/SubscriptionRef.cjs.map +1 -1
- package/_cjs/Supervisor/api.cjs +1 -2
- package/_cjs/Supervisor/api.cjs.map +1 -1
- package/_cjs/Supervisor/constructors.cjs +1 -2
- package/_cjs/Supervisor/constructors.cjs.map +1 -1
- package/_cjs/Supervisor/definition.cjs +1 -2
- package/_cjs/Supervisor/definition.cjs.map +1 -1
- package/_cjs/SupervisorPatch.cjs +1 -2
- package/_cjs/SupervisorPatch.cjs.map +1 -1
- package/_cjs/TExit/definition.cjs +1 -2
- package/_cjs/TExit/definition.cjs.map +1 -1
- package/_cjs/TFuture/api.cjs +1 -2
- package/_cjs/TFuture/api.cjs.map +1 -1
- package/_cjs/TFuture/constructors.cjs +1 -2
- package/_cjs/TFuture/constructors.cjs.map +1 -1
- package/_cjs/TFuture/definition.cjs +1 -2
- package/_cjs/TFuture/definition.cjs.map +1 -1
- package/_cjs/TReentrantLock/api.cjs +1 -2
- package/_cjs/TReentrantLock/api.cjs.map +1 -1
- package/_cjs/TReentrantLock/definition.cjs +1 -2
- package/_cjs/TReentrantLock/definition.cjs.map +1 -1
- package/_cjs/TRef/api.cjs +1 -2
- package/_cjs/TRef/api.cjs.map +1 -1
- package/_cjs/TRef/constructors.cjs +1 -2
- package/_cjs/TRef/constructors.cjs.map +1 -1
- package/_cjs/TRef/definition.cjs +1 -2
- package/_cjs/TRef/definition.cjs.map +1 -1
- package/_cjs/TSemaphore/api.cjs +1 -2
- package/_cjs/TSemaphore/api.cjs.map +1 -1
- package/_cjs/TSemaphore/constructors.cjs +1 -2
- package/_cjs/TSemaphore/constructors.cjs.map +1 -1
- package/_cjs/TSemaphore/definition.cjs +1 -2
- package/_cjs/TSemaphore/definition.cjs.map +1 -1
- package/_cjs/collection/immutable/Conc/dropUntilIO.cjs +1 -2
- package/_cjs/collection/immutable/Conc/dropUntilIO.cjs.map +1 -1
- package/_cjs/collection/immutable/Conc/dropWhileIO.cjs +1 -2
- package/_cjs/collection/immutable/Conc/dropWhileIO.cjs.map +1 -1
- package/_cjs/collection/immutable/Conc/filterIO.cjs +1 -2
- package/_cjs/collection/immutable/Conc/filterIO.cjs.map +1 -1
- package/_cjs/collection/immutable/Conc/findIO.cjs +1 -2
- package/_cjs/collection/immutable/Conc/findIO.cjs.map +1 -1
- package/_cjs/collection/immutable/Conc/mapIO.cjs +1 -2
- package/_cjs/collection/immutable/Conc/mapIO.cjs.map +1 -1
- package/_cjs/collection/immutable/Conc/takeWhileIO.cjs +1 -2
- package/_cjs/collection/immutable/Conc/takeWhileIO.cjs.map +1 -1
- package/_cjs/data/Exit/foreachIO.cjs +1 -2
- package/_cjs/data/Exit/foreachIO.cjs.map +1 -1
- package/_cjs/global.cjs +0 -4
- package/_cjs/index.cjs +0 -4
- package/_cjs/internal/HashedPair.cjs +1 -2
- package/_cjs/internal/HashedPair.cjs.map +1 -1
- package/_cjs/internal/Hub.cjs +1 -2
- package/_cjs/internal/Hub.cjs.map +1 -1
- package/_cjs/internal/MutableQueue.cjs +1 -2
- package/_cjs/internal/MutableQueue.cjs.map +1 -1
- package/_cjs/internal/Scheduler.cjs +1 -2
- package/_cjs/internal/Scheduler.cjs.map +1 -1
- package/_cjs/internal/StackTraceBuilder.cjs +1 -2
- package/_cjs/internal/StackTraceBuilder.cjs.map +1 -1
- package/_mjs/Cached/api.mjs.map +1 -1
- package/_mjs/Channel/api/mapOutConcurrentIO.mjs +1 -1
- package/_mjs/Channel/api/mergeAllWith.mjs +1 -1
- package/_mjs/Channel/api/runScoped.mjs +2 -2
- package/_mjs/Channel/api/runScoped.mjs.map +1 -1
- package/_mjs/Channel/api/toPull.mjs +1 -1
- package/_mjs/Channel/api/toPull.mjs.map +1 -1
- package/_mjs/Channel/api.mjs +205 -205
- package/_mjs/Channel/api.mjs.map +1 -1
- package/_mjs/Channel/core-api.mjs +43 -42
- package/_mjs/Channel/core-api.mjs.map +1 -1
- package/_mjs/Channel/internal/AsyncInputConsumer.mjs +1 -1
- package/_mjs/Channel/internal/AsyncInputProducer.mjs +1 -1
- package/_mjs/Channel/internal/ChannelExecutor.mjs +3 -3
- package/_mjs/Channel/internal/ChannelExecutor.mjs.map +1 -1
- package/_mjs/Console/definition.mjs +1 -0
- package/_mjs/Console/definition.mjs.map +1 -1
- package/_mjs/CountdownLatch.mjs +2 -1
- package/_mjs/CountdownLatch.mjs.map +1 -1
- package/_mjs/Fiber/FiberMessage.mjs +2 -20
- package/_mjs/Fiber/FiberMessage.mjs.map +1 -1
- package/_mjs/Fiber/FiberRuntime.mjs +877 -633
- package/_mjs/Fiber/FiberRuntime.mjs.map +1 -1
- package/_mjs/Fiber/api/collectAll.mjs +1 -1
- package/_mjs/Fiber/api/collectAll.mjs.map +1 -1
- package/_mjs/Fiber/api/interrupt.mjs +1 -1
- package/_mjs/Fiber/api/interrupt.mjs.map +1 -1
- package/_mjs/Fiber/api/interruptAll.mjs +1 -1
- package/_mjs/Fiber/api/interruptAll.mjs.map +1 -1
- package/_mjs/Fiber/api/interruptAs.mjs +4 -7
- package/_mjs/Fiber/api/interruptAs.mjs.map +1 -1
- package/_mjs/Fiber/api/interruptFork.mjs +1 -1
- package/_mjs/Fiber/api/interruptFork.mjs.map +1 -1
- package/_mjs/Fiber/api/mapIO.mjs +1 -1
- package/_mjs/Fiber/api/mapIO.mjs.map +1 -1
- package/_mjs/Fiber/api/zipWith.mjs +1 -1
- package/_mjs/Fiber/api/zipWith.mjs.map +1 -1
- package/_mjs/Fiber/constructors.mjs +1 -1
- package/_mjs/Fiber/constructors.mjs.map +1 -1
- package/_mjs/Fiber/definition.mjs +5 -2
- package/_mjs/Fiber/definition.mjs.map +1 -1
- package/_mjs/FiberScope/definition.mjs +28 -4
- package/_mjs/FiberScope/definition.mjs.map +1 -1
- package/_mjs/FiberSet.mjs +14 -12
- package/_mjs/FiberSet.mjs.map +1 -1
- package/_mjs/Future/State.mjs +96 -0
- package/_mjs/Future/State.mjs.map +1 -0
- package/_mjs/Future/api.mjs +67 -61
- package/_mjs/Future/api.mjs.map +1 -1
- package/_mjs/Future/constructors.mjs +3 -3
- package/_mjs/Future/constructors.mjs.map +1 -1
- package/_mjs/Future/definition.mjs +0 -12
- package/_mjs/Future/definition.mjs.map +1 -1
- package/_mjs/Future.mjs +1 -0
- package/_mjs/Future.mjs.map +1 -1
- package/_mjs/Hub/api.mjs +55 -55
- package/_mjs/Hub/api.mjs.map +1 -1
- package/_mjs/IO/api/array.mjs +42 -0
- package/_mjs/IO/api/array.mjs.map +1 -0
- package/_mjs/IO/api/asyncInterrupt.mjs.map +1 -1
- package/_mjs/IO/api/awaitAllChildren.mjs +10 -0
- package/_mjs/IO/api/awaitAllChildren.mjs.map +1 -0
- package/_mjs/IO/api/cachedInvalidate.mjs +39 -0
- package/_mjs/IO/api/cachedInvalidate.mjs.map +1 -0
- package/_mjs/IO/api/disconnect.mjs +1 -1
- package/_mjs/IO/api/disconnect.mjs.map +1 -1
- package/_mjs/IO/api/foreachConcurrent.mjs +35 -28
- package/_mjs/IO/api/foreachConcurrent.mjs.map +1 -1
- package/_mjs/IO/api/fork.mjs +1 -1
- package/_mjs/IO/api/fork.mjs.map +1 -1
- package/_mjs/IO/api/forkDaemon.mjs +4 -4
- package/_mjs/IO/api/forkDaemon.mjs.map +1 -1
- package/_mjs/IO/api/interrupt.mjs +3 -3
- package/_mjs/IO/api/onTermination.mjs +1 -1
- package/_mjs/IO/api/onTermination.mjs.map +1 -1
- package/_mjs/IO/api/race.mjs +1 -1
- package/_mjs/IO/api/race.mjs.map +1 -1
- package/_mjs/IO/api/timeout.mjs +8 -9
- package/_mjs/IO/api/timeout.mjs.map +1 -1
- package/_mjs/IO/api/transplant.mjs +19 -5
- package/_mjs/IO/api/transplant.mjs.map +1 -1
- package/_mjs/IO/api/zipConcurrent.mjs +4 -4
- package/_mjs/IO/api/zipConcurrent.mjs.map +1 -1
- package/_mjs/IO/api.mjs +515 -468
- package/_mjs/IO/api.mjs.map +1 -1
- package/_mjs/IO/definition.mjs +1 -1
- package/_mjs/IO/definition.mjs.map +1 -1
- package/_mjs/IO/runtime.mjs +8 -8
- package/_mjs/IO/runtime.mjs.map +1 -1
- package/_mjs/IO.mjs +3 -1
- package/_mjs/IO.mjs.map +1 -1
- package/_mjs/IOEnv/definition.mjs.map +1 -1
- package/_mjs/Push/api.mjs +1 -1
- package/_mjs/Random/definition.mjs +1 -0
- package/_mjs/Random/definition.mjs.map +1 -1
- package/_mjs/Ref/Synchronized/api.mjs +1 -1
- package/_mjs/Ref/Synchronized/api.mjs.map +1 -1
- package/_mjs/Ref/Synchronized/constructors.mjs +1 -1
- package/_mjs/Ref/Synchronized/definition.mjs +1 -1
- package/_mjs/Ref/Synchronized/definition.mjs.map +1 -1
- package/_mjs/RuntimeFlag.mjs +1 -1
- package/_mjs/STM/definition.mjs +1 -1
- package/_mjs/ScopedRef/api.mjs +1 -1
- package/_mjs/ScopedRef/api.mjs.map +1 -1
- package/_mjs/Semaphore/Reservation.mjs +16 -0
- package/_mjs/Semaphore/Reservation.mjs.map +1 -0
- package/_mjs/Semaphore/constructors.mjs +17 -0
- package/_mjs/Semaphore/constructors.mjs.map +1 -0
- package/_mjs/Semaphore/definition.mjs +141 -0
- package/_mjs/Semaphore/definition.mjs.map +1 -0
- package/_mjs/Semaphore.mjs +4 -133
- package/_mjs/Semaphore.mjs.map +1 -1
- package/_mjs/Stream/api.mjs +701 -701
- package/_mjs/Stream/api.mjs.map +1 -1
- package/_mjs/SubscriptionRef.mjs +1 -1
- package/_mjs/global.mjs +1 -1
- package/_mjs/index.mjs +1 -1
- package/_src/Cached/api.ts +3 -3
- package/_src/Channel/api/toPull.ts +1 -1
- package/_src/Channel/api.ts +273 -272
- package/_src/Channel/core-api.ts +57 -55
- package/_src/Channel/internal/ChannelExecutor.ts +3 -3
- package/_src/Console/definition.ts +1 -0
- package/_src/CountdownLatch.ts +2 -0
- package/_src/Fiber/FiberMessage.ts +3 -28
- package/_src/Fiber/FiberRuntime.ts +988 -616
- package/_src/Fiber/api/interruptAs.ts +4 -3
- package/_src/Fiber/constructors.ts +1 -1
- package/_src/Fiber/definition.ts +4 -0
- package/_src/FiberScope/definition.ts +40 -2
- package/_src/FiberSet.ts +6 -2
- package/_src/Future/State.ts +128 -0
- package/_src/Future/api.ts +62 -51
- package/_src/Future/constructors.ts +4 -2
- package/_src/Future/definition.ts +2 -17
- package/_src/Future.ts +4 -3
- package/_src/Hub/api.ts +61 -61
- package/_src/IO/api/addFinalizerExit.ts +4 -4
- package/_src/IO/api/array.ts +49 -0
- package/_src/IO/api/asyncInterrupt.ts +1 -1
- package/_src/IO/api/awaitAllChildren.ts +6 -0
- package/_src/IO/api/cachedInvalidate.ts +42 -0
- package/_src/IO/api/foreachConcurrent.ts +39 -23
- package/_src/IO/api/fork.ts +1 -1
- package/_src/IO/api/forkDaemon.ts +2 -2
- package/_src/IO/api/memoize.ts +3 -3
- package/_src/IO/api/onTermination.ts +2 -2
- package/_src/IO/api/transplant.ts +26 -3
- package/_src/IO/api/zipConcurrent.ts +2 -2
- package/_src/IO/api.ts +547 -525
- package/_src/IO/definition.ts +4 -28
- package/_src/IO/runtime.ts +0 -1
- package/_src/IO.ts +65 -63
- package/_src/IOEnv/definition.ts +1 -4
- package/_src/Random/definition.ts +1 -0
- package/_src/Ref/Synchronized/api.ts +2 -2
- package/_src/Ref/Synchronized/definition.ts +1 -1
- package/_src/Semaphore/Reservation.ts +15 -0
- package/_src/Semaphore/constructors.ts +14 -0
- package/_src/Semaphore/definition.ts +180 -0
- package/_src/Semaphore.ts +5 -159
- package/_src/Stream/api.ts +679 -679
- package/package.json +4 -4
- package/IO/api/sequenceT.d.ts +0 -26
- package/_cjs/IO/api/sequenceT.cjs +0 -18
- package/_cjs/IO/api/sequenceT.cjs.map +0 -1
- package/_mjs/IO/api/sequenceT.mjs +0 -10
- package/_mjs/IO/api/sequenceT.mjs.map +0 -1
- package/_src/IO/api/sequenceT.ts +0 -16
@@ -1,152 +1,697 @@
|
|
1
1
|
var _a;
|
2
2
|
const fileName_1 = "(@fncts/io) src/Fiber/FiberRuntime.ts";
|
3
|
-
import * as tsplus_module_1 from "@fncts/
|
4
|
-
import * as tsplus_module_2 from "@fncts/
|
5
|
-
import * as tsplus_module_3 from "@fncts/io/
|
6
|
-
import * as tsplus_module_4 from "@fncts/io/
|
7
|
-
import * as tsplus_module_5 from "@fncts/
|
8
|
-
import * as tsplus_module_6 from "@fncts/io/
|
9
|
-
import * as tsplus_module_7 from "@fncts/base/collection/immutable/
|
10
|
-
import * as tsplus_module_8 from "@fncts/
|
11
|
-
import * as tsplus_module_9 from "@fncts/
|
12
|
-
import * as tsplus_module_10 from "@fncts/io/
|
13
|
-
import * as tsplus_module_11 from "@fncts/
|
14
|
-
import * as tsplus_module_12 from "@fncts/
|
15
|
-
import * as tsplus_module_13 from "@fncts/base/
|
16
|
-
import * as tsplus_module_14 from "@fncts/base/data/
|
17
|
-
import * as tsplus_module_15 from "@fncts/
|
18
|
-
import * as tsplus_module_16 from "@fncts/
|
19
|
-
import * as tsplus_module_17 from "@fncts/
|
20
|
-
import * as tsplus_module_18 from "@fncts/
|
21
|
-
import * as tsplus_module_19 from "@fncts/
|
22
|
-
import * as tsplus_module_20 from "@fncts/
|
23
|
-
import * as tsplus_module_21 from "@fncts/
|
24
|
-
import * as tsplus_module_22 from "@fncts/base/
|
25
|
-
import * as tsplus_module_23 from "@fncts/
|
26
|
-
import * as tsplus_module_24 from "@fncts/
|
27
|
-
import * as tsplus_module_25 from "@fncts/
|
28
|
-
import * as tsplus_module_26 from "@fncts/io/
|
29
|
-
import * as tsplus_module_27 from "@fncts/base/data/
|
30
|
-
import * as tsplus_module_28 from "@fncts/io/
|
31
|
-
import * as tsplus_module_29 from "@fncts/
|
32
|
-
import * as tsplus_module_30 from "@fncts/
|
3
|
+
import * as tsplus_module_1 from "@fncts/io/IO/api";
|
4
|
+
import * as tsplus_module_2 from "@fncts/io/FiberRefs/api";
|
5
|
+
import * as tsplus_module_3 from "@fncts/io/RuntimeFlags/RuntimeFlags";
|
6
|
+
import * as tsplus_module_4 from "@fncts/io/RuntimeFlags/Patch";
|
7
|
+
import * as tsplus_module_5 from "@fncts/base/data/Maybe/constructors";
|
8
|
+
import * as tsplus_module_6 from "@fncts/io/FiberScope/constructors";
|
9
|
+
import * as tsplus_module_7 from "@fncts/base/collection/immutable/List/constructors";
|
10
|
+
import * as tsplus_module_8 from "@fncts/base/data/TraceElement/definition";
|
11
|
+
import * as tsplus_module_9 from "@fncts/base/collection/immutable/HashMap/api";
|
12
|
+
import * as tsplus_module_10 from "@fncts/io/FiberRef/api";
|
13
|
+
import * as tsplus_module_11 from "@fncts/io/FiberRef/unsafe";
|
14
|
+
import * as tsplus_module_12 from "@fncts/base/data/Exit/constructors";
|
15
|
+
import * as tsplus_module_13 from "@fncts/base/collection/immutable/Conc/constructors";
|
16
|
+
import * as tsplus_module_14 from "@fncts/base/data/Trace/constructors";
|
17
|
+
import * as tsplus_module_15 from "@fncts/base/data/Cause/api";
|
18
|
+
import * as tsplus_module_16 from "@fncts/io/Fiber/FiberMessage";
|
19
|
+
import * as tsplus_module_17 from "@fncts/base/data/Cause/api/isEmpty";
|
20
|
+
import * as tsplus_module_18 from "@fncts/base/data/Maybe/api";
|
21
|
+
import * as tsplus_module_19 from "@fncts/io/LogLevel";
|
22
|
+
import * as tsplus_module_20 from "@fncts/io/Logger/constructors";
|
23
|
+
import * as tsplus_module_21 from "@fncts/io/Logger/api";
|
24
|
+
import * as tsplus_module_22 from "@fncts/base/collection/immutable/List/api";
|
25
|
+
import * as tsplus_module_23 from "@fncts/io/IO/definition";
|
26
|
+
import * as tsplus_module_24 from "@fncts/base/data/Exit/api";
|
27
|
+
import * as tsplus_module_25 from "@fncts/io/FiberStatus/constructors";
|
28
|
+
import * as tsplus_module_26 from "@fncts/io/STM/api/atomically";
|
29
|
+
import * as tsplus_module_27 from "@fncts/base/data/exceptions";
|
30
|
+
import * as tsplus_module_28 from "@fncts/io/IO/api/environment";
|
31
|
+
import * as tsplus_module_29 from "@fncts/base/collection/immutable/Conc/api";
|
32
|
+
import * as tsplus_module_30 from "@fncts/base/data/Either/constructors";
|
33
|
+
import * as tsplus_module_31 from "@fncts/io/IO/api/asyncInterrupt";
|
34
|
+
import * as tsplus_module_32 from "@fncts/base/collection/immutable/Conc/api/empty";
|
35
|
+
import * as tsplus_module_33 from "@fncts/base/data/FiberId/constructors";
|
36
|
+
import { IterableWeakSet } from "@fncts/base/collection/weak/IterableWeakSet";
|
33
37
|
import { isIOError } from "@fncts/base/data/exceptions";
|
34
38
|
import { Trace } from "@fncts/base/data/Trace";
|
39
|
+
import { assert } from "@fncts/base/util/assert";
|
35
40
|
import { FiberTypeId, FiberVariance } from "@fncts/io/Fiber/definition";
|
36
41
|
import { StackTraceBuilder } from "@fncts/io/internal/StackTraceBuilder";
|
37
|
-
import { Done, Suspended } from "../FiberStatus.mjs";
|
38
|
-
import { Running } from "../FiberStatus.mjs";
|
39
42
|
import { LinkedQueue } from "../internal/MutableQueue.mjs";
|
40
|
-
import { IOPrimitive
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
this._ioOpCode = 14 /* IOTag.RevertFlags */;
|
46
|
-
}
|
47
|
-
}
|
48
|
-
export class UpdateTrace {
|
49
|
-
constructor(trace) {
|
50
|
-
this.trace = trace;
|
51
|
-
this._ioOpCode = 15 /* IOTag.UpdateTrace */;
|
52
|
-
}
|
53
|
-
}
|
43
|
+
import { IOPrimitive } from "../IO/definition.mjs";
|
44
|
+
const MAX_FORKS_BEFORE_YIELD = 128;
|
45
|
+
const MAX_DEPTH_BEFORE_TRAMPOLINE = 300;
|
46
|
+
const INITIAL_STACK_SIZE = 16;
|
47
|
+
const STACK_IDX_GC_THRESHOLD = 128;
|
54
48
|
/**
|
55
49
|
* @tsplus type fncts.io.Fiber
|
56
50
|
*/
|
57
51
|
export class FiberRuntime {
|
52
|
+
get await() {
|
53
|
+
return tsplus_module_1.defer(() => this.awaitUnsafe(), fileName_1 + ":48:20");
|
54
|
+
}
|
55
|
+
get children() {
|
56
|
+
return tsplus_module_1.succeed(() => this.childrenChunk(this._children), fileName_1 + ":52:14");
|
57
|
+
}
|
58
|
+
get fiberRefs() {
|
59
|
+
return tsplus_module_1.succeed(() => this._fiberRefs, fileName_1 + ":56:14");
|
60
|
+
}
|
61
|
+
get id() {
|
62
|
+
return this.fiberId;
|
63
|
+
}
|
64
|
+
get inheritAll() {
|
65
|
+
return tsplus_module_1.withFiberRuntime((parentFiber, parentStatus) => {
|
66
|
+
const parentFiberId = parentFiber.id;
|
67
|
+
const parentFiberRefs = parentFiber.getFiberRefs();
|
68
|
+
const parentRuntimeFlags = parentStatus.runtimeFlags;
|
69
|
+
const childFiberRefs = this.getFiberRefs();
|
70
|
+
const updatedFiberRefs = tsplus_module_2.join(parentFiberId, childFiberRefs)(parentFiberRefs);
|
71
|
+
parentFiber.setFiberRefs(updatedFiberRefs);
|
72
|
+
return tsplus_module_1.flatMap(childRuntimeFlags => {
|
73
|
+
const patch = tsplus_module_4.exclude(tsplus_module_4.exclude(tsplus_module_3.diff(parentRuntimeFlags, childRuntimeFlags), 64 /* RuntimeFlag.WindDown */), 1 /* RuntimeFlag.Interruption */);
|
74
|
+
return tsplus_module_1.updateRuntimeFlags(patch, fileName_1 + ":80:37");
|
75
|
+
}, fileName_1 + ":74:39")(this.runtimeFlags);
|
76
|
+
}, fileName_1 + ":64:31");
|
77
|
+
}
|
78
|
+
get poll() {
|
79
|
+
return tsplus_module_1.succeed(() => tsplus_module_5.fromNullable(this.exitValue()), fileName_1 + ":86:22");
|
80
|
+
}
|
81
|
+
get runtimeFlags() {
|
82
|
+
return tsplus_module_1.succeed(() => this._runtimeFlags, fileName_1 + ":90:14");
|
83
|
+
}
|
84
|
+
get scope() {
|
85
|
+
return tsplus_module_6.unsafeMake(this);
|
86
|
+
}
|
87
|
+
get status() {
|
88
|
+
return tsplus_module_1.succeed(() => this.getStatus(), fileName_1 + ":98:14");
|
89
|
+
}
|
90
|
+
get trace() {
|
91
|
+
return tsplus_module_1.succeed(() => this.generateStackTrace(), fileName_1 + ":102:14");
|
92
|
+
}
|
58
93
|
constructor(fiberId, fiberRefs0, runtimeFlags0) {
|
59
94
|
this.fiberId = fiberId;
|
60
95
|
this.runtimeFlags0 = runtimeFlags0;
|
61
|
-
this[_a] = FiberTypeId;
|
62
96
|
this._tag = "RuntimeFiber";
|
63
|
-
this
|
97
|
+
this[_a] = FiberTypeId;
|
98
|
+
this.location = this.fiberId.location;
|
99
|
+
this._asyncContWith = null;
|
100
|
+
this._blockingOn = null;
|
64
101
|
this._children = null;
|
65
|
-
this.observers = tsplus_module_1.make();
|
66
|
-
this.running = false;
|
67
|
-
this.stack = new tsplus_module_2.Stack();
|
68
|
-
this.asyncInterruptor = null;
|
69
|
-
this.asyncTrace = null;
|
70
|
-
this.asyncBlockinOn = null;
|
71
102
|
this._exitValue = null;
|
72
|
-
this.
|
103
|
+
this._forksSinceYield = 0;
|
104
|
+
this._stack = null;
|
105
|
+
this._stackSize = 0;
|
106
|
+
this.inbox = new LinkedQueue();
|
107
|
+
this.observers = tsplus_module_7.make();
|
108
|
+
this.running = false;
|
73
109
|
this._fiberRefs = fiberRefs0;
|
74
110
|
this._runtimeFlags = runtimeFlags0;
|
75
111
|
}
|
76
|
-
|
77
|
-
|
112
|
+
addChild(child) {
|
113
|
+
this.getChildren().add(child);
|
78
114
|
}
|
79
|
-
|
80
|
-
|
81
|
-
const
|
82
|
-
|
83
|
-
|
84
|
-
|
115
|
+
addChildren(children) {
|
116
|
+
if (this.isAlive()) {
|
117
|
+
const childs = this.getChildren();
|
118
|
+
if (this.shouldInterrupt()) {
|
119
|
+
const cause = this.getInterruptedCause();
|
120
|
+
for (const child of children) {
|
121
|
+
if (child.isAlive()) {
|
122
|
+
childs.add(child);
|
123
|
+
child.tellInterrupt(cause);
|
124
|
+
}
|
125
|
+
}
|
126
|
+
} else {
|
127
|
+
for (const child of children) {
|
128
|
+
if (child.isAlive()) {
|
129
|
+
childs.add(child);
|
130
|
+
}
|
131
|
+
}
|
132
|
+
}
|
133
|
+
} else {
|
134
|
+
const cause = this.getInterruptedCause();
|
135
|
+
for (const child of children) {
|
136
|
+
if (child.isAlive()) {
|
137
|
+
child.tellInterrupt(cause);
|
138
|
+
}
|
139
|
+
}
|
140
|
+
}
|
85
141
|
}
|
86
|
-
|
87
|
-
|
88
|
-
if (fiber._exitValue !== null) cb(tsplus_module_4.succeedNow(fiber.exitValue(), fileName_1 + ":89:60"));else fiber.addObserver(exit => cb(tsplus_module_4.succeedNow(exit, fileName_1 + ":90:62")));
|
89
|
-
})), this.id, fileName_1 + ":85:20");
|
142
|
+
addObserver(observer) {
|
143
|
+
if (this._exitValue !== null) observer(this._exitValue);else this.observers = tsplus_module_7.cons(observer, this.observers);
|
90
144
|
}
|
91
|
-
|
92
|
-
|
145
|
+
deleteFiberRef(ref) {
|
146
|
+
this._fiberRefs = tsplus_module_2.remove(this._fiberRefs, ref);
|
93
147
|
}
|
94
|
-
|
95
|
-
return this.
|
148
|
+
exitValue() {
|
149
|
+
return this._exitValue;
|
96
150
|
}
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
}
|
151
|
+
generateStackTrace() {
|
152
|
+
const builder = new StackTraceBuilder();
|
153
|
+
const stack = this._stack;
|
154
|
+
const size = this._stackSize;
|
155
|
+
if (stack !== null) {
|
156
|
+
for (let i = stack.length < size ? stack.length : size; i >= 0; i--) {
|
157
|
+
const k = stack[i];
|
158
|
+
if (k != null) {
|
159
|
+
builder.append(tsplus_module_8.parse(k.trace));
|
160
|
+
}
|
161
|
+
}
|
162
|
+
builder.append(tsplus_module_8.parse(this.id.location));
|
163
|
+
}
|
164
|
+
return new Trace(this.fiberId, builder.result());
|
110
165
|
}
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
166
|
+
getChildren() {
|
167
|
+
let children = this._children;
|
168
|
+
if (children === null) {
|
169
|
+
children = new IterableWeakSet();
|
170
|
+
this._children = children;
|
171
|
+
}
|
172
|
+
return children;
|
115
173
|
}
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
174
|
+
getFiberRef(fiberRef) {
|
175
|
+
if (tsplus_module_9.has(fiberRef)(this._fiberRefs)) {
|
176
|
+
return tsplus_module_9.unsafeGet(fiberRef)(this._fiberRefs).head[1];
|
177
|
+
}
|
178
|
+
return tsplus_module_10.initial(fiberRef);
|
179
|
+
}
|
180
|
+
getFiberRefs() {
|
181
|
+
return this._fiberRefs;
|
182
|
+
}
|
183
|
+
getInterruptedCause() {
|
184
|
+
return this.getFiberRef(tsplus_module_11.interruptedCause);
|
121
185
|
}
|
122
186
|
getSupervisor() {
|
123
|
-
return this.getFiberRef(
|
187
|
+
return this.getFiberRef(tsplus_module_11.currentSupervisor);
|
124
188
|
}
|
125
|
-
|
126
|
-
return
|
189
|
+
interruptAs(fiberId, __tsplusTrace) {
|
190
|
+
return tsplus_module_1.defer(() => {
|
191
|
+
const exit = this._exitValue;
|
192
|
+
if (exit !== null) {
|
193
|
+
return tsplus_module_12.succeed(exit, fileName_1 + ":224:28");
|
194
|
+
} else {
|
195
|
+
const cause = tsplus_module_15.interrupt(fiberId, tsplus_module_14.make(this.fiberId, tsplus_module_13.single(tsplus_module_8.parse(__tsplusTrace))));
|
196
|
+
this.tell(tsplus_module_16.interruptSignal(cause));
|
197
|
+
return this.awaitUnsafe(__tsplusTrace);
|
198
|
+
}
|
199
|
+
}, fileName_1 + ":221:20");
|
127
200
|
}
|
128
|
-
|
129
|
-
|
201
|
+
interruptAsFork(fiberId, __tsplusTrace) {
|
202
|
+
return tsplus_module_1.succeed(() => {
|
203
|
+
const cause = tsplus_module_15.interrupt(fiberId);
|
204
|
+
this.tell(tsplus_module_16.interruptSignal(cause));
|
205
|
+
}, fileName_1 + ":234:22");
|
206
|
+
}
|
207
|
+
isAlive() {
|
208
|
+
return this.exitValue === null;
|
209
|
+
}
|
210
|
+
isDone() {
|
211
|
+
return this.exitValue !== null;
|
212
|
+
}
|
213
|
+
isFatal(t) {
|
214
|
+
return this.getFiberRef(tsplus_module_11.currentIsFatal).apply(t);
|
215
|
+
}
|
216
|
+
isInterrupted() {
|
217
|
+
return !tsplus_module_17.isEmpty(this.getFiberRef(tsplus_module_11.interruptedCause));
|
218
|
+
}
|
219
|
+
log(message, cause, overrideLogLevel, trace) {
|
220
|
+
const logLevel = tsplus_module_18.getOrElse(() => this.getFiberRef(tsplus_module_11.currentLogLevel))(overrideLogLevel);
|
221
|
+
const spans = this.getFiberRef(tsplus_module_11.currentLogSpan);
|
222
|
+
const annotations = this.getFiberRef(tsplus_module_11.currentLogAnnotations);
|
223
|
+
const contextMap = this.getFiberRefs();
|
224
|
+
tsplus_module_21.filterLogLevel(level => tsplus_module_19.gte(tsplus_module_19.Info)(level))(tsplus_module_21.map(s => console.log(s))(tsplus_module_20.defaultString)).log(tsplus_module_8.parse(trace), this.fiberId, logLevel, message, cause, contextMap, spans, annotations);
|
225
|
+
}
|
226
|
+
removeChild(child) {
|
227
|
+
if (this._children !== null) {
|
228
|
+
this._children.delete(child);
|
229
|
+
}
|
230
|
+
}
|
231
|
+
removeObserver(observer) {
|
232
|
+
this.observers = tsplus_module_22.filter(f => f !== observer)(this.observers);
|
233
|
+
}
|
234
|
+
resume(effect) {
|
235
|
+
this.tell(tsplus_module_16.resume(effect));
|
236
|
+
}
|
237
|
+
runLoop(effect, minStackIndex, startStackIndex, currentDepth, currentOps) {
|
238
|
+
assert(this.running, "Invalid state in FiberRuntime: Fiber is not running");
|
239
|
+
let op = effect;
|
240
|
+
let ops = currentOps;
|
241
|
+
let stackIndex = startStackIndex;
|
242
|
+
if (currentDepth >= MAX_DEPTH_BEFORE_TRAMPOLINE) {
|
243
|
+
this.inbox.enqueue(tsplus_module_16.resume(effect));
|
244
|
+
return null;
|
245
|
+
}
|
246
|
+
while (true) {
|
247
|
+
if ((this._runtimeFlags & 8 /* RuntimeFlag.OpSupervision */) !== 0) {
|
248
|
+
this.getSupervisor().unsafeOnEffect(this, op);
|
249
|
+
}
|
250
|
+
op = this.drainQueueWhileRunning(op);
|
251
|
+
ops += 1;
|
252
|
+
if (ops > this.getFiberRef(tsplus_module_11.currentMaxFiberOps)) {
|
253
|
+
this.updateLastTrace(op.trace);
|
254
|
+
this.inbox.enqueue(tsplus_module_16.resume(op));
|
255
|
+
return null;
|
256
|
+
}
|
257
|
+
switch (op._ioOpCode) {
|
258
|
+
case 0 /* IOTag.SucceedNow */:
|
259
|
+
{
|
260
|
+
const value = op.i0;
|
261
|
+
op = null;
|
262
|
+
while (op === null && stackIndex > minStackIndex) {
|
263
|
+
stackIndex -= 1;
|
264
|
+
const continuation = this._stack[stackIndex];
|
265
|
+
this.popStackFrame(stackIndex);
|
266
|
+
switch (continuation._ioOpCode) {
|
267
|
+
case 5 /* IOTag.OnSuccess */:
|
268
|
+
op = continuation.i1(value);
|
269
|
+
break;
|
270
|
+
case 4 /* IOTag.OnSuccessAndFailure */:
|
271
|
+
op = continuation.i2(value);
|
272
|
+
break;
|
273
|
+
case 6 /* IOTag.UpdateRuntimeFlags */:
|
274
|
+
op = this.patchRuntimeFlags(continuation.i0, null, null);
|
275
|
+
break;
|
276
|
+
}
|
277
|
+
}
|
278
|
+
if (op === null) {
|
279
|
+
return tsplus_module_12.succeed(value, fileName_1 + ":348:32");
|
280
|
+
}
|
281
|
+
break;
|
282
|
+
}
|
283
|
+
case 2 /* IOTag.Sync */:
|
284
|
+
{
|
285
|
+
this.updateLastTrace(op.trace);
|
286
|
+
const value = op.i0();
|
287
|
+
op = null;
|
288
|
+
while (op === null && stackIndex > minStackIndex) {
|
289
|
+
stackIndex -= 1;
|
290
|
+
const continuation = this._stack[stackIndex];
|
291
|
+
this.popStackFrame(stackIndex);
|
292
|
+
switch (continuation._ioOpCode) {
|
293
|
+
case 5 /* IOTag.OnSuccess */:
|
294
|
+
op = continuation.i1(value);
|
295
|
+
break;
|
296
|
+
case 4 /* IOTag.OnSuccessAndFailure */:
|
297
|
+
op = continuation.i2(value);
|
298
|
+
break;
|
299
|
+
case 6 /* IOTag.UpdateRuntimeFlags */:
|
300
|
+
op = this.patchRuntimeFlags(continuation.i0, null, null);
|
301
|
+
break;
|
302
|
+
}
|
303
|
+
}
|
304
|
+
if (op === null) {
|
305
|
+
return tsplus_module_12.succeed(value, fileName_1 + ":378:32");
|
306
|
+
}
|
307
|
+
break;
|
308
|
+
}
|
309
|
+
case 5 /* IOTag.OnSuccess */:
|
310
|
+
{
|
311
|
+
this.updateLastTrace(op.trace);
|
312
|
+
const first = op.i0;
|
313
|
+
if (first === tsplus_module_1.unit) {
|
314
|
+
op = op.i1(undefined);
|
315
|
+
} else {
|
316
|
+
stackIndex = this.pushStackFrame(op, stackIndex);
|
317
|
+
const result = this.runLoop(first, stackIndex, stackIndex, currentDepth + 1, ops);
|
318
|
+
ops += 1;
|
319
|
+
if (result === null) {
|
320
|
+
return null;
|
321
|
+
}
|
322
|
+
stackIndex -= 1;
|
323
|
+
this.popStackFrame(stackIndex);
|
324
|
+
switch (result._tag) {
|
325
|
+
case "Success" /* ExitTag.Success */:
|
326
|
+
op = op.i1(result.value);
|
327
|
+
break;
|
328
|
+
case "Failure" /* ExitTag.Failure */:
|
329
|
+
op = tsplus_module_1.failCauseNow(result.cause, fileName_1 + ":407:49");
|
330
|
+
break;
|
331
|
+
}
|
332
|
+
}
|
333
|
+
break;
|
334
|
+
}
|
335
|
+
case 4 /* IOTag.OnSuccessAndFailure */:
|
336
|
+
{
|
337
|
+
this.updateLastTrace(op.trace);
|
338
|
+
stackIndex = this.pushStackFrame(op, stackIndex);
|
339
|
+
const result = this.runLoop(op.i0, stackIndex, stackIndex, currentDepth + 1, ops);
|
340
|
+
ops += 1;
|
341
|
+
if (result === null) {
|
342
|
+
return null;
|
343
|
+
}
|
344
|
+
stackIndex -= 1;
|
345
|
+
this.popStackFrame(stackIndex);
|
346
|
+
switch (result._tag) {
|
347
|
+
case "Success" /* ExitTag.Success */:
|
348
|
+
{
|
349
|
+
op = op.i2(result.value);
|
350
|
+
break;
|
351
|
+
}
|
352
|
+
case "Failure" /* ExitTag.Failure */:
|
353
|
+
{
|
354
|
+
const cause = result.cause;
|
355
|
+
if (this.shouldInterrupt()) {
|
356
|
+
op = tsplus_module_1.failCauseNow(tsplus_module_15.stripFailures(cause), fileName_1 + ":436:49");
|
357
|
+
} else {
|
358
|
+
op = op.i1(result.cause);
|
359
|
+
}
|
360
|
+
}
|
361
|
+
}
|
362
|
+
break;
|
363
|
+
}
|
364
|
+
case 3 /* IOTag.Async */:
|
365
|
+
{
|
366
|
+
this.updateLastTrace(op.trace);
|
367
|
+
this._blockingOn = op.i1();
|
368
|
+
op = this.initiateAsync(op.i0);
|
369
|
+
if (op === null) {
|
370
|
+
op = this.drainQueueAfterAsync();
|
371
|
+
}
|
372
|
+
if (op === null) {
|
373
|
+
return null;
|
374
|
+
}
|
375
|
+
if (this.shouldInterrupt()) {
|
376
|
+
op = tsplus_module_1.failCauseNow(this.getInterruptedCause(), fileName_1 + ":460:45");
|
377
|
+
}
|
378
|
+
break;
|
379
|
+
}
|
380
|
+
case 7 /* IOTag.UpdateRuntimeFlagsWithin */:
|
381
|
+
{
|
382
|
+
const trace = op.trace;
|
383
|
+
this.updateLastTrace(trace);
|
384
|
+
const updateFlags = op.i0;
|
385
|
+
const oldRuntimeFlags = this._runtimeFlags;
|
386
|
+
const newRuntimeFlags = tsplus_module_4.patch(updateFlags, oldRuntimeFlags);
|
387
|
+
if (newRuntimeFlags === oldRuntimeFlags) {
|
388
|
+
op = op.i1(oldRuntimeFlags);
|
389
|
+
} else {
|
390
|
+
if (tsplus_module_3.interruptible(newRuntimeFlags) && this.isInterrupted()) {
|
391
|
+
op = tsplus_module_1.failCauseNow(this.getInterruptedCause(), fileName_1 + ":476:47");
|
392
|
+
} else {
|
393
|
+
this.patchRuntimeFlagsOnly(updateFlags);
|
394
|
+
const revertFlags = tsplus_module_3.diff(newRuntimeFlags, oldRuntimeFlags);
|
395
|
+
const k = tsplus_module_1.updateRuntimeFlags(revertFlags, trace);
|
396
|
+
stackIndex = this.pushStackFrame(k, stackIndex);
|
397
|
+
const exit = this.runLoop(op.i1(oldRuntimeFlags), stackIndex, stackIndex, currentDepth + 1, ops);
|
398
|
+
ops += 1;
|
399
|
+
if (exit === null) {
|
400
|
+
return null;
|
401
|
+
}
|
402
|
+
stackIndex -= 1;
|
403
|
+
this.popStackFrame(stackIndex);
|
404
|
+
op = this.patchRuntimeFlags(revertFlags, tsplus_module_24.causeOrNull(exit), exit);
|
405
|
+
}
|
406
|
+
}
|
407
|
+
break;
|
408
|
+
}
|
409
|
+
case 8 /* IOTag.Stateful */:
|
410
|
+
{
|
411
|
+
const trace = op.trace;
|
412
|
+
this.updateLastTrace(trace);
|
413
|
+
op = op.i0(this, tsplus_module_25.running(this._runtimeFlags, trace));
|
414
|
+
break;
|
415
|
+
}
|
416
|
+
case 1 /* IOTag.Fail */:
|
417
|
+
{
|
418
|
+
let cause = op.i0();
|
419
|
+
op = null;
|
420
|
+
while (op === null && stackIndex > minStackIndex) {
|
421
|
+
stackIndex -= 1;
|
422
|
+
const continuation = this._stack[stackIndex];
|
423
|
+
this.popStackFrame(stackIndex);
|
424
|
+
switch (continuation._ioOpCode) {
|
425
|
+
case 4 /* IOTag.OnSuccessAndFailure */:
|
426
|
+
{
|
427
|
+
if (this.shouldInterrupt()) {
|
428
|
+
cause = tsplus_module_15.stripFailures(cause);
|
429
|
+
} else {
|
430
|
+
op = continuation.i1(cause);
|
431
|
+
}
|
432
|
+
break;
|
433
|
+
}
|
434
|
+
case 6 /* IOTag.UpdateRuntimeFlags */:
|
435
|
+
op = this.patchRuntimeFlags(continuation.i0, cause, null);
|
436
|
+
break;
|
437
|
+
}
|
438
|
+
}
|
439
|
+
if (op === null) {
|
440
|
+
return tsplus_module_12.failCause(cause, fileName_1 + ":535:34");
|
441
|
+
}
|
442
|
+
break;
|
443
|
+
}
|
444
|
+
case 6 /* IOTag.UpdateRuntimeFlags */:
|
445
|
+
{
|
446
|
+
this.updateLastTrace(op.trace);
|
447
|
+
op = this.patchRuntimeFlags(op.i0, null, tsplus_module_1.unit);
|
448
|
+
break;
|
449
|
+
}
|
450
|
+
case 9 /* IOTag.WhileLoop */:
|
451
|
+
{
|
452
|
+
const iterate = op;
|
453
|
+
this.updateLastTrace(iterate.trace);
|
454
|
+
const check = iterate.i0;
|
455
|
+
const body = iterate.i1;
|
456
|
+
const process = iterate.i2;
|
457
|
+
stackIndex = this.pushStackFrame(iterate, stackIndex);
|
458
|
+
op = null;
|
459
|
+
const nextDepth = currentDepth + 1;
|
460
|
+
while (op === null && check()) {
|
461
|
+
const exit = this.runLoop(body(), stackIndex, stackIndex, nextDepth, ops);
|
462
|
+
if (exit === null) {
|
463
|
+
return null;
|
464
|
+
}
|
465
|
+
switch (exit._tag) {
|
466
|
+
case "Success" /* ExitTag.Success */:
|
467
|
+
process(exit.value);
|
468
|
+
break;
|
469
|
+
case "Failure" /* ExitTag.Failure */:
|
470
|
+
op = tsplus_module_1.failCauseNow(exit.cause, fileName_1 + ":570:49");
|
471
|
+
break;
|
472
|
+
}
|
473
|
+
ops += 1;
|
474
|
+
}
|
475
|
+
stackIndex -= 1;
|
476
|
+
this.popStackFrame(stackIndex);
|
477
|
+
if (op === null) {
|
478
|
+
op = tsplus_module_1.unit;
|
479
|
+
}
|
480
|
+
break;
|
481
|
+
}
|
482
|
+
case 10 /* IOTag.YieldNow */:
|
483
|
+
{
|
484
|
+
this.updateLastTrace(op.trace);
|
485
|
+
this.inbox.enqueue(tsplus_module_16.resume(tsplus_module_1.unit));
|
486
|
+
return null;
|
487
|
+
}
|
488
|
+
case 11 /* IOTag.Commit */:
|
489
|
+
{
|
490
|
+
op = tsplus_module_26.atomically(op, fileName_1 + ":592:30");
|
491
|
+
break;
|
492
|
+
}
|
493
|
+
case 13 /* IOTag.External */:
|
494
|
+
{
|
495
|
+
op = op.toIO;
|
496
|
+
break;
|
497
|
+
}
|
498
|
+
case null:
|
499
|
+
{
|
500
|
+
switch (op._tag) {
|
501
|
+
case "Just" /* MaybeTag.Just */:
|
502
|
+
{
|
503
|
+
op = tsplus_module_1.succeedNow(op.value, fileName_1 + ":602:45");
|
504
|
+
break;
|
505
|
+
}
|
506
|
+
case "Nothing" /* MaybeTag.Nothing */:
|
507
|
+
{
|
508
|
+
op = tsplus_module_1.failNow(new tsplus_module_27.NoSuchElementError(), fileName_1 + ":606:42");
|
509
|
+
break;
|
510
|
+
}
|
511
|
+
case "Left" /* EitherTag.Left */:
|
512
|
+
{
|
513
|
+
op = tsplus_module_1.failNow(op.left, fileName_1 + ":610:42");
|
514
|
+
break;
|
515
|
+
}
|
516
|
+
case "Right" /* EitherTag.Right */:
|
517
|
+
{
|
518
|
+
op = tsplus_module_1.succeedNow(op.right, fileName_1 + ":614:45");
|
519
|
+
break;
|
520
|
+
}
|
521
|
+
case "Failure" /* ExitTag.Failure */:
|
522
|
+
{
|
523
|
+
op = tsplus_module_1.failCauseNow(op.cause, fileName_1 + ":618:47");
|
524
|
+
break;
|
525
|
+
}
|
526
|
+
case "Success" /* ExitTag.Success */:
|
527
|
+
{
|
528
|
+
op = tsplus_module_1.succeedNow(op.value, fileName_1 + ":622:45");
|
529
|
+
break;
|
530
|
+
}
|
531
|
+
case "Tag":
|
532
|
+
{
|
533
|
+
op = tsplus_module_28.service(op, fileName_1 + ":626:42");
|
534
|
+
break;
|
535
|
+
}
|
536
|
+
}
|
537
|
+
}
|
538
|
+
}
|
539
|
+
}
|
540
|
+
throw new Error("runLoop must exist with a return statement from within the while loop");
|
541
|
+
}
|
542
|
+
setFiberRef(fiberRef, value) {
|
543
|
+
this._fiberRefs = tsplus_module_2.updateAs(this._fiberRefs, this.fiberId, fiberRef, value);
|
544
|
+
}
|
545
|
+
setFiberRefs(fiberRefs0) {
|
546
|
+
this._fiberRefs = fiberRefs0;
|
547
|
+
}
|
548
|
+
shouldYieldBeforeFork() {
|
549
|
+
if (tsplus_module_3.cooperativeYielding(this._runtimeFlags)) {
|
550
|
+
this._forksSinceYield += 1;
|
551
|
+
return this._forksSinceYield >= MAX_FORKS_BEFORE_YIELD;
|
552
|
+
}
|
553
|
+
return false;
|
554
|
+
}
|
555
|
+
start(effect) {
|
556
|
+
let result = null;
|
557
|
+
if (!this.running) {
|
558
|
+
try {
|
559
|
+
this.running = true;
|
560
|
+
result = this.evaluateEffect(0, effect);
|
561
|
+
} finally {
|
562
|
+
this.running = false;
|
563
|
+
if (!this.inbox.isEmpty) {
|
564
|
+
this.running = true;
|
565
|
+
this.drainQueueLaterOnExecutor();
|
566
|
+
}
|
567
|
+
}
|
568
|
+
} else {
|
569
|
+
this.tell(tsplus_module_16.resume(effect));
|
570
|
+
}
|
571
|
+
return result;
|
572
|
+
}
|
573
|
+
startConcurrently(io) {
|
574
|
+
this.tell(tsplus_module_16.resume(io));
|
575
|
+
}
|
576
|
+
startFork(effect) {
|
577
|
+
this.tell(tsplus_module_16.resume(effect));
|
578
|
+
}
|
579
|
+
startSuspended() {
|
580
|
+
let alreadyCalled = false;
|
581
|
+
const callback = io => {
|
582
|
+
if (!alreadyCalled) {
|
583
|
+
alreadyCalled = true;
|
584
|
+
this.tell(tsplus_module_16.resume(io));
|
585
|
+
}
|
586
|
+
};
|
587
|
+
this._asyncContWith = callback;
|
588
|
+
return callback;
|
589
|
+
}
|
590
|
+
tell(message) {
|
591
|
+
this.inbox.enqueue(message);
|
592
|
+
if (!this.running) {
|
593
|
+
this.running = true;
|
594
|
+
this.drainQueueLaterOnExecutor();
|
595
|
+
}
|
596
|
+
}
|
597
|
+
tellAddChild(child) {
|
598
|
+
return this.tell(tsplus_module_16.stateful(parentFiber => parentFiber.addChild(child)));
|
599
|
+
}
|
600
|
+
tellAddChildren(children) {
|
601
|
+
return this.tell(tsplus_module_16.stateful(parentFiber => parentFiber.addChildren(children)));
|
602
|
+
}
|
603
|
+
tellInterrupt(cause) {
|
604
|
+
this.tell(tsplus_module_16.interruptSignal(cause));
|
605
|
+
}
|
606
|
+
transferChildren(scope) {
|
607
|
+
const children = this._children;
|
608
|
+
if (children !== null && children.size > 0) {
|
609
|
+
const childs = this.childrenChunk(children);
|
610
|
+
this._children = null;
|
611
|
+
if (!tsplus_module_29.isEmpty(childs)) {
|
612
|
+
const flags = this._runtimeFlags;
|
613
|
+
for (const child of childs) {
|
614
|
+
scope.unsafeAdd(this, flags, child);
|
615
|
+
}
|
616
|
+
}
|
617
|
+
}
|
618
|
+
}
|
619
|
+
updateFiberRef(fiberRef, f) {
|
620
|
+
this.setFiberRef(fiberRef, f(this.getFiberRef(fiberRef)));
|
621
|
+
}
|
622
|
+
addInterruptedCause(cause) {
|
623
|
+
const oldSC = this.getFiberRef(tsplus_module_11.interruptedCause);
|
624
|
+
if (tsplus_module_15.contains(cause)(oldSC)) {
|
625
|
+
return;
|
626
|
+
}
|
627
|
+
this.setFiberRef(tsplus_module_11.interruptedCause, tsplus_module_15.sequential(oldSC, cause));
|
628
|
+
}
|
629
|
+
awaitUnsafe(trace) {
|
630
|
+
const exitValue = this._exitValue;
|
631
|
+
if (exitValue !== null) {
|
632
|
+
return tsplus_module_12.succeed(exitValue, fileName_1 + ":746:26");
|
633
|
+
} else {
|
634
|
+
return tsplus_module_31.asyncInterrupt(k => {
|
635
|
+
const cb = exit => k(tsplus_module_1.succeedNow(exit, fileName_1 + ":750:63"));
|
636
|
+
this.addObserver(cb);
|
637
|
+
return tsplus_module_30.left(tsplus_module_1.succeed(() => this.removeObserver(cb), fileName_1 + ":752:32"), fileName_1 + ":752:29");
|
638
|
+
}, this.id, trace);
|
639
|
+
}
|
640
|
+
}
|
641
|
+
childrenChunk(children) {
|
642
|
+
if (children === null) {
|
643
|
+
return tsplus_module_32.empty();
|
644
|
+
}
|
645
|
+
const builder = tsplus_module_29.builder();
|
646
|
+
children.forEach(child => {
|
647
|
+
if (child !== null) {
|
648
|
+
builder.append(child);
|
649
|
+
}
|
650
|
+
});
|
651
|
+
return builder.result();
|
652
|
+
}
|
653
|
+
drainQueueAfterAsync() {
|
654
|
+
let resumption = null;
|
655
|
+
let message = this.inbox.dequeue(null);
|
656
|
+
while (message !== null) {
|
657
|
+
switch (message._tag) {
|
658
|
+
case 0 /* FiberMessageTag.InterruptSignal */:
|
659
|
+
this.processNewInterruptSignal(message.cause);
|
660
|
+
break;
|
661
|
+
case 1 /* FiberMessageTag.Stateful */:
|
662
|
+
this.processStatefulMessage(message.onFiber);
|
663
|
+
break;
|
664
|
+
case 2 /* FiberMessageTag.Resume */:
|
665
|
+
resumption = message.cont;
|
666
|
+
break;
|
667
|
+
}
|
668
|
+
message = this.inbox.dequeue(null);
|
669
|
+
}
|
670
|
+
return resumption;
|
671
|
+
}
|
672
|
+
drainQueueLaterOnExecutor() {
|
673
|
+
// assert(this.running, "Invalid state in FiberRuntime: Fiber is not running");
|
674
|
+
this.getFiberRef(tsplus_module_11.currentScheduler).scheduleTask(() => this.run());
|
130
675
|
}
|
131
|
-
drainQueueOnCurrentThread() {
|
676
|
+
drainQueueOnCurrentThread(depth) {
|
132
677
|
// assert(this.running, "Invalid state in FiberRuntime: Fiber is not running");
|
133
678
|
let recurse = true;
|
134
679
|
while (recurse) {
|
135
680
|
let evaluationSignal = 0 /* EvaluationSignal.Continue */;
|
136
|
-
if (
|
681
|
+
if (tsplus_module_3.currentFiber(this._runtimeFlags)) {
|
137
682
|
// TODO
|
138
683
|
}
|
139
684
|
try {
|
140
685
|
while (evaluationSignal === 0 /* EvaluationSignal.Continue */) {
|
141
|
-
evaluationSignal = this.
|
686
|
+
evaluationSignal = this.inbox.isEmpty ? 2 /* EvaluationSignal.Done */ : this.evaluateMessageWhileSuspended(depth, this.inbox.dequeue(null));
|
142
687
|
}
|
143
688
|
} finally {
|
144
689
|
this.running = false;
|
145
|
-
if (
|
690
|
+
if (tsplus_module_3.currentFiber(this._runtimeFlags)) {
|
146
691
|
// TODO
|
147
692
|
}
|
148
693
|
}
|
149
|
-
if (!this.
|
694
|
+
if (!this.inbox.isEmpty && !this.running) {
|
150
695
|
this.running = true;
|
151
696
|
if (evaluationSignal === 1 /* EvaluationSignal.YieldNow */) {
|
152
697
|
this.drainQueueLaterOnExecutor();
|
@@ -159,441 +704,187 @@ export class FiberRuntime {
|
|
159
704
|
}
|
160
705
|
}
|
161
706
|
}
|
162
|
-
|
163
|
-
// assert(this.running, "Invalid state in FiberRuntime: Fiber is not running");
|
164
|
-
this.getFiberRef(tsplus_module_12.currentScheduler).scheduleTask(() => this.run());
|
165
|
-
}
|
166
|
-
drainQueueWhileRunning(runtimeFlags, lastTrace, cur0) {
|
707
|
+
drainQueueWhileRunning(cur0) {
|
167
708
|
let cur = cur0;
|
168
|
-
|
169
|
-
|
709
|
+
let message = this.inbox.dequeue(null);
|
710
|
+
while (message) {
|
170
711
|
switch (message._tag) {
|
171
712
|
case 0 /* FiberMessageTag.InterruptSignal */:
|
172
713
|
{
|
714
|
+
this.updateLastTrace(cur.trace);
|
173
715
|
this.processNewInterruptSignal(message.cause);
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
case 1 /* FiberMessageTag.GenStackTrace */:
|
178
|
-
{
|
179
|
-
const oldCur = cur;
|
180
|
-
cur = tsplus_module_4.flatMap(stackTrace => {
|
181
|
-
message.onTrace(stackTrace);
|
182
|
-
return oldCur;
|
183
|
-
}, undefined)(tsplus_module_4.stackTrace(undefined));
|
716
|
+
if (this.isInterruptible()) {
|
717
|
+
cur = tsplus_module_1.failCauseNow(message.cause, fileName_1 + ":850:46");
|
718
|
+
}
|
184
719
|
break;
|
185
720
|
}
|
186
|
-
case
|
721
|
+
case 1 /* FiberMessageTag.Stateful */:
|
187
722
|
{
|
188
|
-
message.onFiber
|
723
|
+
this.processStatefulMessage(message.onFiber);
|
189
724
|
break;
|
190
725
|
}
|
191
|
-
case
|
192
|
-
{
|
193
|
-
throw new tsplus_module_14.IllegalStateError("It is illegal to have multiple concurrent run loops in a single fiber");
|
194
|
-
}
|
195
|
-
case 4 /* FiberMessageTag.YieldNow */:
|
726
|
+
case 2 /* FiberMessageTag.Resume */:
|
196
727
|
{
|
197
|
-
|
198
|
-
cur = tsplus_module_4.flatMap(() => oldCur, undefined)(tsplus_module_4.yieldNow);
|
199
|
-
break;
|
728
|
+
throw new tsplus_module_27.IllegalStateError("It is illegal to have multiple concurrent run loops in a single fiber");
|
200
729
|
}
|
201
730
|
}
|
731
|
+
message = this.inbox.dequeue(null);
|
202
732
|
}
|
203
733
|
return cur;
|
204
734
|
}
|
205
|
-
|
735
|
+
ensureStackCapacity(size) {
|
736
|
+
const stack = this._stack;
|
737
|
+
const stackLength = stack.length;
|
738
|
+
if (stackLength < size) {
|
739
|
+
const newSize = (size & size - 1) == 0 ? size : highestOneBit(size) << 1;
|
740
|
+
const newStack = new Array(newSize);
|
741
|
+
copyArray(stack, 0, newStack, 0, stackLength);
|
742
|
+
this._stack = newStack;
|
743
|
+
}
|
744
|
+
}
|
745
|
+
evaluateEffect(initialDepth, effect0) {
|
206
746
|
// assert(this.running, "Invalid state in FiberRuntime: Fiber is not running");
|
207
|
-
this.
|
747
|
+
this._asyncContWith = null;
|
748
|
+
this._blockingOn = null;
|
749
|
+
this.updateLastTrace(effect0.trace);
|
750
|
+
const supervisor = this.getSupervisor();
|
751
|
+
supervisor.unsafeOnResume(this);
|
752
|
+
if (this._stack === null) {
|
753
|
+
this._stack = new Array(INITIAL_STACK_SIZE);
|
754
|
+
}
|
208
755
|
try {
|
209
|
-
let effect;
|
210
|
-
if (tsplus_module_9.interruptible(this._runtimeFlags) && this.isInterrupted()) {
|
211
|
-
effect = tsplus_module_4.failCause(() => this.getInterruptedCause(), fileName_1 + ":247:30");
|
212
|
-
} else {
|
213
|
-
effect = effect0;
|
214
|
-
}
|
756
|
+
let effect = effect0;
|
215
757
|
let finalExit = null;
|
216
758
|
while (effect !== null) {
|
217
759
|
try {
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
this.setExitValue(exit);
|
225
|
-
} else {
|
226
|
-
this.tell(tsplus_module_6.resume(tsplus_module_4.fromExitNow(exit, fileName_1 + ":265:59")));
|
227
|
-
}
|
760
|
+
if (this.shouldInterrupt()) {
|
761
|
+
effect = tsplus_module_1.failCause(() => this.getInterruptedCause(), fileName_1 + ":901:46");
|
762
|
+
}
|
763
|
+
const exit = this.runLoop(effect, 0, this._stackSize, initialDepth, 0);
|
764
|
+
if (exit === null) {
|
765
|
+
this._forksSinceYield = 0;
|
228
766
|
effect = null;
|
229
767
|
} else {
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
this.
|
237
|
-
this.tell(tsplus_module_6.resume(tsplus_module_4.unit));
|
238
|
-
effect = null;
|
768
|
+
this._runtimeFlags = tsplus_module_3.enable(this._runtimeFlags, 64 /* RuntimeFlag.WindDown */);
|
769
|
+
const interruption = this.interruptAllChildren();
|
770
|
+
if (interruption === null) {
|
771
|
+
if (this.inbox.isEmpty) {
|
772
|
+
finalExit = exit;
|
773
|
+
supervisor.unsafeOnEnd(finalExit, this);
|
774
|
+
this.setExitValue(exit);
|
239
775
|
} else {
|
240
|
-
|
776
|
+
this.tell(tsplus_module_16.resume(tsplus_module_1.fromExitNow(exit, fileName_1 + ":921:61")));
|
241
777
|
}
|
242
|
-
} else if (e._ioOpCode === 3 /* IOTag.Async */) {
|
243
778
|
effect = null;
|
244
779
|
} else {
|
245
|
-
|
780
|
+
effect = tsplus_module_1.flatMap(() => tsplus_module_1.fromExitNow(exit, fileName_1 + ":926:77"), this.id.location)(interruption);
|
246
781
|
}
|
782
|
+
}
|
783
|
+
} catch (t) {
|
784
|
+
if (this.isFatal(t)) {
|
785
|
+
// TODO
|
786
|
+
}
|
787
|
+
if (isIOError(t)) {
|
788
|
+
effect = tsplus_module_1.failCauseNow(t.cause, fileName_1 + ":935:49");
|
247
789
|
} else {
|
248
|
-
|
790
|
+
effect = tsplus_module_1.failCauseNow(tsplus_module_15.halt(t), fileName_1 + ":937:49");
|
249
791
|
}
|
250
792
|
}
|
251
793
|
}
|
794
|
+
return finalExit;
|
252
795
|
} finally {
|
796
|
+
this.gcStack();
|
253
797
|
this.getSupervisor().unsafeOnSuspend(this);
|
254
798
|
}
|
255
799
|
}
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
if ((this._runtimeFlags & 8 /* RuntimeFlag.OpSupervision */) !== 0) {
|
263
|
-
this.getSupervisor().unsafeOnEffect(this, cur);
|
264
|
-
}
|
265
|
-
const nextTrace = cur.trace;
|
266
|
-
if (nextTrace !== undefined) lastTrace = nextTrace;
|
267
|
-
cur = this.drainQueueWhileRunning(this._runtimeFlags, lastTrace, cur);
|
268
|
-
ops += 1;
|
269
|
-
if (ops > this.getFiberRef(tsplus_module_12.currentMaxFiberOps)) {
|
270
|
-
ops = 0;
|
271
|
-
const oldCur = cur;
|
272
|
-
const trace = lastTrace;
|
273
|
-
cur = tsplus_module_4.flatMap(() => oldCur, trace)(tsplus_module_4.yieldNow);
|
274
|
-
}
|
275
|
-
try {
|
276
|
-
switch (cur._ioOpCode) {
|
277
|
-
case 2 /* IOTag.Sync */:
|
278
|
-
{
|
279
|
-
const value = cur.i0();
|
280
|
-
const cont = this.getNextSuccessCont();
|
281
|
-
if (cont) {
|
282
|
-
switch (cont._ioOpCode) {
|
283
|
-
case 5 /* IOTag.OnSuccess */:
|
284
|
-
{
|
285
|
-
cur = cont.i1(value);
|
286
|
-
break;
|
287
|
-
}
|
288
|
-
case 4 /* IOTag.OnSuccessAndFailure */:
|
289
|
-
{
|
290
|
-
cur = cont.i2(value);
|
291
|
-
break;
|
292
|
-
}
|
293
|
-
case 11 /* IOTag.WhileLoop */:
|
294
|
-
{
|
295
|
-
cont.i2(value);
|
296
|
-
if (cont.i0()) {
|
297
|
-
this.stack.push(cont);
|
298
|
-
cur = cont.i1();
|
299
|
-
} else {
|
300
|
-
cur = tsplus_module_4.unit;
|
301
|
-
}
|
302
|
-
break;
|
303
|
-
}
|
304
|
-
case 14 /* IOTag.RevertFlags */:
|
305
|
-
{
|
306
|
-
this.patchRuntimeFlags(this._runtimeFlags, cont.patch);
|
307
|
-
if (tsplus_module_9.interruptible(this._runtimeFlags) && this.isInterrupted()) {
|
308
|
-
cur = tsplus_module_4.failCauseNow(this.getInterruptedCause(), fileName_1 + ":350:54");
|
309
|
-
} else {
|
310
|
-
cur = tsplus_module_4.succeedNow(value, fileName_1 + ":352:52");
|
311
|
-
}
|
312
|
-
break;
|
313
|
-
}
|
314
|
-
case 15 /* IOTag.UpdateTrace */:
|
315
|
-
{
|
316
|
-
if (cont.trace !== undefined) lastTrace = cont.trace;
|
317
|
-
cur = tsplus_module_4.unit;
|
318
|
-
break;
|
319
|
-
}
|
320
|
-
}
|
321
|
-
} else {
|
322
|
-
return tsplus_module_16.succeed(value, fileName_1 + ":363:34");
|
323
|
-
}
|
324
|
-
break;
|
325
|
-
}
|
326
|
-
case 4 /* IOTag.OnSuccessAndFailure */:
|
327
|
-
case 6 /* IOTag.OnFailure */:
|
328
|
-
case 5 /* IOTag.OnSuccess */:
|
329
|
-
{
|
330
|
-
this.stack.push(cur);
|
331
|
-
cur = cur.i0;
|
332
|
-
break;
|
333
|
-
}
|
334
|
-
case 3 /* IOTag.Async */:
|
335
|
-
{
|
336
|
-
this.asyncTrace = lastTrace;
|
337
|
-
this.asyncBlockinOn = cur.i1();
|
338
|
-
this.initiateAsync(this._runtimeFlags, cur.i0);
|
339
|
-
throw cur;
|
340
|
-
}
|
341
|
-
case 8 /* IOTag.UpdateRuntimeFlagsWithin */:
|
342
|
-
{
|
343
|
-
const updateFlags = cur.i0;
|
344
|
-
const oldRuntimeFlags = this._runtimeFlags;
|
345
|
-
const newRuntimeFlags = tsplus_module_10.patch(updateFlags, oldRuntimeFlags);
|
346
|
-
if (newRuntimeFlags === oldRuntimeFlags) {
|
347
|
-
cur = cur.i1(oldRuntimeFlags);
|
348
|
-
} else {
|
349
|
-
if (tsplus_module_9.interruptible(newRuntimeFlags) && this.isInterrupted()) {
|
350
|
-
cur = tsplus_module_4.failCauseNow(this.getInterruptedCause(), fileName_1 + ":389:50");
|
351
|
-
} else {
|
352
|
-
this.patchRuntimeFlags(this._runtimeFlags, updateFlags);
|
353
|
-
const revertFlags = tsplus_module_9.diff(newRuntimeFlags, oldRuntimeFlags);
|
354
|
-
this.stack.push(new RevertFlags(revertFlags));
|
355
|
-
cur = cur.i1(oldRuntimeFlags);
|
356
|
-
}
|
357
|
-
}
|
358
|
-
break;
|
359
|
-
}
|
360
|
-
case 9 /* IOTag.GenerateStackTrace */:
|
361
|
-
{
|
362
|
-
cur = tsplus_module_4.succeedNow(this.generateStackTrace(), fileName_1 + ":400:44");
|
363
|
-
break;
|
364
|
-
}
|
365
|
-
case 10 /* IOTag.Stateful */:
|
366
|
-
{
|
367
|
-
cur = cur.i0(this, new Running(this._runtimeFlags, lastTrace));
|
368
|
-
break;
|
369
|
-
}
|
370
|
-
case 0 /* IOTag.SucceedNow */:
|
371
|
-
{
|
372
|
-
const oldCur = cur;
|
373
|
-
const cont = this.getNextSuccessCont();
|
374
|
-
if (cont) {
|
375
|
-
switch (cont._ioOpCode) {
|
376
|
-
case 5 /* IOTag.OnSuccess */:
|
377
|
-
{
|
378
|
-
cur = cont.i1(oldCur.i0);
|
379
|
-
break;
|
380
|
-
}
|
381
|
-
case 4 /* IOTag.OnSuccessAndFailure */:
|
382
|
-
{
|
383
|
-
cur = cont.i2(oldCur.i0);
|
384
|
-
break;
|
385
|
-
}
|
386
|
-
case 11 /* IOTag.WhileLoop */:
|
387
|
-
{
|
388
|
-
cont.i2(oldCur.i0);
|
389
|
-
if (cont.i0()) {
|
390
|
-
this.stack.push(cont);
|
391
|
-
cur = cont.i1();
|
392
|
-
} else {
|
393
|
-
cur = tsplus_module_4.unit;
|
394
|
-
}
|
395
|
-
break;
|
396
|
-
}
|
397
|
-
case 14 /* IOTag.RevertFlags */:
|
398
|
-
{
|
399
|
-
this.patchRuntimeFlags(this._runtimeFlags, cont.patch);
|
400
|
-
if (tsplus_module_9.interruptible(this._runtimeFlags) && this.isInterrupted()) {
|
401
|
-
cur = tsplus_module_4.failCauseNow(this.getInterruptedCause(), fileName_1 + ":433:54");
|
402
|
-
}
|
403
|
-
break;
|
404
|
-
}
|
405
|
-
case 15 /* IOTag.UpdateTrace */:
|
406
|
-
{
|
407
|
-
if (cont.trace !== undefined) lastTrace = cont.trace;
|
408
|
-
cur = tsplus_module_4.unit;
|
409
|
-
break;
|
410
|
-
}
|
411
|
-
}
|
412
|
-
} else {
|
413
|
-
return tsplus_module_16.succeed(oldCur.i0, fileName_1 + ":444:34");
|
414
|
-
}
|
415
|
-
break;
|
416
|
-
}
|
417
|
-
case 1 /* IOTag.Fail */:
|
418
|
-
{
|
419
|
-
const cause = cur.i0();
|
420
|
-
const cont = this.getNextFailCont();
|
421
|
-
if (cont) {
|
422
|
-
switch (cont._ioOpCode) {
|
423
|
-
case 6 /* IOTag.OnFailure */:
|
424
|
-
case 4 /* IOTag.OnSuccessAndFailure */:
|
425
|
-
{
|
426
|
-
if (!(tsplus_module_9.interruptible(this._runtimeFlags) && this.isInterrupted())) {
|
427
|
-
cur = cont.i1(cause);
|
428
|
-
} else {
|
429
|
-
cur = tsplus_module_4.failCauseNow(tsplus_module_11.stripFailures(cause), fileName_1 + ":458:54");
|
430
|
-
}
|
431
|
-
break;
|
432
|
-
}
|
433
|
-
case 14 /* IOTag.RevertFlags */:
|
434
|
-
{
|
435
|
-
this.patchRuntimeFlags(this._runtimeFlags, cont.patch);
|
436
|
-
if (tsplus_module_9.interruptible(this._runtimeFlags) && this.isInterrupted()) {
|
437
|
-
const interruptedCause = this.getInterruptedCause();
|
438
|
-
if (tsplus_module_11.contains(interruptedCause)(cause)) {
|
439
|
-
cur = tsplus_module_4.failCauseNow(cause, fileName_1 + ":467:56");
|
440
|
-
} else {
|
441
|
-
cur = tsplus_module_4.failCauseNow(tsplus_module_11.sequential(cause, this.getInterruptedCause()), fileName_1 + ":469:56");
|
442
|
-
}
|
443
|
-
}
|
444
|
-
break;
|
445
|
-
}
|
446
|
-
case 15 /* IOTag.UpdateTrace */:
|
447
|
-
{
|
448
|
-
if (cont.trace !== undefined) lastTrace = cont.trace;
|
449
|
-
cur = tsplus_module_4.unit;
|
450
|
-
break;
|
451
|
-
}
|
452
|
-
}
|
453
|
-
} else {
|
454
|
-
return tsplus_module_16.failCause(cause, fileName_1 + ":481:36");
|
455
|
-
}
|
456
|
-
break;
|
457
|
-
}
|
458
|
-
case 7 /* IOTag.UpdateRuntimeFlags */:
|
459
|
-
{
|
460
|
-
this.patchRuntimeFlags(this._runtimeFlags, cur.i0);
|
461
|
-
cur = tsplus_module_4.unit;
|
462
|
-
break;
|
463
|
-
}
|
464
|
-
case 11 /* IOTag.WhileLoop */:
|
465
|
-
{
|
466
|
-
const iterate = cur;
|
467
|
-
const check = iterate.i0;
|
468
|
-
const body = iterate.i1;
|
469
|
-
if (check()) {
|
470
|
-
cur = body();
|
471
|
-
this.stack.push(iterate);
|
472
|
-
} else {
|
473
|
-
cur = tsplus_module_4.unit;
|
474
|
-
}
|
475
|
-
break;
|
476
|
-
}
|
477
|
-
case 12 /* IOTag.YieldNow */:
|
478
|
-
{
|
479
|
-
throw cur;
|
480
|
-
}
|
481
|
-
case 13 /* IOTag.Commit */:
|
482
|
-
{
|
483
|
-
cur = tsplus_module_17.atomically(cur, fileName_1 + ":506:34");
|
484
|
-
break;
|
485
|
-
}
|
486
|
-
case 16 /* IOTag.External */:
|
487
|
-
{
|
488
|
-
cur = cur.toIO;
|
489
|
-
break;
|
490
|
-
}
|
491
|
-
case null:
|
492
|
-
{
|
493
|
-
switch (cur._tag) {
|
494
|
-
case "Just" /* MaybeTag.Just */:
|
495
|
-
{
|
496
|
-
cur = tsplus_module_4.succeedNow(cur.value, fileName_1 + ":516:48");
|
497
|
-
break;
|
498
|
-
}
|
499
|
-
case "Nothing" /* MaybeTag.Nothing */:
|
500
|
-
{
|
501
|
-
cur = tsplus_module_4.failNow(new tsplus_module_14.NoSuchElementError(), fileName_1 + ":520:45");
|
502
|
-
break;
|
503
|
-
}
|
504
|
-
case "Left" /* EitherTag.Left */:
|
505
|
-
{
|
506
|
-
cur = tsplus_module_4.failNow(cur.left, fileName_1 + ":524:45");
|
507
|
-
break;
|
508
|
-
}
|
509
|
-
case "Right" /* EitherTag.Right */:
|
510
|
-
{
|
511
|
-
cur = tsplus_module_4.succeedNow(cur.right, fileName_1 + ":528:48");
|
512
|
-
break;
|
513
|
-
}
|
514
|
-
case "Failure" /* ExitTag.Failure */:
|
515
|
-
{
|
516
|
-
cur = tsplus_module_4.failCauseNow(cur.cause, fileName_1 + ":532:50");
|
517
|
-
break;
|
518
|
-
}
|
519
|
-
case "Success" /* ExitTag.Success */:
|
520
|
-
{
|
521
|
-
cur = tsplus_module_4.succeedNow(cur.value, fileName_1 + ":536:48");
|
522
|
-
break;
|
523
|
-
}
|
524
|
-
case "Tag":
|
525
|
-
{
|
526
|
-
cur = tsplus_module_18.service(cur, fileName_1 + ":540:45");
|
527
|
-
break;
|
528
|
-
}
|
529
|
-
}
|
530
|
-
}
|
800
|
+
evaluateMessageWhileSuspended(depth, fiberMessage) {
|
801
|
+
switch (fiberMessage._tag) {
|
802
|
+
case 0 /* FiberMessageTag.InterruptSignal */:
|
803
|
+
{
|
804
|
+
this.processNewInterruptSignal(fiberMessage.cause);
|
805
|
+
return 0 /* EvaluationSignal.Continue */;
|
531
806
|
}
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
807
|
+
case 1 /* FiberMessageTag.Stateful */:
|
808
|
+
{
|
809
|
+
this.processStatefulMessage(fiberMessage.onFiber);
|
810
|
+
return 0 /* EvaluationSignal.Continue */;
|
811
|
+
}
|
812
|
+
case 2 /* FiberMessageTag.Resume */:
|
813
|
+
{
|
814
|
+
const nextEffect = fiberMessage.cont;
|
815
|
+
const exit = this.evaluateEffect(depth, nextEffect);
|
816
|
+
if (exit === null) {
|
817
|
+
return 1 /* EvaluationSignal.YieldNow */;
|
818
|
+
}
|
819
|
+
return 0 /* EvaluationSignal.Continue */;
|
541
820
|
}
|
542
|
-
}
|
543
821
|
}
|
544
822
|
}
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
823
|
+
/**
|
824
|
+
* Removes references of entries from the stack higher than the current index
|
825
|
+
* so that they can be garbage collected.
|
826
|
+
*
|
827
|
+
* @note
|
828
|
+
* We only GC up to the {@link STACK_IDX_GC_THRESHOLD} index because
|
829
|
+
* we know that entries in indices higher than that have been auto-gc'd
|
830
|
+
* during the runloop
|
831
|
+
* @note
|
832
|
+
* This method MUST be invoked by the fiber itself while it's still running.
|
833
|
+
*/
|
834
|
+
gcStack() {
|
835
|
+
const fromIndex = this._stackSize;
|
836
|
+
if (fromIndex === 0) {
|
837
|
+
this._stack = null;
|
838
|
+
} else {
|
839
|
+
const stack = this._stack;
|
840
|
+
const toIndex = Math.min(STACK_IDX_GC_THRESHOLD, stack.length);
|
841
|
+
if (fromIndex < toIndex && stack[fromIndex] !== null) {
|
842
|
+
stack.fill(null, fromIndex, toIndex);
|
843
|
+
}
|
554
844
|
}
|
555
|
-
return tsplus_module_24.initial(fiberRef);
|
556
845
|
}
|
557
|
-
|
558
|
-
this.
|
559
|
-
|
560
|
-
|
561
|
-
this.
|
846
|
+
getStatus() {
|
847
|
+
if (this._exitValue !== null) {
|
848
|
+
return tsplus_module_25.done;
|
849
|
+
} else {
|
850
|
+
if (this._asyncContWith !== null) {
|
851
|
+
return tsplus_module_25.suspended(this._runtimeFlags, this._blockingOn ?? tsplus_module_33.none, this._lastTrace);
|
852
|
+
} else {
|
853
|
+
return tsplus_module_25.running(this._runtimeFlags, this._lastTrace);
|
854
|
+
}
|
562
855
|
}
|
563
856
|
}
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
857
|
+
initiateAsync(asyncRegister) {
|
858
|
+
let alreadyCalled = false;
|
859
|
+
const callback = effect => {
|
860
|
+
if (!alreadyCalled) {
|
861
|
+
alreadyCalled = true;
|
862
|
+
this.tell(tsplus_module_16.resume(effect));
|
863
|
+
}
|
864
|
+
};
|
865
|
+
if (this.isInterruptible()) {
|
866
|
+
this._asyncContWith = callback;
|
867
|
+
} else {
|
868
|
+
this._asyncContWith = () => void 0;
|
573
869
|
}
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
return newRuntimeFlags;
|
586
|
-
}
|
587
|
-
sendInterruptSignalToAllChildren() {
|
588
|
-
if (this._children === null || this._children.size === 0) return false;else {
|
589
|
-
let told = false;
|
590
|
-
for (const child of this._children) {
|
591
|
-
if (child !== null) {
|
592
|
-
child.tell(tsplus_module_6.interruptSignal(tsplus_module_11.interrupt(this.id)));
|
593
|
-
told = true;
|
870
|
+
try {
|
871
|
+
const sync = asyncRegister(callback);
|
872
|
+
if (sync != null) {
|
873
|
+
if (!alreadyCalled) {
|
874
|
+
alreadyCalled = true;
|
875
|
+
this._asyncContWith = null;
|
876
|
+
this._blockingOn = null;
|
877
|
+
return sync;
|
878
|
+
} else {
|
879
|
+
this.log(() => "Async operation attempted synchronous resumption, but its callback was already invoked; synchronous value will be discarded", tsplus_module_15.empty(), tsplus_module_5.just(tsplus_module_19.Error, fileName_1 + ":1039:17"), this.id.location);
|
880
|
+
return null;
|
594
881
|
}
|
882
|
+
} else {
|
883
|
+
return null;
|
595
884
|
}
|
596
|
-
|
885
|
+
} catch (t) {
|
886
|
+
callback(tsplus_module_1.failCauseNow(tsplus_module_15.halt(t), fileName_1 + ":1049:31"));
|
887
|
+
return null;
|
597
888
|
}
|
598
889
|
}
|
599
890
|
interruptAllChildren() {
|
@@ -609,10 +900,10 @@ export class FiberRuntime {
|
|
609
900
|
if (value != null && !value.done) {
|
610
901
|
return value.value.await;
|
611
902
|
} else {
|
612
|
-
return
|
903
|
+
return tsplus_module_1.unit;
|
613
904
|
}
|
614
905
|
};
|
615
|
-
const io = new IOPrimitive(
|
906
|
+
const io = new IOPrimitive(9 /* IOTag.WhileLoop */);
|
616
907
|
io.i0 = check;
|
617
908
|
io.i1 = body;
|
618
909
|
io.i2 = () => {
|
@@ -623,170 +914,123 @@ export class FiberRuntime {
|
|
623
914
|
return null;
|
624
915
|
}
|
625
916
|
}
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
|
917
|
+
isInterruptible() {
|
918
|
+
return tsplus_module_3.interruptible(this._runtimeFlags);
|
919
|
+
}
|
920
|
+
patchRuntimeFlags(patch, cause, continueEffect) {
|
921
|
+
const changed = this.patchRuntimeFlagsOnly(patch);
|
922
|
+
const interruptEnabled = tsplus_module_4.isEnabledPatch(patch, 1 /* RuntimeFlag.Interruption */);
|
923
|
+
if (changed && interruptEnabled && this.shouldInterrupt()) {
|
924
|
+
if (cause !== null) {
|
925
|
+
return tsplus_module_1.failCauseNow(tsplus_module_15.sequential(cause, this.getInterruptedCause()), fileName_1 + ":1103:43");
|
926
|
+
} else {
|
927
|
+
return tsplus_module_1.failCauseNow(this.getInterruptedCause(), fileName_1 + ":1105:43");
|
632
928
|
}
|
633
|
-
}
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
} catch (e) {
|
638
|
-
callback(tsplus_module_4.failCauseNow(tsplus_module_11.halt(e), fileName_1 + ":681:31"));
|
929
|
+
} else if (cause !== null) {
|
930
|
+
return tsplus_module_1.failCauseNow(cause, fileName_1 + ":1108:41");
|
931
|
+
} else {
|
932
|
+
return continueEffect;
|
639
933
|
}
|
640
934
|
}
|
641
|
-
|
642
|
-
|
935
|
+
patchRuntimeFlagsOnly(patch) {
|
936
|
+
const oldFlags = this._runtimeFlags;
|
937
|
+
const newFlags = tsplus_module_4.patch(patch, oldFlags);
|
938
|
+
const changed = oldFlags !== newFlags;
|
939
|
+
if (changed) {
|
940
|
+
if (tsplus_module_4.isEnabledPatch(patch, 2 /* RuntimeFlag.CurrentFiber */)) {
|
941
|
+
// TODO
|
942
|
+
} else {
|
943
|
+
// TODO
|
944
|
+
}
|
945
|
+
this._runtimeFlags = newFlags;
|
946
|
+
}
|
947
|
+
return changed;
|
643
948
|
}
|
644
|
-
|
645
|
-
|
646
|
-
|
647
|
-
|
949
|
+
/**
|
950
|
+
* Sets the `_stackSize` to `nextStackIndex`.
|
951
|
+
*
|
952
|
+
* This method might also null out the entry in the stack to allow it to be
|
953
|
+
* GC'd, but only if the index is >= `FiberRuntime.StackIdxGcThreshold`.
|
954
|
+
*
|
955
|
+
* This is based on the assumption that when the stack is shallow, the entries
|
956
|
+
* in the array will keep being overwritten as the pointer moves up and down.
|
957
|
+
*/
|
958
|
+
popStackFrame(nextStackIndex) {
|
959
|
+
if (nextStackIndex >= STACK_IDX_GC_THRESHOLD) {
|
960
|
+
this._stack[nextStackIndex] = null;
|
648
961
|
}
|
649
|
-
this.
|
962
|
+
this._stackSize = nextStackIndex;
|
650
963
|
}
|
651
964
|
processNewInterruptSignal(cause) {
|
652
965
|
this.addInterruptedCause(cause);
|
653
966
|
this.sendInterruptSignalToAllChildren();
|
654
|
-
|
655
|
-
|
656
|
-
|
657
|
-
case 0 /* FiberMessageTag.InterruptSignal */:
|
658
|
-
{
|
659
|
-
this.processNewInterruptSignal(fiberMessage.cause);
|
660
|
-
if (this.asyncInterruptor !== null) {
|
661
|
-
this.asyncInterruptor(tsplus_module_4.failCause(() => fiberMessage.cause, fileName_1 + ":708:45"));
|
662
|
-
this.asyncInterruptor = null;
|
663
|
-
}
|
664
|
-
return 0 /* EvaluationSignal.Continue */;
|
665
|
-
}
|
666
|
-
case 1 /* FiberMessageTag.GenStackTrace */:
|
667
|
-
{
|
668
|
-
fiberMessage.onTrace(this.generateStackTrace());
|
669
|
-
return 0 /* EvaluationSignal.Continue */;
|
670
|
-
}
|
671
|
-
case 2 /* FiberMessageTag.Stateful */:
|
672
|
-
{
|
673
|
-
let status;
|
674
|
-
if (this._exitValue !== null) {
|
675
|
-
status = new Done();
|
676
|
-
} else if (this.asyncTrace === null) {
|
677
|
-
status = new Running(this._runtimeFlags, null);
|
678
|
-
} else {
|
679
|
-
status = new Suspended(this._runtimeFlags, this.asyncBlockinOn, this.asyncTrace);
|
680
|
-
}
|
681
|
-
fiberMessage.onFiber(this, status);
|
682
|
-
return 0 /* EvaluationSignal.Continue */;
|
683
|
-
}
|
684
|
-
case 3 /* FiberMessageTag.Resume */:
|
685
|
-
{
|
686
|
-
this.asyncInterruptor = null;
|
687
|
-
this.asyncTrace = null;
|
688
|
-
this.asyncBlockinOn = null;
|
689
|
-
this.evaluateEffect(fiberMessage.cont);
|
690
|
-
return 0 /* EvaluationSignal.Continue */;
|
691
|
-
}
|
692
|
-
case 4 /* FiberMessageTag.YieldNow */:
|
693
|
-
{
|
694
|
-
return 1 /* EvaluationSignal.YieldNow */;
|
695
|
-
}
|
967
|
+
const k = this._asyncContWith;
|
968
|
+
if (k !== null) {
|
969
|
+
k(tsplus_module_1.failCauseNow(cause, fileName_1 + ":1154:24"));
|
696
970
|
}
|
697
971
|
}
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
-
|
972
|
+
processStatefulMessage(onFiber) {
|
973
|
+
try {
|
974
|
+
onFiber(this);
|
975
|
+
} catch (t) {
|
976
|
+
if (this.isFatal(t)) {
|
977
|
+
// TODO
|
978
|
+
} else {
|
979
|
+
this.log(() => `An unexpected error was encountered while processing stateful fiber message with callback ${onFiber}`, tsplus_module_15.halt(t), tsplus_module_5.just(tsplus_module_19.Error, fileName_1 + ":1168:15"), this.id.location);
|
980
|
+
}
|
703
981
|
}
|
704
|
-
return new Trace(this.fiberId, builder.result());
|
705
982
|
}
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
|
983
|
+
pushStackFrame(k, stackIndex) {
|
984
|
+
const newSize = stackIndex + 1;
|
985
|
+
this.ensureStackCapacity(newSize);
|
986
|
+
this._stack[stackIndex] = k;
|
987
|
+
this._stackSize = newSize;
|
988
|
+
return newSize;
|
712
989
|
}
|
713
|
-
|
714
|
-
this.
|
990
|
+
run() {
|
991
|
+
this.drainQueueOnCurrentThread(0);
|
715
992
|
}
|
716
|
-
|
717
|
-
if (
|
718
|
-
|
719
|
-
|
720
|
-
|
721
|
-
|
722
|
-
|
723
|
-
if (!this.queue.isEmpty) {
|
724
|
-
this.drainQueueLaterOnExecutor();
|
993
|
+
sendInterruptSignalToAllChildren() {
|
994
|
+
if (this._children === null || this._children.size === 0) return false;else {
|
995
|
+
let told = false;
|
996
|
+
for (const child of this._children) {
|
997
|
+
if (child !== null) {
|
998
|
+
child.tell(tsplus_module_16.interruptSignal(tsplus_module_15.interrupt(this.id)));
|
999
|
+
told = true;
|
725
1000
|
}
|
726
1001
|
}
|
727
|
-
|
728
|
-
this.tell(tsplus_module_6.resume(effect));
|
1002
|
+
return told;
|
729
1003
|
}
|
730
1004
|
}
|
731
|
-
|
732
|
-
this.
|
733
|
-
|
734
|
-
|
735
|
-
this.setFiberRef(fiberRef, f(this.getFiberRef(fiberRef)));
|
736
|
-
}
|
737
|
-
removeObserver(observer) {
|
738
|
-
this.observers = tsplus_module_25.filter(f => f !== observer)(this.observers);
|
739
|
-
}
|
740
|
-
addChild(child) {
|
741
|
-
this.getChildren().add(child);
|
742
|
-
}
|
743
|
-
removeChild(child) {
|
744
|
-
if (this._children !== null) {
|
745
|
-
this._children.delete(child);
|
1005
|
+
setExitValue(exit) {
|
1006
|
+
this._exitValue = exit;
|
1007
|
+
for (const observer of this.observers) {
|
1008
|
+
observer(exit);
|
746
1009
|
}
|
1010
|
+
this.observers = tsplus_module_7.empty();
|
747
1011
|
}
|
748
|
-
|
749
|
-
return
|
750
|
-
}
|
751
|
-
log(message, cause, overrideLogLevel, trace) {
|
752
|
-
const logLevel = tsplus_module_27.getOrElse(() => this.getFiberRef(tsplus_module_12.currentLogLevel))(overrideLogLevel);
|
753
|
-
const spans = this.getFiberRef(tsplus_module_12.currentLogSpan);
|
754
|
-
const annotations = this.getFiberRef(tsplus_module_12.currentLogAnnotations);
|
755
|
-
const contextMap = this.getFiberRefs();
|
756
|
-
tsplus_module_30.filterLogLevel(level => tsplus_module_28.gte(tsplus_module_28.Info)(level))(tsplus_module_30.map(s => console.log(s))(tsplus_module_29.defaultString)).log(tsplus_module_20.parse(trace), this.fiberId, logLevel, message, cause, contextMap, spans, annotations);
|
757
|
-
}
|
758
|
-
deleteFiberRef(ref) {
|
759
|
-
this._fiberRefs = tsplus_module_8.remove(this._fiberRefs, ref);
|
760
|
-
}
|
761
|
-
get status() {
|
762
|
-
return this.ask((_, status) => status);
|
763
|
-
}
|
764
|
-
get trace() {
|
765
|
-
return tsplus_module_4.defer(() => {
|
766
|
-
const future = tsplus_module_3.unsafeMake(this.fiberId);
|
767
|
-
this.tell(tsplus_module_6.genStackTrace(trace => tsplus_module_5.unsafeDone(tsplus_module_4.succeedNow(trace, fileName_1 + ":845:86"), fileName_1 + ":845:72")(future)));
|
768
|
-
return tsplus_module_5.wait(future, fileName_1 + ":846:20");
|
769
|
-
}, fileName_1 + ":843:20");
|
770
|
-
}
|
771
|
-
getNextSuccessCont() {
|
772
|
-
while (this.stack.hasNext) {
|
773
|
-
const frame = this.stack.pop();
|
774
|
-
if (frame._ioOpCode !== 6 /* IOTag.OnFailure */) {
|
775
|
-
return frame;
|
776
|
-
}
|
777
|
-
}
|
1012
|
+
shouldInterrupt() {
|
1013
|
+
return this.isInterruptible() && this.isInterrupted();
|
778
1014
|
}
|
779
|
-
|
780
|
-
|
781
|
-
|
782
|
-
if (frame._ioOpCode !== 5 /* IOTag.OnSuccess */ && frame._ioOpCode !== 11 /* IOTag.WhileLoop */) {
|
783
|
-
return frame;
|
784
|
-
}
|
1015
|
+
updateLastTrace(newTrace) {
|
1016
|
+
if (newTrace !== null && newTrace !== "" && this._lastTrace !== newTrace) {
|
1017
|
+
this._lastTrace = newTrace;
|
785
1018
|
}
|
786
1019
|
}
|
787
|
-
isFatal(t) {
|
788
|
-
return this.getFiberRef(tsplus_module_12.currentIsFatal).apply(t);
|
789
|
-
}
|
790
1020
|
}
|
791
1021
|
_a = FiberTypeId;
|
1022
|
+
export function highestOneBit(i) {
|
1023
|
+
i |= i >> 1;
|
1024
|
+
i |= i >> 2;
|
1025
|
+
i |= i >> 4;
|
1026
|
+
i |= i >> 8;
|
1027
|
+
i |= i >> 16;
|
1028
|
+
return i - (i >>> 1);
|
1029
|
+
}
|
1030
|
+
function copyArray(source, sourcePos, dest, destPos, length) {
|
1031
|
+
const j = Math.min(source.length, sourcePos + length);
|
1032
|
+
for (let i = sourcePos; i < j; i++) {
|
1033
|
+
dest[destPos + i - sourcePos] = source[i];
|
1034
|
+
}
|
1035
|
+
}
|
792
1036
|
//# sourceMappingURL=FiberRuntime.mjs.map
|