@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/Channel/api.ts
CHANGED
@@ -8,35 +8,45 @@ import { Channel, ChannelPrimitive, ChannelTag } from "@fncts/io/Channel/definit
|
|
8
8
|
import { UpstreamPullStrategy } from "@fncts/io/Channel/UpstreamPullStrategy";
|
9
9
|
|
10
10
|
/**
|
11
|
-
*
|
12
|
-
* is the specified constant value.
|
13
|
-
*
|
14
|
-
* This method produces the same result as mapping this channel to the specified constant value.
|
15
|
-
*
|
16
|
-
* @tsplus pipeable fncts.io.Channel as
|
11
|
+
* @tsplus static fncts.io.ChannelOps acquireReleaseExitWith
|
17
12
|
*/
|
18
|
-
export function
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
13
|
+
export function acquireReleaseExitWith<Env, InErr, InElem, InDone, OutErr, OutElem1, OutDone, Acquired>(
|
14
|
+
acquire: IO<Env, OutErr, Acquired>,
|
15
|
+
use: (a: Acquired) => Channel<Env, InErr, InElem, InDone, OutErr, OutElem1, OutDone>,
|
16
|
+
release: (a: Acquired, exit: Exit<OutErr, OutDone>) => URIO<Env, any>,
|
17
|
+
): Channel<Env, InErr, InElem, InDone, OutErr, OutElem1, OutDone> {
|
18
|
+
return Channel.fromIO(Ref.make<(exit: Exit<OutErr, OutDone>) => URIO<Env, any>>((_) => IO.unit)).flatMap((ref) =>
|
19
|
+
Channel.fromIO(acquire.tap((a) => ref.set((exit) => release(a, exit))).uninterruptible)
|
20
|
+
.flatMap(use)
|
21
|
+
.ensuringWith((exit) => ref.get.flatMap((fin) => fin(exit))),
|
22
|
+
);
|
24
23
|
}
|
25
24
|
|
26
25
|
/**
|
27
|
-
*
|
26
|
+
* Construct a resource Channel with Acquire / Release
|
27
|
+
*
|
28
|
+
* @tsplus static fncts.io.ChannelOps acquireReleaseOutExitWith
|
28
29
|
*/
|
29
|
-
export function
|
30
|
-
|
30
|
+
export function acquireReleaseOutExitWith<R, R2, E, Z>(
|
31
|
+
self: IO<R, E, Z>,
|
32
|
+
release: (z: Z, e: Exit<unknown, unknown>) => URIO<R2, unknown>,
|
33
|
+
): Channel<R | R2, unknown, unknown, unknown, E, Z, void> {
|
34
|
+
const op = new ChannelPrimitive(ChannelTag.BracketOut);
|
35
|
+
op.i0 = self;
|
36
|
+
op.i1 = release;
|
37
|
+
return op as any;
|
31
38
|
}
|
32
39
|
|
33
40
|
/**
|
34
|
-
*
|
41
|
+
* Construct a resource Channel with Acquire / Release
|
42
|
+
*
|
43
|
+
* @tsplus static fncts.io.ChannelOps acquireReleaseOutWith
|
35
44
|
*/
|
36
|
-
export function
|
37
|
-
|
38
|
-
|
39
|
-
|
45
|
+
export function acquireReleaseOutWith<Env, OutErr, Acquired, Z>(
|
46
|
+
acquire: IO<Env, OutErr, Acquired>,
|
47
|
+
release: (a: Acquired) => URIO<Env, Z>,
|
48
|
+
): Channel<Env, unknown, unknown, unknown, OutErr, Acquired, void> {
|
49
|
+
return Channel.acquireReleaseOutExitWith(acquire, (z, _) => release(z));
|
40
50
|
}
|
41
51
|
|
42
52
|
/**
|
@@ -51,45 +61,35 @@ export function acquireReleaseWith<Env, InErr, InElem, InDone, OutErr, OutElem1,
|
|
51
61
|
}
|
52
62
|
|
53
63
|
/**
|
54
|
-
*
|
64
|
+
* Returns a new channel that is the same as this one, except the terminal value of the channel
|
65
|
+
* is the specified constant value.
|
66
|
+
*
|
67
|
+
* This method produces the same result as mapping this channel to the specified constant value.
|
68
|
+
*
|
69
|
+
* @tsplus pipeable fncts.io.Channel as
|
55
70
|
*/
|
56
|
-
export function
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
)
|
61
|
-
|
62
|
-
Channel.fromIO(acquire.tap((a) => ref.set((exit) => release(a, exit))).uninterruptible)
|
63
|
-
.flatMap(use)
|
64
|
-
.ensuringWith((exit) => ref.get.flatMap((fin) => fin(exit))),
|
65
|
-
);
|
71
|
+
export function as_<OutDone2>(z2: Lazy<OutDone2>) {
|
72
|
+
return <Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>(
|
73
|
+
self: Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>,
|
74
|
+
): Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone2> => {
|
75
|
+
return self.map(() => z2());
|
76
|
+
};
|
66
77
|
}
|
67
78
|
|
68
79
|
/**
|
69
|
-
*
|
70
|
-
*
|
71
|
-
* @tsplus static fncts.io.ChannelOps acquireReleaseOutWith
|
80
|
+
* @tsplus static fncts.io.ChannelOps ask
|
72
81
|
*/
|
73
|
-
export function
|
74
|
-
|
75
|
-
release: (a: Acquired) => URIO<Env, Z>,
|
76
|
-
): Channel<Env, unknown, unknown, unknown, OutErr, Acquired, void> {
|
77
|
-
return Channel.acquireReleaseOutExitWith(acquire, (z, _) => release(z));
|
82
|
+
export function ask<Env>(): Channel<Env, unknown, unknown, unknown, never, never, Environment<Env>> {
|
83
|
+
return Channel.fromIO(IO.environment<Env>());
|
78
84
|
}
|
79
85
|
|
80
86
|
/**
|
81
|
-
*
|
82
|
-
*
|
83
|
-
* @tsplus static fncts.io.ChannelOps acquireReleaseOutExitWith
|
87
|
+
* @tsplus getter fncts.io.Channel asUnit
|
84
88
|
*/
|
85
|
-
export function
|
86
|
-
self:
|
87
|
-
|
88
|
-
)
|
89
|
-
const op = new ChannelPrimitive(ChannelTag.BracketOut);
|
90
|
-
op.i0 = self;
|
91
|
-
op.i1 = release;
|
92
|
-
return op as any;
|
89
|
+
export function asUnit<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>(
|
90
|
+
self: Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>,
|
91
|
+
): Channel<Env, InErr, InElem, InDone, OutErr, OutElem, void> {
|
92
|
+
return self.as(undefined);
|
93
93
|
}
|
94
94
|
|
95
95
|
/**
|
@@ -224,6 +224,58 @@ export function concatAll<Env, InErr, InElem, InDone, OutErr, OutElem>(
|
|
224
224
|
);
|
225
225
|
}
|
226
226
|
|
227
|
+
/**
|
228
|
+
* Concat sequentially a channel of channels
|
229
|
+
*
|
230
|
+
* @tsplus pipeable fncts.io.Channel concatAllWith
|
231
|
+
*/
|
232
|
+
export function concatAllWith<OutDone, OutDone2, OutDone3>(
|
233
|
+
f: (o: OutDone, o1: OutDone) => OutDone,
|
234
|
+
g: (o: OutDone, o2: OutDone2) => OutDone3,
|
235
|
+
) {
|
236
|
+
return <Env, InErr, InElem, InDone, OutErr, OutElem, Env2, InErr2, InElem2, InDone2, OutErr2>(
|
237
|
+
channels: Channel<
|
238
|
+
Env,
|
239
|
+
InErr,
|
240
|
+
InElem,
|
241
|
+
InDone,
|
242
|
+
OutErr,
|
243
|
+
Channel<Env2, InErr2, InElem2, InDone2, OutErr2, OutElem, OutDone>,
|
244
|
+
OutDone2
|
245
|
+
>,
|
246
|
+
): Channel<Env | Env2, InErr & InErr2, InElem & InElem2, InDone & InDone2, OutErr | OutErr2, OutElem, OutDone3> => {
|
247
|
+
const op = new ChannelPrimitive(ChannelTag.ConcatAll);
|
248
|
+
op.i0 = f;
|
249
|
+
op.i1 = g;
|
250
|
+
op.i2 = () => UpstreamPullStrategy.PullAfterNext(Nothing());
|
251
|
+
op.i3 = () => ChildExecutorDecision.Continue;
|
252
|
+
op.i4 = channels;
|
253
|
+
op.i5 = identity;
|
254
|
+
return op as any;
|
255
|
+
};
|
256
|
+
}
|
257
|
+
|
258
|
+
/**
|
259
|
+
* Returns a new channel whose outputs are fed to the specified factory function, which creates
|
260
|
+
* new channels in response. These new channels are sequentially concatenated together, and all
|
261
|
+
* their outputs appear as outputs of the newly returned channel.
|
262
|
+
*
|
263
|
+
* @tsplus pipeable fncts.io.Channel concatMap
|
264
|
+
*/
|
265
|
+
export function concatMap<OutElem, OutElem2, OutDone, Env2, InErr2, InElem2, InDone2, OutErr2>(
|
266
|
+
f: (o: OutElem) => Channel<Env2, InErr2, InElem2, InDone2, OutErr2, OutElem2, OutDone>,
|
267
|
+
) {
|
268
|
+
return <Env, InErr, InElem, InDone, OutErr, OutDone2>(
|
269
|
+
self: Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone2>,
|
270
|
+
): Channel<Env | Env2, InErr & InErr2, InElem & InElem2, InDone & InDone2, OutErr | OutErr2, OutElem2, unknown> => {
|
271
|
+
return self.concatMapWith(
|
272
|
+
f,
|
273
|
+
() => void 0,
|
274
|
+
() => void 0,
|
275
|
+
);
|
276
|
+
};
|
277
|
+
}
|
278
|
+
|
227
279
|
/**
|
228
280
|
* Returns a new channel whose outputs are fed to the specified factory function, which creates
|
229
281
|
* new channels in response. These new channels are sequentially concatenated together, and all
|
@@ -294,78 +346,59 @@ export function concatMapWithCustom<
|
|
294
346
|
}
|
295
347
|
|
296
348
|
/**
|
297
|
-
*
|
298
|
-
*
|
299
|
-
* @tsplus pipeable fncts.io.Channel concatAllWith
|
349
|
+
* @tsplus pipeable fncts.io.Channel contramap
|
300
350
|
*/
|
301
|
-
export function
|
302
|
-
|
303
|
-
|
304
|
-
) {
|
305
|
-
|
306
|
-
channels: Channel<
|
307
|
-
Env,
|
308
|
-
InErr,
|
309
|
-
InElem,
|
310
|
-
InDone,
|
311
|
-
OutErr,
|
312
|
-
Channel<Env2, InErr2, InElem2, InDone2, OutErr2, OutElem, OutDone>,
|
313
|
-
OutDone2
|
314
|
-
>,
|
315
|
-
): Channel<Env | Env2, InErr & InErr2, InElem & InElem2, InDone & InDone2, OutErr | OutErr2, OutElem, OutDone3> => {
|
316
|
-
const op = new ChannelPrimitive(ChannelTag.ConcatAll);
|
317
|
-
op.i0 = f;
|
318
|
-
op.i1 = g;
|
319
|
-
op.i2 = () => UpstreamPullStrategy.PullAfterNext(Nothing());
|
320
|
-
op.i3 = () => ChildExecutorDecision.Continue;
|
321
|
-
op.i4 = channels;
|
322
|
-
op.i5 = identity;
|
323
|
-
return op as any;
|
351
|
+
export function contramap<InDone0, InDone>(f: (a: InDone0) => InDone) {
|
352
|
+
return <Env, InErr, InElem, OutErr, OutElem, OutDone>(
|
353
|
+
self: Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>,
|
354
|
+
): Channel<Env, InErr, InElem, InDone0, OutErr, OutElem, OutDone> => {
|
355
|
+
return contramapReader<InErr, InElem, InDone0, InDone>(f).pipeTo(self);
|
324
356
|
};
|
325
357
|
}
|
326
358
|
|
327
359
|
/**
|
328
|
-
*
|
329
|
-
* new channels in response. These new channels are sequentially concatenated together, and all
|
330
|
-
* their outputs appear as outputs of the newly returned channel.
|
331
|
-
*
|
332
|
-
* @tsplus pipeable fncts.io.Channel concatMap
|
360
|
+
* @tsplus pipeable fncts.io.Channel contramapEnvironment
|
333
361
|
*/
|
334
|
-
export function
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
): Channel<Env | Env2, InErr & InErr2, InElem & InElem2, InDone & InDone2, OutErr | OutErr2, OutElem2, unknown> => {
|
340
|
-
return self.concatMapWith(
|
341
|
-
f,
|
342
|
-
() => void 0,
|
343
|
-
() => void 0,
|
344
|
-
);
|
362
|
+
export function contramapEnvironment<Env, Env0>(f: (env0: Environment<Env0>) => Environment<Env>) {
|
363
|
+
return <InErr, InElem, InDone, OutErr, OutElem, OutDone>(
|
364
|
+
self: Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>,
|
365
|
+
): Channel<Env0, InErr, InElem, InDone, OutErr, OutElem, OutDone> => {
|
366
|
+
return Channel.ask<Env0>().flatMap((env0) => self.provideEnvironment(f(env0)));
|
345
367
|
};
|
346
368
|
}
|
347
369
|
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
Channel
|
354
|
-
|
355
|
-
|
370
|
+
/**
|
371
|
+
* @tsplus pipeable fncts.io.Channel contramapIn
|
372
|
+
*/
|
373
|
+
export function contramapIn<InElem0, InElem>(f: (a: InElem0) => InElem) {
|
374
|
+
return <Env, InErr, InDone, OutErr, OutElem, OutDone>(
|
375
|
+
self: Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>,
|
376
|
+
): Channel<Env, InErr, InElem0, InDone, OutErr, OutElem, OutDone> => {
|
377
|
+
return contramapInReader<InErr, InElem0, InElem, InDone>(f).pipeTo(self);
|
378
|
+
};
|
356
379
|
}
|
357
380
|
|
358
381
|
/**
|
359
|
-
* @tsplus pipeable fncts.io.Channel
|
382
|
+
* @tsplus pipeable fncts.io.Channel contramapInIO
|
360
383
|
*/
|
361
|
-
export function
|
362
|
-
return <Env,
|
384
|
+
export function contramapInIO<Env1, InErr, InElem0, InElem>(f: (a: InElem0) => IO<Env1, InErr, InElem>) {
|
385
|
+
return <Env, InDone, OutErr, OutElem, OutDone>(
|
363
386
|
self: Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>,
|
364
|
-
): Channel<Env, InErr,
|
365
|
-
return
|
387
|
+
): Channel<Env1 | Env, InErr, InElem0, InDone, OutErr, OutElem, OutDone> => {
|
388
|
+
return contramapInIOReader<Env1, InErr, InElem0, InElem, InDone>(f).pipeTo(self);
|
366
389
|
};
|
367
390
|
}
|
368
391
|
|
392
|
+
function contramapInIOReader<Env1, InErr, InElem0, InElem, InDone>(
|
393
|
+
f: (a: InElem0) => IO<Env1, InErr, InElem>,
|
394
|
+
): Channel<Env1, InErr, InElem0, InDone, InErr, InElem, InDone> {
|
395
|
+
return Channel.readWith(
|
396
|
+
(inp) => Channel.fromIO(f(inp)).flatMap(Channel.writeNow).zipRight(contramapInIOReader(f)),
|
397
|
+
Channel.failNow,
|
398
|
+
Channel.endNow,
|
399
|
+
);
|
400
|
+
}
|
401
|
+
|
369
402
|
function contramapInReader<InErr, InElem0, InElem, InDone>(
|
370
403
|
f: (a: InElem0) => InElem,
|
371
404
|
): Channel<never, InErr, InElem0, InDone, InErr, InElem, InDone> {
|
@@ -375,14 +408,15 @@ function contramapInReader<InErr, InElem0, InElem, InDone>(
|
|
375
408
|
(done) => Channel.endNow(done),
|
376
409
|
);
|
377
410
|
}
|
411
|
+
|
378
412
|
/**
|
379
|
-
* @tsplus pipeable fncts.io.Channel
|
413
|
+
* @tsplus pipeable fncts.io.Channel contramapIO
|
380
414
|
*/
|
381
|
-
export function
|
382
|
-
return <Env,
|
415
|
+
export function contramapIO<Env1, InErr, InDone0, InDone>(f: (i: InDone0) => IO<Env1, InErr, InDone>) {
|
416
|
+
return <Env, InElem, OutErr, OutElem, OutDone>(
|
383
417
|
self: Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>,
|
384
|
-
): Channel<Env, InErr,
|
385
|
-
return
|
418
|
+
): Channel<Env1 | Env, InErr, InElem, InDone0, OutErr, OutElem, OutDone> => {
|
419
|
+
return contramapIOReader<Env1, InErr, InElem, InDone0, InDone>(f).pipeTo(self);
|
386
420
|
};
|
387
421
|
}
|
388
422
|
|
@@ -396,36 +430,14 @@ function contramapIOReader<Env1, InErr, InElem, InDone0, InDone>(
|
|
396
430
|
);
|
397
431
|
}
|
398
432
|
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
self: Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>,
|
405
|
-
): Channel<Env1 | Env, InErr, InElem, InDone0, OutErr, OutElem, OutDone> => {
|
406
|
-
return contramapIOReader<Env1, InErr, InElem, InDone0, InDone>(f).pipeTo(self);
|
407
|
-
};
|
408
|
-
}
|
409
|
-
|
410
|
-
function contramapInIOReader<Env1, InErr, InElem0, InElem, InDone>(
|
411
|
-
f: (a: InElem0) => IO<Env1, InErr, InElem>,
|
412
|
-
): Channel<Env1, InErr, InElem0, InDone, InErr, InElem, InDone> {
|
413
|
-
return Channel.readWith(
|
414
|
-
(inp) => Channel.fromIO(f(inp)).flatMap(Channel.writeNow).zipRight(contramapInIOReader(f)),
|
433
|
+
function contramapReader<InErr, InElem, InDone0, InDone>(
|
434
|
+
f: (a: InDone0) => InDone,
|
435
|
+
): Channel<never, InErr, InElem, InDone0, InErr, InElem, InDone> {
|
436
|
+
return readWith(
|
437
|
+
(_in) => Channel.writeNow(_in).zipRight(contramapReader(f)),
|
415
438
|
Channel.failNow,
|
416
|
-
Channel.endNow,
|
417
|
-
);
|
418
|
-
}
|
419
|
-
|
420
|
-
/**
|
421
|
-
* @tsplus pipeable fncts.io.Channel contramapInIO
|
422
|
-
*/
|
423
|
-
export function contramapInIO<Env1, InErr, InElem0, InElem>(f: (a: InElem0) => IO<Env1, InErr, InElem>) {
|
424
|
-
return <Env, InDone, OutErr, OutElem, OutDone>(
|
425
|
-
self: Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>,
|
426
|
-
): Channel<Env1 | Env, InErr, InElem0, InDone, OutErr, OutElem, OutDone> => {
|
427
|
-
return contramapInIOReader<Env1, InErr, InElem0, InElem, InDone>(f).pipeTo(self);
|
428
|
-
};
|
439
|
+
(done) => Channel.endNow(f(done)),
|
440
|
+
);
|
429
441
|
}
|
430
442
|
|
431
443
|
/**
|
@@ -439,21 +451,6 @@ export function defer<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>(
|
|
439
451
|
return op as any;
|
440
452
|
}
|
441
453
|
|
442
|
-
function doneCollectReader<OutErr, OutElem, OutDone>(
|
443
|
-
builder: ConcBuilder<OutElem>,
|
444
|
-
): Channel<never, OutErr, OutElem, OutDone, OutErr, never, OutDone> {
|
445
|
-
return Channel.readWith(
|
446
|
-
(out) =>
|
447
|
-
Channel.fromIO(
|
448
|
-
IO.succeed(() => {
|
449
|
-
builder.append(out);
|
450
|
-
}),
|
451
|
-
).zipRight(doneCollectReader(builder)),
|
452
|
-
Channel.failNow,
|
453
|
-
Channel.endNow,
|
454
|
-
);
|
455
|
-
}
|
456
|
-
|
457
454
|
/**
|
458
455
|
* Returns a new channel, which is the same as this one, except that all the outputs are
|
459
456
|
* collected and bundled into a tuple together with the terminal value of this channel.
|
@@ -475,6 +472,21 @@ export function doneCollect<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone
|
|
475
472
|
);
|
476
473
|
}
|
477
474
|
|
475
|
+
function doneCollectReader<OutErr, OutElem, OutDone>(
|
476
|
+
builder: ConcBuilder<OutElem>,
|
477
|
+
): Channel<never, OutErr, OutElem, OutDone, OutErr, never, OutDone> {
|
478
|
+
return Channel.readWith(
|
479
|
+
(out) =>
|
480
|
+
Channel.fromIO(
|
481
|
+
IO.succeed(() => {
|
482
|
+
builder.append(out);
|
483
|
+
}),
|
484
|
+
).zipRight(doneCollectReader(builder)),
|
485
|
+
Channel.failNow,
|
486
|
+
Channel.endNow,
|
487
|
+
);
|
488
|
+
}
|
489
|
+
|
478
490
|
/**
|
479
491
|
* Returns a new channel which reads all the elements from upstream's output channel
|
480
492
|
* and ignores them, then terminates with the upstream result value.
|
@@ -492,6 +504,22 @@ export function drain<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>(
|
|
492
504
|
return channel.pipeTo(drainer);
|
493
505
|
}
|
494
506
|
|
507
|
+
/**
|
508
|
+
* Embed inputs from continuos pulling of a producer
|
509
|
+
*
|
510
|
+
* @tsplus pipeable fncts.io.Channel embedInput
|
511
|
+
*/
|
512
|
+
export function embedInput<InErr, InElem, InDone>(input: AsyncInputProducer<InErr, InElem, InDone>) {
|
513
|
+
return <Env, OutErr, OutElem, OutDone>(
|
514
|
+
self: Channel<Env, unknown, unknown, unknown, OutErr, OutElem, OutDone>,
|
515
|
+
): Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone> => {
|
516
|
+
const op = new ChannelPrimitive(ChannelTag.Bridge);
|
517
|
+
op.i0 = input;
|
518
|
+
op.i1 = self;
|
519
|
+
return op as any;
|
520
|
+
};
|
521
|
+
}
|
522
|
+
|
495
523
|
/**
|
496
524
|
* Returns a new channel that collects the output and terminal value of this channel, which it
|
497
525
|
* then writes as output of the returned channel.
|
@@ -532,22 +560,6 @@ export function ensuringWith<Env2, OutErr, OutDone>(finalizer: (e: Exit<OutErr,
|
|
532
560
|
};
|
533
561
|
}
|
534
562
|
|
535
|
-
/**
|
536
|
-
* Embed inputs from continuos pulling of a producer
|
537
|
-
*
|
538
|
-
* @tsplus pipeable fncts.io.Channel embedInput
|
539
|
-
*/
|
540
|
-
export function embedInput<InErr, InElem, InDone>(input: AsyncInputProducer<InErr, InElem, InDone>) {
|
541
|
-
return <Env, OutErr, OutElem, OutDone>(
|
542
|
-
self: Channel<Env, unknown, unknown, unknown, OutErr, OutElem, OutDone>,
|
543
|
-
): Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone> => {
|
544
|
-
const op = new ChannelPrimitive(ChannelTag.Bridge);
|
545
|
-
op.i0 = input;
|
546
|
-
op.i1 = self;
|
547
|
-
return op as any;
|
548
|
-
};
|
549
|
-
}
|
550
|
-
|
551
563
|
/**
|
552
564
|
* Halt a channel with the specified error
|
553
565
|
*
|
@@ -664,55 +676,25 @@ export function fromQueue<Err, Elem, Done>(
|
|
664
676
|
);
|
665
677
|
}
|
666
678
|
|
667
|
-
/**
|
668
|
-
* Provides the channel with its required environment, which eliminates
|
669
|
-
* its dependency on `Env`.
|
670
|
-
*
|
671
|
-
* @tsplus pipeable fncts.io.Channel provideEnvironment
|
672
|
-
*/
|
673
|
-
export function provideEnvironment<Env>(env: Lazy<Environment<Env>>) {
|
674
|
-
return <InErr, InElem, InDone, OutErr, OutElem, OutDone>(
|
675
|
-
self: Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>,
|
676
|
-
): Channel<never, InErr, InElem, InDone, OutErr, OutElem, OutDone> => {
|
677
|
-
return Channel.defer(() => {
|
678
|
-
const op = new ChannelPrimitive(ChannelTag.Provide);
|
679
|
-
op.i0 = env();
|
680
|
-
op.i1 = self;
|
681
|
-
return op as any;
|
682
|
-
});
|
683
|
-
};
|
684
|
-
}
|
685
|
-
|
686
|
-
/**
|
687
|
-
* @tsplus pipeable fncts.io.Channel contramapEnvironment
|
688
|
-
*/
|
689
|
-
export function contramapEnvironment<Env, Env0>(f: (env0: Environment<Env0>) => Environment<Env>) {
|
690
|
-
return <InErr, InElem, InDone, OutErr, OutElem, OutDone>(
|
691
|
-
self: Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>,
|
692
|
-
): Channel<Env0, InErr, InElem, InDone, OutErr, OutElem, OutDone> => {
|
693
|
-
return Channel.ask<Env0>().flatMap((env0) => self.provideEnvironment(f(env0)));
|
694
|
-
};
|
695
|
-
}
|
696
|
-
|
697
679
|
/**
|
698
680
|
* Halt a channel with the specified exception
|
699
681
|
*
|
700
|
-
* @tsplus static fncts.io.ChannelOps
|
682
|
+
* @tsplus static fncts.io.ChannelOps halt
|
701
683
|
*/
|
702
|
-
export function
|
684
|
+
export function halt(defect: Lazy<unknown>): Channel<never, unknown, unknown, unknown, never, never, never> {
|
703
685
|
const op = new ChannelPrimitive(ChannelTag.Halt);
|
704
|
-
op.i0 = () => Cause.halt(defect);
|
686
|
+
op.i0 = () => Cause.halt(defect());
|
705
687
|
return op as any;
|
706
688
|
}
|
707
689
|
|
708
690
|
/**
|
709
691
|
* Halt a channel with the specified exception
|
710
692
|
*
|
711
|
-
* @tsplus static fncts.io.ChannelOps
|
693
|
+
* @tsplus static fncts.io.ChannelOps haltNow
|
712
694
|
*/
|
713
|
-
export function
|
695
|
+
export function haltNow(defect: unknown): Channel<never, unknown, unknown, unknown, never, never, never> {
|
714
696
|
const op = new ChannelPrimitive(ChannelTag.Halt);
|
715
|
-
op.i0 = () => Cause.halt(defect
|
697
|
+
op.i0 = () => Cause.halt(defect);
|
716
698
|
return op as any;
|
717
699
|
}
|
718
700
|
|
@@ -730,24 +712,8 @@ export function interrupt(fiberId: FiberId): Channel<never, unknown, unknown, un
|
|
730
712
|
return Channel.failCauseNow(Cause.interrupt(fiberId));
|
731
713
|
}
|
732
714
|
|
733
|
-
|
734
|
-
|
735
|
-
*
|
736
|
-
* @tsplus static fncts.io.ChannelOps scoped
|
737
|
-
*/
|
738
|
-
export function scoped<R, E, A>(
|
739
|
-
io: Lazy<IO<R, E, A>>,
|
740
|
-
): Channel<Exclude<R, Scope>, unknown, unknown, unknown, E, A, unknown> {
|
741
|
-
return Channel.unwrap(
|
742
|
-
IO.uninterruptibleMask((restore) =>
|
743
|
-
Scope.make.map((scope) =>
|
744
|
-
Channel.acquireReleaseOutExitWith(
|
745
|
-
restore(scope.extend(io)).tapErrorCause((cause) => scope.close(Exit.failCause(cause))),
|
746
|
-
(_, exit) => scope.close(exit),
|
747
|
-
),
|
748
|
-
),
|
749
|
-
),
|
750
|
-
);
|
715
|
+
function isChannelFailure<E>(u: unknown): u is ChannelFailure<E> {
|
716
|
+
return isObject(u) && ChannelFailureTypeId in u;
|
751
717
|
}
|
752
718
|
|
753
719
|
/**
|
@@ -810,6 +776,45 @@ export function mapOut<OutElem, OutElem2>(f: (o: OutElem) => OutElem2) {
|
|
810
776
|
};
|
811
777
|
}
|
812
778
|
|
779
|
+
/**
|
780
|
+
* Provides the channel with its required environment, which eliminates
|
781
|
+
* its dependency on `Env`.
|
782
|
+
*
|
783
|
+
* @tsplus pipeable fncts.io.Channel provideEnvironment
|
784
|
+
*/
|
785
|
+
export function provideEnvironment<Env>(env: Lazy<Environment<Env>>) {
|
786
|
+
return <InErr, InElem, InDone, OutErr, OutElem, OutDone>(
|
787
|
+
self: Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>,
|
788
|
+
): Channel<never, InErr, InElem, InDone, OutErr, OutElem, OutDone> => {
|
789
|
+
return Channel.defer(() => {
|
790
|
+
const op = new ChannelPrimitive(ChannelTag.Provide);
|
791
|
+
op.i0 = env();
|
792
|
+
op.i1 = self;
|
793
|
+
return op as any;
|
794
|
+
});
|
795
|
+
};
|
796
|
+
}
|
797
|
+
|
798
|
+
/**
|
799
|
+
* Use a managed to emit an output element
|
800
|
+
*
|
801
|
+
* @tsplus static fncts.io.ChannelOps scoped
|
802
|
+
*/
|
803
|
+
export function scoped<R, E, A>(
|
804
|
+
io: Lazy<IO<R, E, A>>,
|
805
|
+
): Channel<Exclude<R, Scope>, unknown, unknown, unknown, E, A, unknown> {
|
806
|
+
return Channel.unwrap(
|
807
|
+
IO.uninterruptibleMask((restore) =>
|
808
|
+
Scope.make.map((scope) =>
|
809
|
+
Channel.acquireReleaseOutExitWith(
|
810
|
+
restore(scope.extend(io)).tapErrorCause((cause) => scope.close(Exit.failCause(cause))),
|
811
|
+
(_, exit) => scope.close(exit),
|
812
|
+
),
|
813
|
+
),
|
814
|
+
),
|
815
|
+
);
|
816
|
+
}
|
817
|
+
|
813
818
|
const mapOutIOReader = <Env, Env1, OutErr, OutErr1, OutElem, OutElem1, OutDone>(
|
814
819
|
f: (o: OutElem) => IO<Env1, OutErr1, OutElem1>,
|
815
820
|
): Channel<Env | Env1, OutErr, OutElem, OutDone, OutErr | OutErr1, OutElem1, OutDone> =>
|
@@ -994,10 +999,6 @@ class ChannelFailure<E> {
|
|
994
999
|
constructor(readonly error: E) {}
|
995
1000
|
}
|
996
1001
|
|
997
|
-
function isChannelFailure<E>(u: unknown): u is ChannelFailure<E> {
|
998
|
-
return isObject(u) && ChannelFailureTypeId in u;
|
999
|
-
}
|
1000
|
-
|
1001
1002
|
/**
|
1002
1003
|
* @tsplus pipeable fncts.io.Channel pipeToOrFail
|
1003
1004
|
* @tsplus pipeable-operator fncts.io.Channel >>>
|
@@ -1043,11 +1044,11 @@ export function readOrFail<In, E>(e: E): Channel<never, unknown, In, unknown, E,
|
|
1043
1044
|
}
|
1044
1045
|
|
1045
1046
|
/**
|
1046
|
-
* Reads an input and continue exposing both
|
1047
|
+
* Reads an input and continue exposing both error and completion
|
1047
1048
|
*
|
1048
|
-
* @tsplus static fncts.io.ChannelOps
|
1049
|
+
* @tsplus static fncts.io.ChannelOps readWith
|
1049
1050
|
*/
|
1050
|
-
export function
|
1051
|
+
export function readWith<
|
1051
1052
|
Env,
|
1052
1053
|
Env1,
|
1053
1054
|
Env2,
|
@@ -1065,7 +1066,7 @@ export function readWithCause<
|
|
1065
1066
|
OutDone2,
|
1066
1067
|
>(
|
1067
1068
|
inp: (i: InElem) => Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>,
|
1068
|
-
|
1069
|
+
error: (e: InErr) => Channel<Env1, InErr, InElem, InDone, OutErr1, OutElem1, OutDone1>,
|
1069
1070
|
done: (d: InDone) => Channel<Env2, InErr, InElem, InDone, OutErr2, OutElem2, OutDone2>,
|
1070
1071
|
): Channel<
|
1071
1072
|
Env | Env1 | Env2,
|
@@ -1076,24 +1077,15 @@ export function readWithCause<
|
|
1076
1077
|
OutElem | OutElem1 | OutElem2,
|
1077
1078
|
OutDone | OutDone1 | OutDone2
|
1078
1079
|
> {
|
1079
|
-
|
1080
|
-
op.i0 = inp;
|
1081
|
-
|
1082
|
-
const continuation = new ChannelPrimitive(ChannelTag.ContinuationK);
|
1083
|
-
continuation.i0 = done;
|
1084
|
-
continuation.i1 = halt;
|
1085
|
-
|
1086
|
-
op.i1 = continuation;
|
1087
|
-
|
1088
|
-
return op as any;
|
1080
|
+
return Channel.readWithCause(inp, (c) => c.failureOrCause.match(error, Channel.failCauseNow), done);
|
1089
1081
|
}
|
1090
1082
|
|
1091
1083
|
/**
|
1092
|
-
* Reads an input and continue exposing both error and completion
|
1084
|
+
* Reads an input and continue exposing both full error cause and completion
|
1093
1085
|
*
|
1094
|
-
* @tsplus static fncts.io.ChannelOps
|
1086
|
+
* @tsplus static fncts.io.ChannelOps readWithCause
|
1095
1087
|
*/
|
1096
|
-
export function
|
1088
|
+
export function readWithCause<
|
1097
1089
|
Env,
|
1098
1090
|
Env1,
|
1099
1091
|
Env2,
|
@@ -1111,7 +1103,7 @@ export function readWith<
|
|
1111
1103
|
OutDone2,
|
1112
1104
|
>(
|
1113
1105
|
inp: (i: InElem) => Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>,
|
1114
|
-
|
1106
|
+
halt: (e: Cause<InErr>) => Channel<Env1, InErr, InElem, InDone, OutErr1, OutElem1, OutDone1>,
|
1115
1107
|
done: (d: InDone) => Channel<Env2, InErr, InElem, InDone, OutErr2, OutElem2, OutDone2>,
|
1116
1108
|
): Channel<
|
1117
1109
|
Env | Env1 | Env2,
|
@@ -1122,7 +1114,16 @@ export function readWith<
|
|
1122
1114
|
OutElem | OutElem1 | OutElem2,
|
1123
1115
|
OutDone | OutDone1 | OutDone2
|
1124
1116
|
> {
|
1125
|
-
|
1117
|
+
const op = new ChannelPrimitive(ChannelTag.Read);
|
1118
|
+
op.i0 = inp;
|
1119
|
+
|
1120
|
+
const continuation = new ChannelPrimitive(ChannelTag.ContinuationK);
|
1121
|
+
continuation.i0 = done;
|
1122
|
+
continuation.i1 = halt;
|
1123
|
+
|
1124
|
+
op.i1 = continuation;
|
1125
|
+
|
1126
|
+
return op as any;
|
1126
1127
|
}
|
1127
1128
|
|
1128
1129
|
/**
|
@@ -1174,6 +1175,13 @@ export function writeAll<Out>(outs: ReadonlyArray<Out>): Channel<never, unknown,
|
|
1174
1175
|
return Channel.writeChunk(Conc.from(outs));
|
1175
1176
|
}
|
1176
1177
|
|
1178
|
+
/**
|
1179
|
+
* @tsplus static fncts.io.ChannelOps writeChunk
|
1180
|
+
*/
|
1181
|
+
export function writeChunk<Out>(outs: Conc<Out>): Channel<never, unknown, unknown, unknown, never, Out, void> {
|
1182
|
+
return writeChunkWriter(outs, 0, outs.length);
|
1183
|
+
}
|
1184
|
+
|
1177
1185
|
function writeChunkWriter<Out>(
|
1178
1186
|
outs: Conc<Out>,
|
1179
1187
|
idx: number,
|
@@ -1183,13 +1191,6 @@ function writeChunkWriter<Out>(
|
|
1183
1191
|
return Channel.writeNow(outs.unsafeGet(idx)).zipRight(writeChunkWriter(outs, idx + 1, len));
|
1184
1192
|
}
|
1185
1193
|
|
1186
|
-
/**
|
1187
|
-
* @tsplus static fncts.io.ChannelOps writeChunk
|
1188
|
-
*/
|
1189
|
-
export function writeChunk<Out>(outs: Conc<Out>): Channel<never, unknown, unknown, unknown, never, Out, void> {
|
1190
|
-
return writeChunkWriter(outs, 0, outs.length);
|
1191
|
-
}
|
1192
|
-
|
1193
1194
|
/**
|
1194
1195
|
* Writes an output to the channel
|
1195
1196
|
*
|
@@ -1206,6 +1207,24 @@ export function writeNow<OutElem>(out: OutElem): Channel<never, unknown, unknown
|
|
1206
1207
|
*/
|
1207
1208
|
export const unit: Channel<never, unknown, unknown, unknown, never, never, void> = Channel.endNow(undefined);
|
1208
1209
|
|
1210
|
+
/**
|
1211
|
+
* @tsplus static fncts.io.ChannelOps fromHubScoped
|
1212
|
+
*/
|
1213
|
+
export function fromHubScoped<Err, Done, Elem>(
|
1214
|
+
hub: Lazy<Hub<Either<Exit<Err, Done>, Elem>>>,
|
1215
|
+
): IO<Scope, never, Channel<never, unknown, unknown, unknown, Err, Elem, Done>> {
|
1216
|
+
return IO.defer(hub().subscribe.map(Channel.fromQueue));
|
1217
|
+
}
|
1218
|
+
|
1219
|
+
/**
|
1220
|
+
* @tsplus static fncts.io.ChannelOps toHub
|
1221
|
+
*/
|
1222
|
+
export function toHub<Err, Done, Elem>(
|
1223
|
+
hub: Lazy<Hub<Either<Exit<Err, Done>, Elem>>>,
|
1224
|
+
): Channel<never, Err, Elem, Done, never, never, unknown> {
|
1225
|
+
return Channel.toQueue(hub);
|
1226
|
+
}
|
1227
|
+
|
1209
1228
|
/**
|
1210
1229
|
* Makes a channel from an effect that returns a channel in case of success
|
1211
1230
|
*
|
@@ -1230,21 +1249,3 @@ export function unwrapScoped<R, E, Env, InErr, InElem, InDone, OutErr, OutElem,
|
|
1230
1249
|
(d, _) => d,
|
1231
1250
|
);
|
1232
1251
|
}
|
1233
|
-
|
1234
|
-
/**
|
1235
|
-
* @tsplus static fncts.io.ChannelOps fromHubScoped
|
1236
|
-
*/
|
1237
|
-
export function fromHubScoped<Err, Done, Elem>(
|
1238
|
-
hub: Lazy<Hub<Either<Exit<Err, Done>, Elem>>>,
|
1239
|
-
): IO<Scope, never, Channel<never, unknown, unknown, unknown, Err, Elem, Done>> {
|
1240
|
-
return IO.defer(hub().subscribe.map(Channel.fromQueue));
|
1241
|
-
}
|
1242
|
-
|
1243
|
-
/**
|
1244
|
-
* @tsplus static fncts.io.ChannelOps toHub
|
1245
|
-
*/
|
1246
|
-
export function toHub<Err, Done, Elem>(
|
1247
|
-
hub: Lazy<Hub<Either<Exit<Err, Done>, Elem>>>,
|
1248
|
-
): Channel<never, Err, Elem, Done, never, never, unknown> {
|
1249
|
-
return Channel.toQueue(hub);
|
1250
|
-
}
|