@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
package/_src/IO/definition.ts
CHANGED
@@ -37,6 +37,7 @@ export declare namespace IO {
|
|
37
37
|
export type EnvironmentOf<T> = [T] extends [{ [IOVariance]: { _R: () => infer R } }] ? R : never;
|
38
38
|
export type ErrorOf<T> = [T] extends [{ [IOVariance]: { _E: () => infer E } }] ? E : never;
|
39
39
|
export type ValueOf<T> = [T] extends [{ [IOVariance]: { _A: () => infer A } }] ? A : never;
|
40
|
+
export type Concrete = Primitive;
|
40
41
|
}
|
41
42
|
|
42
43
|
declare module "@fncts/base/data/Either/definition" {
|
@@ -90,15 +91,12 @@ export const enum IOTag {
|
|
90
91
|
Async,
|
91
92
|
OnSuccessAndFailure,
|
92
93
|
OnSuccess,
|
93
|
-
OnFailure,
|
94
94
|
UpdateRuntimeFlags,
|
95
95
|
UpdateRuntimeFlagsWithin,
|
96
|
-
GenerateStackTrace,
|
97
96
|
Stateful,
|
98
97
|
WhileLoop,
|
99
98
|
YieldNow,
|
100
99
|
Commit,
|
101
|
-
RevertFlags,
|
102
100
|
UpdateTrace,
|
103
101
|
External,
|
104
102
|
}
|
@@ -130,7 +128,7 @@ export interface Sync<A = any>
|
|
130
128
|
}
|
131
129
|
> {}
|
132
130
|
|
133
|
-
export interface Async
|
131
|
+
export interface Async
|
134
132
|
extends IOOp<
|
135
133
|
IOTag.Async,
|
136
134
|
{
|
@@ -151,16 +149,6 @@ export interface OnSuccessAndFailure
|
|
151
149
|
}
|
152
150
|
> {}
|
153
151
|
|
154
|
-
export interface OnFailure
|
155
|
-
extends IOOp<
|
156
|
-
IOTag.OnFailure,
|
157
|
-
{
|
158
|
-
readonly i0: Primitive;
|
159
|
-
readonly i1: (cause: Cause<unknown>) => Primitive;
|
160
|
-
readonly trace: string | undefined;
|
161
|
-
}
|
162
|
-
> {}
|
163
|
-
|
164
152
|
export interface OnSuccess
|
165
153
|
extends IOOp<
|
166
154
|
IOTag.OnSuccess,
|
@@ -171,7 +159,7 @@ export interface OnSuccess
|
|
171
159
|
}
|
172
160
|
> {}
|
173
161
|
|
174
|
-
export interface
|
162
|
+
export interface Succeed
|
175
163
|
extends IOOp<
|
176
164
|
IOTag.SucceedNow,
|
177
165
|
{
|
@@ -199,14 +187,6 @@ export interface UpdateRuntimeFlagsWithin
|
|
199
187
|
}
|
200
188
|
> {}
|
201
189
|
|
202
|
-
export interface GenerateStackTrace
|
203
|
-
extends IOOp<
|
204
|
-
IOTag.GenerateStackTrace,
|
205
|
-
{
|
206
|
-
readonly trace: string | undefined;
|
207
|
-
}
|
208
|
-
> {}
|
209
|
-
|
210
190
|
export interface Stateful
|
211
191
|
extends IOOp<
|
212
192
|
IOTag.Stateful,
|
@@ -246,14 +226,12 @@ export interface Fail
|
|
246
226
|
|
247
227
|
export type Primitive =
|
248
228
|
| OnSuccessAndFailure
|
249
|
-
| OnFailure
|
250
229
|
| OnSuccess
|
251
230
|
| UpdateRuntimeFlagsWithin
|
252
231
|
| Sync
|
253
232
|
| Async
|
254
|
-
|
|
233
|
+
| Succeed
|
255
234
|
| UpdateRuntimeFlags
|
256
|
-
| GenerateStackTrace
|
257
235
|
| Stateful
|
258
236
|
| WhileLoop
|
259
237
|
| YieldNow
|
@@ -276,8 +254,6 @@ export function concrete(io: IO<any, any, any>): Primitive {
|
|
276
254
|
return io as Primitive;
|
277
255
|
}
|
278
256
|
|
279
|
-
export type EvaluationStep = OnSuccessAndFailure | OnFailure | OnSuccess;
|
280
|
-
|
281
257
|
export type Canceler<R> = URIO<R, void>;
|
282
258
|
|
283
259
|
export abstract class External<R, E, A> extends IOPrimitive implements IO<R, E, A> {
|
package/_src/IO/runtime.ts
CHANGED
package/_src/IO.ts
CHANGED
@@ -5,67 +5,69 @@ export * from "./IO/runtime.js";
|
|
5
5
|
// codegen:end
|
6
6
|
|
7
7
|
// codegen:start { preset: barrel, include: IO/api/*.ts }
|
8
|
-
export * from "./IO/api/acquireRelease.js"
|
9
|
-
export * from "./IO/api/acquireReleaseExit.js"
|
10
|
-
export * from "./IO/api/acquireReleaseInterruptible.js"
|
11
|
-
export * from "./IO/api/acquireReleaseInterruptibleExit.js"
|
12
|
-
export * from "./IO/api/addFinalizer.js"
|
13
|
-
export * from "./IO/api/addFinalizerExit.js"
|
14
|
-
export * from "./IO/api/all.js"
|
15
|
-
export * from "./IO/api/
|
16
|
-
export * from "./IO/api/
|
17
|
-
export * from "./IO/api/
|
18
|
-
export * from "./IO/api/
|
19
|
-
export * from "./IO/api/
|
20
|
-
export * from "./IO/api/
|
21
|
-
export * from "./IO/api/
|
22
|
-
export * from "./IO/api/
|
23
|
-
export * from "./IO/api/
|
24
|
-
export * from "./IO/api/
|
25
|
-
export * from "./IO/api/
|
26
|
-
export * from "./IO/api/
|
27
|
-
export * from "./IO/api/
|
28
|
-
export * from "./IO/api/
|
29
|
-
export * from "./IO/api/
|
30
|
-
export * from "./IO/api/
|
31
|
-
export * from "./IO/api/
|
32
|
-
export * from "./IO/api/
|
33
|
-
export * from "./IO/api/
|
34
|
-
export * from "./IO/api/
|
35
|
-
export * from "./IO/api/
|
36
|
-
export * from "./IO/api/
|
37
|
-
export * from "./IO/api/
|
38
|
-
export * from "./IO/api/
|
39
|
-
export * from "./IO/api/
|
40
|
-
export * from "./IO/api/
|
41
|
-
export * from "./IO/api/
|
42
|
-
export * from "./IO/api/
|
43
|
-
export * from "./IO/api/
|
44
|
-
export * from "./IO/api/
|
45
|
-
export * from "./IO/api/
|
46
|
-
export * from "./IO/api/
|
47
|
-
export * from "./IO/api/
|
48
|
-
export * from "./IO/api/
|
49
|
-
export * from "./IO/api/
|
50
|
-
export * from "./IO/api/
|
51
|
-
export * from "./IO/api/
|
52
|
-
export * from "./IO/api/
|
53
|
-
export * from "./IO/api/
|
54
|
-
export * from "./IO/api/
|
55
|
-
export * from "./IO/api/
|
56
|
-
export * from "./IO/api/
|
57
|
-
export * from "./IO/api/
|
58
|
-
export * from "./IO/api/
|
59
|
-
export * from "./IO/api/
|
60
|
-
export * from "./IO/api/
|
61
|
-
export * from "./IO/api/
|
62
|
-
export * from "./IO/api/
|
63
|
-
export * from "./IO/api/
|
64
|
-
export * from "./IO/api/
|
65
|
-
export * from "./IO/api/
|
66
|
-
export * from "./IO/api/
|
67
|
-
export * from "./IO/api/
|
68
|
-
export * from "./IO/api/
|
69
|
-
export * from "./IO/api/
|
70
|
-
export * from "./IO/api/
|
8
|
+
export * from "./IO/api/acquireRelease.js"
|
9
|
+
export * from "./IO/api/acquireReleaseExit.js"
|
10
|
+
export * from "./IO/api/acquireReleaseInterruptible.js"
|
11
|
+
export * from "./IO/api/acquireReleaseInterruptibleExit.js"
|
12
|
+
export * from "./IO/api/addFinalizer.js"
|
13
|
+
export * from "./IO/api/addFinalizerExit.js"
|
14
|
+
export * from "./IO/api/all.js"
|
15
|
+
export * from "./IO/api/array.js"
|
16
|
+
export * from "./IO/api/asyncInterrupt.js"
|
17
|
+
export * from "./IO/api/asyncIO.js"
|
18
|
+
export * from "./IO/api/awaitAllChildren.js"
|
19
|
+
export * from "./IO/api/blocking.js"
|
20
|
+
export * from "./IO/api/bracket.js"
|
21
|
+
export * from "./IO/api/bracketExit.js"
|
22
|
+
export * from "./IO/api/cachedInvalidate.js"
|
23
|
+
export * from "./IO/api/clockWith.js"
|
24
|
+
export * from "./IO/api/concurrency.js"
|
25
|
+
export * from "./IO/api/concurrentFinalizers.js"
|
26
|
+
export * from "./IO/api/consoleWith.js"
|
27
|
+
export * from "./IO/api/daemonChildren.js"
|
28
|
+
export * from "./IO/api/delay.js"
|
29
|
+
export * from "./IO/api/descriptor.js"
|
30
|
+
export * from "./IO/api/diffFiberRefs.js"
|
31
|
+
export * from "./IO/api/disconnect.js"
|
32
|
+
export * from "./IO/api/ensuringChildren.js"
|
33
|
+
export * from "./IO/api/environment.js"
|
34
|
+
export * from "./IO/api/foreachConcurrent.js"
|
35
|
+
export * from "./IO/api/foreachExec.js"
|
36
|
+
export * from "./IO/api/fork.js"
|
37
|
+
export * from "./IO/api/forkAll.js"
|
38
|
+
export * from "./IO/api/forkDaemon.js"
|
39
|
+
export * from "./IO/api/forkIn.js"
|
40
|
+
export * from "./IO/api/forkScoped.js"
|
41
|
+
export * from "./IO/api/fulfill.js"
|
42
|
+
export * from "./IO/api/interrupt.js"
|
43
|
+
export * from "./IO/api/memoize.js"
|
44
|
+
export * from "./IO/api/once.js"
|
45
|
+
export * from "./IO/api/onTermination.js"
|
46
|
+
export * from "./IO/api/patchFiberRefs.js"
|
47
|
+
export * from "./IO/api/provideLayer.js"
|
48
|
+
export * from "./IO/api/provideScope.js"
|
49
|
+
export * from "./IO/api/provideSomeLayer.js"
|
50
|
+
export * from "./IO/api/provideSomeRuntime.js"
|
51
|
+
export * from "./IO/api/race.js"
|
52
|
+
export * from "./IO/api/raceFirst.js"
|
53
|
+
export * from "./IO/api/raceWith.js"
|
54
|
+
export * from "./IO/api/randomWith.js"
|
55
|
+
export * from "./IO/api/repeat.js"
|
56
|
+
export * from "./IO/api/retry.js"
|
57
|
+
export * from "./IO/api/schedule.js"
|
58
|
+
export * from "./IO/api/scope.js"
|
59
|
+
export * from "./IO/api/scoped.js"
|
60
|
+
export * from "./IO/api/scopeWith.js"
|
61
|
+
export * from "./IO/api/sleep.js"
|
62
|
+
export * from "./IO/api/stateful.js"
|
63
|
+
export * from "./IO/api/supervised.js"
|
64
|
+
export * from "./IO/api/timeout.js"
|
65
|
+
export * from "./IO/api/transplant.js"
|
66
|
+
export * from "./IO/api/whenFiberRef.js"
|
67
|
+
export * from "./IO/api/whenRef.js"
|
68
|
+
export * from "./IO/api/withChildren.js"
|
69
|
+
export * from "./IO/api/withEarlyRelease.js"
|
70
|
+
export * from "./IO/api/withFinalizer.js"
|
71
|
+
export * from "./IO/api/withFinalizerExit.js"
|
72
|
+
export * from "./IO/api/zipConcurrent.js"
|
71
73
|
// codegen:end
|
package/_src/IOEnv/definition.ts
CHANGED
@@ -12,7 +12,4 @@ export const IOEnv: IOEnvOps = {};
|
|
12
12
|
/**
|
13
13
|
* @tsplus static fncts.io.IOEnvOps environment
|
14
14
|
*/
|
15
|
-
export const environment = Environment()
|
16
|
-
.add(Clock.Live, Clock.Tag)
|
17
|
-
.add(Random.Live, Random.Tag)
|
18
|
-
.add(Console.Live, Console.Tag);
|
15
|
+
export const environment = Environment().add(Clock.Live).add(Random.Live).add(Console.Live);
|
@@ -201,8 +201,8 @@ export function modifyJustIO<A, R1, E1, B>(
|
|
201
201
|
* @tsplus pipeable fncts.io.Ref.Synchronized updateAndGetIO
|
202
202
|
*/
|
203
203
|
export function updateAndGetIO<A, R1, E1>(f: (a: A) => IO<R1, E1, A>, __tsplusTrace?: string) {
|
204
|
-
return <RA, RB, EA, EB>(ref: PRef.Synchronized<RA, RB, EA, EB, A, A>): IO<RA | RB | R1, E1 | EA | EB,
|
205
|
-
return ref.modifyIO((a) => f(a).map((r) => [r, r]))
|
204
|
+
return <RA, RB, EA, EB>(ref: PRef.Synchronized<RA, RB, EA, EB, A, A>): IO<RA | RB | R1, E1 | EA | EB, A> => {
|
205
|
+
return ref.modifyIO((a) => f(a).map((r) => [r, r]));
|
206
206
|
};
|
207
207
|
}
|
208
208
|
|
@@ -53,7 +53,7 @@ export class PSynchronizedInternal<RA, RB, EA, EB, A, B> extends RefInternal<RA,
|
|
53
53
|
f: (b: B) => IO<R1, E1, readonly [C, A]>,
|
54
54
|
__tsplusTrace?: string,
|
55
55
|
): IO<RA | RB | R1, EA | EB | E1, C> {
|
56
|
-
return this.withPermit(this.unsafeGet.flatMap(f).flatMap(([
|
56
|
+
return this.withPermit(this.unsafeGet.flatMap(f).flatMap(([c, a]) => this.unsafeSet(a).as(c)));
|
57
57
|
}
|
58
58
|
|
59
59
|
matchAllIO<RC, RD, EC, ED, C, D>(
|
@@ -0,0 +1,15 @@
|
|
1
|
+
/**
|
2
|
+
* @tsplus type fncts.io.Semaphore.Reservation
|
3
|
+
* @tsplus companion fncts.io.Semaphore.ReservationOps
|
4
|
+
*/
|
5
|
+
export class Reservation {
|
6
|
+
constructor(
|
7
|
+
readonly acquire: UIO<void>,
|
8
|
+
readonly release: UIO<void>,
|
9
|
+
) {}
|
10
|
+
}
|
11
|
+
|
12
|
+
/**
|
13
|
+
* @tsplus static fncts.io.Semaphore.ReservationOps zero
|
14
|
+
*/
|
15
|
+
export const zero = new Reservation(IO.unit, IO.unit);
|
@@ -0,0 +1,14 @@
|
|
1
|
+
/**
|
2
|
+
* @tsplus static fncts.io.SemaphoreOps unsafeMake
|
3
|
+
*/
|
4
|
+
export function unsafeMakeSemaphore(permits: number): Semaphore {
|
5
|
+
return new Semaphore(permits);
|
6
|
+
}
|
7
|
+
|
8
|
+
/**
|
9
|
+
* @tsplus static fncts.io.SemaphoreOps make
|
10
|
+
* @tsplus static fncts.io.SemaphoreOps __call
|
11
|
+
*/
|
12
|
+
export function makeSemaphore(permits: number, __tsplusTrace?: string): UIO<Semaphore> {
|
13
|
+
return IO(Semaphore.unsafeMake(permits));
|
14
|
+
}
|
@@ -0,0 +1,180 @@
|
|
1
|
+
import { EitherTag } from "@fncts/base/data/Either";
|
2
|
+
import { IllegalArgumentError } from "@fncts/base/data/exceptions";
|
3
|
+
import { Reservation } from "@fncts/io/Semaphore/Reservation";
|
4
|
+
|
5
|
+
/**
|
6
|
+
* @tsplus type fncts.io.Semaphore
|
7
|
+
* @tsplus companion fncts.io.SemaphoreOps
|
8
|
+
*/
|
9
|
+
export class Semaphore {
|
10
|
+
constructor(readonly permits: number) {}
|
11
|
+
|
12
|
+
ref = Ref.unsafeMake<Either<ImmutableQueue<[Future<never, void>, number]>, number>>(Either.right(this.permits));
|
13
|
+
|
14
|
+
available(__tsplusTrace?: string): UIO<number> {
|
15
|
+
return this.ref.get.map((_) =>
|
16
|
+
_.match(
|
17
|
+
() => 0,
|
18
|
+
(permits) => permits,
|
19
|
+
),
|
20
|
+
);
|
21
|
+
}
|
22
|
+
|
23
|
+
tryReserve(n: number, __tsplusTrace?: string): UIO<Maybe<Reservation>> {
|
24
|
+
if (n < 0) {
|
25
|
+
return IO.halt(new IllegalArgumentError(`Unexpected negative ${n} permits requested`, "Semaphore.tryReserve"));
|
26
|
+
} else if (n === 0) {
|
27
|
+
return IO.succeedNow(Just(Reservation.zero));
|
28
|
+
} else {
|
29
|
+
return this.ref.modify((state) =>
|
30
|
+
state.match(
|
31
|
+
() => [Nothing(), state],
|
32
|
+
(permits) => {
|
33
|
+
if (permits >= n) {
|
34
|
+
return [Just(new Reservation(IO.unit, this.releaseN(n))), Either.right(permits - n)];
|
35
|
+
} else {
|
36
|
+
return [Nothing(), state];
|
37
|
+
}
|
38
|
+
},
|
39
|
+
),
|
40
|
+
);
|
41
|
+
}
|
42
|
+
}
|
43
|
+
|
44
|
+
reserve(n: number, __tsplusTrace?: string): UIO<Reservation> {
|
45
|
+
if (n < 0) {
|
46
|
+
return IO.halt(new IllegalArgumentError(`Unexpected negative ${n} permits requested`, "Semaphore.reserve"));
|
47
|
+
} else if (n === 0) {
|
48
|
+
return IO.succeedNow(Reservation.zero);
|
49
|
+
} else {
|
50
|
+
return Future.make<never, void>().flatMap((future) =>
|
51
|
+
this.ref.modify((state) =>
|
52
|
+
state.match(
|
53
|
+
(queue) => [
|
54
|
+
new Reservation(future.await, this.restore(future, n)),
|
55
|
+
Either.left(queue.enqueue([future, n])),
|
56
|
+
],
|
57
|
+
(permits) => {
|
58
|
+
if (permits >= n) {
|
59
|
+
return [new Reservation(IO.unit, this.releaseN(n)), Either.right(permits - n)];
|
60
|
+
} else {
|
61
|
+
return [
|
62
|
+
new Reservation(future.await, this.restore(future, n)),
|
63
|
+
Either.left(ImmutableQueue.single([future, n - permits])),
|
64
|
+
];
|
65
|
+
}
|
66
|
+
},
|
67
|
+
),
|
68
|
+
),
|
69
|
+
);
|
70
|
+
}
|
71
|
+
}
|
72
|
+
|
73
|
+
restore(future: Future<never, void>, n: number, __tsplusTrace?: string): UIO<void> {
|
74
|
+
return this.ref.modify((state) =>
|
75
|
+
state.match(
|
76
|
+
(queue) =>
|
77
|
+
queue
|
78
|
+
.find(([waiter]) => waiter === future)
|
79
|
+
.match(
|
80
|
+
() => [this.releaseN(n), Either.left(queue)],
|
81
|
+
([_, permits]) => [
|
82
|
+
this.releaseN(n - permits),
|
83
|
+
Either.left(queue.filter(([waiter]) => waiter !== future)),
|
84
|
+
],
|
85
|
+
),
|
86
|
+
(permits) => [IO.unit, Either.right(permits + n)],
|
87
|
+
),
|
88
|
+
).flatten;
|
89
|
+
}
|
90
|
+
|
91
|
+
releaseN(n: number, __tsplusTrace?: string): UIO<void> {
|
92
|
+
const self = this;
|
93
|
+
|
94
|
+
/**
|
95
|
+
* @tsplus tailRec
|
96
|
+
*/
|
97
|
+
function loop(
|
98
|
+
n: number,
|
99
|
+
state: Either<ImmutableQueue<[Future<never, any>, number]>, number>,
|
100
|
+
acc: UIO<void>,
|
101
|
+
): [UIO<void>, Either<ImmutableQueue<[Future<never, any>, number]>, number>] {
|
102
|
+
state.concrete();
|
103
|
+
switch (state._tag) {
|
104
|
+
case EitherTag.Right: {
|
105
|
+
return [acc, Either.right(state.right + n)];
|
106
|
+
}
|
107
|
+
case EitherTag.Left: {
|
108
|
+
const waiter = state.left.dequeue;
|
109
|
+
|
110
|
+
Maybe.concrete(waiter);
|
111
|
+
|
112
|
+
switch (waiter._tag) {
|
113
|
+
case MaybeTag.Nothing: {
|
114
|
+
return [acc, Either.right(self.permits)];
|
115
|
+
}
|
116
|
+
case MaybeTag.Just: {
|
117
|
+
const [[future, permits], queue] = waiter.value;
|
118
|
+
if (n > permits) {
|
119
|
+
return loop(n - permits, Either.left(queue), acc.zipLeft(future.succeed(undefined)));
|
120
|
+
} else if (n === permits) {
|
121
|
+
return [acc.zipRight(future.succeed().asUnit), Either.left(queue)];
|
122
|
+
} else {
|
123
|
+
return [acc, Either.left(queue.prepend([future, permits - n]))];
|
124
|
+
}
|
125
|
+
}
|
126
|
+
}
|
127
|
+
}
|
128
|
+
}
|
129
|
+
}
|
130
|
+
|
131
|
+
return this.ref.modify((state) => loop(n, state, IO.unit)).flatten;
|
132
|
+
}
|
133
|
+
|
134
|
+
tryWithPermits(permits: number) {
|
135
|
+
return <R, E, A>(io: IO<R, E, A>, __tsPlusTrace?: string): IO<R, E, Maybe<A>> => {
|
136
|
+
return this.tryReserve(permits).bracket(
|
137
|
+
(r) =>
|
138
|
+
r.match(
|
139
|
+
() => IO.nothing,
|
140
|
+
() => io.asJust,
|
141
|
+
),
|
142
|
+
(r) =>
|
143
|
+
r.match(
|
144
|
+
() => Exit.unit,
|
145
|
+
(reservation) => reservation.release,
|
146
|
+
),
|
147
|
+
);
|
148
|
+
};
|
149
|
+
}
|
150
|
+
|
151
|
+
tryWithPermit<R, E, A>(io: IO<R, E, A>): IO<R, E, Maybe<A>> {
|
152
|
+
return this.tryWithPermits(1)(io);
|
153
|
+
}
|
154
|
+
|
155
|
+
withPermits(permits: number) {
|
156
|
+
return <R, E, A>(io: IO<R, E, A>): IO<R, E, A> => {
|
157
|
+
return IO.bracket(
|
158
|
+
this.reserve(permits),
|
159
|
+
(reservation) => reservation.acquire > io,
|
160
|
+
(reservation) => reservation.release,
|
161
|
+
);
|
162
|
+
};
|
163
|
+
}
|
164
|
+
|
165
|
+
withPermit<R, E, A>(io: IO<R, E, A>): IO<R, E, A> {
|
166
|
+
return this.withPermits(1)(io);
|
167
|
+
}
|
168
|
+
|
169
|
+
withPermitsScoped(permits: number) {
|
170
|
+
return <R, E, A>(io: IO<R, E, A>): IO<Scope | R, E, A> => {
|
171
|
+
return IO.acquireRelease(this.reserve(permits), (reservation) => reservation.release).flatMap(
|
172
|
+
(reservation) => reservation.acquire > io,
|
173
|
+
);
|
174
|
+
};
|
175
|
+
}
|
176
|
+
|
177
|
+
withPermitScoped<R, E, A>(io: IO<R, E, A>): IO<Scope | R, E, A> {
|
178
|
+
return this.withPermitsScoped(1)(io);
|
179
|
+
}
|
180
|
+
}
|
package/_src/Semaphore.ts
CHANGED
@@ -1,159 +1,5 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
* @tsplus companion fncts.io.SemaphoreOps
|
7
|
-
*/
|
8
|
-
export class Semaphore {
|
9
|
-
constructor(readonly permits: number) {}
|
10
|
-
|
11
|
-
ref = Ref.unsafeMake<Either<ImmutableQueue<[Future<never, void>, number]>, number>>(Either.right(this.permits));
|
12
|
-
|
13
|
-
available(__tsplusTrace?: string): UIO<number> {
|
14
|
-
return this.ref.get.map((_) =>
|
15
|
-
_.match(
|
16
|
-
() => 0,
|
17
|
-
(permits) => permits,
|
18
|
-
),
|
19
|
-
);
|
20
|
-
}
|
21
|
-
|
22
|
-
reserve(n: number, __tsplusTrace?: string): UIO<Reservation> {
|
23
|
-
if (n < 0) {
|
24
|
-
return IO.halt(new IllegalArgumentError(`Unexpected negative ${n} permits requested`, "Semaphore.reserve"));
|
25
|
-
} else if (n === 0) {
|
26
|
-
return IO.succeedNow(new Reservation(IO.unit, IO.unit));
|
27
|
-
} else {
|
28
|
-
return Future.make<never, void>().flatMap((future) =>
|
29
|
-
this.ref.modify((state) =>
|
30
|
-
state.match(
|
31
|
-
(queue) => [
|
32
|
-
new Reservation(future.await, this.restore(future, n)),
|
33
|
-
Either.left(queue.enqueue([future, n])),
|
34
|
-
],
|
35
|
-
(permits) => {
|
36
|
-
if (permits >= n) {
|
37
|
-
return [new Reservation(IO.unit, this.releaseN(n)), Either.right(permits - n)];
|
38
|
-
} else {
|
39
|
-
return [
|
40
|
-
new Reservation(future.await, this.restore(future, n)),
|
41
|
-
Either.left(ImmutableQueue.single([future, n - permits])),
|
42
|
-
];
|
43
|
-
}
|
44
|
-
},
|
45
|
-
),
|
46
|
-
),
|
47
|
-
);
|
48
|
-
}
|
49
|
-
}
|
50
|
-
|
51
|
-
restore(future: Future<never, void>, n: number, __tsplusTrace?: string): UIO<void> {
|
52
|
-
return this.ref.modify((state) =>
|
53
|
-
state.match(
|
54
|
-
(queue) =>
|
55
|
-
queue
|
56
|
-
.find(([waiter]) => waiter === future)
|
57
|
-
.match(
|
58
|
-
() => [this.releaseN(n), Either.left(queue)],
|
59
|
-
([_, permits]) => [
|
60
|
-
this.releaseN(n - permits),
|
61
|
-
Either.left(queue.filter(([waiter]) => waiter !== future)),
|
62
|
-
],
|
63
|
-
),
|
64
|
-
(permits) => [IO.unit, Either.right(permits + n)],
|
65
|
-
),
|
66
|
-
).flatten;
|
67
|
-
}
|
68
|
-
|
69
|
-
releaseN(n: number, __tsplusTrace?: string): UIO<void> {
|
70
|
-
const self = this;
|
71
|
-
|
72
|
-
/**
|
73
|
-
* @tsplus tailRec
|
74
|
-
*/
|
75
|
-
function loop(
|
76
|
-
n: number,
|
77
|
-
state: Either<ImmutableQueue<[Future<never, any>, number]>, number>,
|
78
|
-
acc: UIO<void>,
|
79
|
-
): [UIO<void>, Either<ImmutableQueue<[Future<never, any>, number]>, number>] {
|
80
|
-
state.concrete();
|
81
|
-
switch (state._tag) {
|
82
|
-
case EitherTag.Right: {
|
83
|
-
return [acc, Either.right(state.right + n)];
|
84
|
-
}
|
85
|
-
case EitherTag.Left: {
|
86
|
-
const waiter = state.left.dequeue;
|
87
|
-
|
88
|
-
Maybe.concrete(waiter);
|
89
|
-
|
90
|
-
switch (waiter._tag) {
|
91
|
-
case MaybeTag.Nothing: {
|
92
|
-
return [acc, Either.right(self.permits)];
|
93
|
-
}
|
94
|
-
case MaybeTag.Just: {
|
95
|
-
const [[future, permits], queue] = waiter.value;
|
96
|
-
if (n > permits) {
|
97
|
-
return loop(n - permits, Either.left(queue), acc.zipLeft(future.succeed(undefined)));
|
98
|
-
} else if (n === permits) {
|
99
|
-
return [acc.zipRight(future.succeed().asUnit), Either.left(queue)];
|
100
|
-
} else {
|
101
|
-
return [acc, Either.left(queue.prepend([future, permits - n]))];
|
102
|
-
}
|
103
|
-
}
|
104
|
-
}
|
105
|
-
}
|
106
|
-
}
|
107
|
-
}
|
108
|
-
|
109
|
-
return this.ref.modify((state) => loop(n, state, IO.unit)).flatten;
|
110
|
-
}
|
111
|
-
|
112
|
-
withPermits(permits: number) {
|
113
|
-
return <R, E, A>(io: IO<R, E, A>): IO<R, E, A> => {
|
114
|
-
return IO.bracket(
|
115
|
-
this.reserve(permits),
|
116
|
-
(reservation) => reservation.acquire > io,
|
117
|
-
(reservation) => reservation.release,
|
118
|
-
);
|
119
|
-
};
|
120
|
-
}
|
121
|
-
|
122
|
-
withPermit<R, E, A>(io: IO<R, E, A>): IO<R, E, A> {
|
123
|
-
return this.withPermits(1)(io);
|
124
|
-
}
|
125
|
-
|
126
|
-
withPermitsScoped(permits: number) {
|
127
|
-
return <R, E, A>(io: IO<R, E, A>): IO<Scope | R, E, A> => {
|
128
|
-
return IO.acquireRelease(this.reserve(permits), (reservation) => reservation.release).flatMap(
|
129
|
-
(reservation) => reservation.acquire > io,
|
130
|
-
);
|
131
|
-
};
|
132
|
-
}
|
133
|
-
|
134
|
-
withPermitScoped<R, E, A>(io: IO<R, E, A>): IO<Scope | R, E, A> {
|
135
|
-
return this.withPermitsScoped(1)(io);
|
136
|
-
}
|
137
|
-
}
|
138
|
-
|
139
|
-
export class Reservation {
|
140
|
-
constructor(
|
141
|
-
readonly acquire: UIO<void>,
|
142
|
-
readonly release: UIO<void>,
|
143
|
-
) {}
|
144
|
-
}
|
145
|
-
|
146
|
-
/**
|
147
|
-
* @tsplus static fncts.io.SemaphoreOps unsafeMake
|
148
|
-
*/
|
149
|
-
export function unsafeMakeSemaphore(permits: number): Semaphore {
|
150
|
-
return new Semaphore(permits);
|
151
|
-
}
|
152
|
-
|
153
|
-
/**
|
154
|
-
* @tsplus static fncts.io.SemaphoreOps make
|
155
|
-
* @tsplus static fncts.io.SemaphoreOps __call
|
156
|
-
*/
|
157
|
-
export function makeSemaphore(permits: number, __tsplusTrace?: string): UIO<Semaphore> {
|
158
|
-
return IO(Semaphore.unsafeMake(permits));
|
159
|
-
}
|
1
|
+
// codegen:start { preset: barrel, include: ./Semaphore/*.ts }
|
2
|
+
export * from "./Semaphore/constructors.js"
|
3
|
+
export * from "./Semaphore/definition.js"
|
4
|
+
export * from "./Semaphore/Reservation.js"
|
5
|
+
// codegen:end
|