@fncts/io 0.0.19 → 0.0.21
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 +2 -2
- package/Channel/ChildExecutorDecision/api.d.ts +2 -2
- package/Channel/UpstreamPullRequest/api.d.ts +2 -2
- package/Channel/api/interruptWhen.d.ts +5 -5
- package/Channel/api/mapOutIOC.d.ts +3 -3
- package/Channel/api/mergeAll.d.ts +2 -2
- package/Channel/api/mergeAllUnboundedWith.d.ts +2 -2
- package/Channel/api/mergeAllWith.d.ts +2 -2
- package/Channel/api/mergeMap.d.ts +2 -2
- package/Channel/api/mergeWith.d.ts +2 -2
- package/Channel/api/zipC.d.ts +6 -6
- package/Channel/api.d.ts +64 -64
- package/Channel/core-api.d.ts +11 -11
- package/Channel/definition.d.ts +35 -21
- package/Differ/api.d.ts +24 -0
- package/Differ/definition.d.ts +15 -0
- package/Fiber/api/evalOn.d.ts +3 -3
- package/Fiber/api/evalOnIO.d.ts +3 -3
- package/Fiber/api/interruptAs.d.ts +3 -3
- package/Fiber/api/interruptAsFork.d.ts +3 -3
- package/Fiber/api/mapFiber.d.ts +2 -2
- package/Fiber/api/mapIO.d.ts +5 -5
- package/Fiber/api/zipWith.d.ts +2 -2
- package/Fiber.d.ts +1 -0
- package/FiberRef/api/locallyScoped.d.ts +2 -2
- package/FiberRef/api/locallyScopedWith.d.ts +2 -2
- package/FiberRef/api.d.ts +18 -18
- package/FiberRef/unsafe.d.ts +12 -6
- package/FiberRefs/api.d.ts +2 -2
- package/FiberRefs/join.d.ts +3 -3
- package/Future/api.d.ts +21 -21
- package/Hub/constructors.d.ts +49 -0
- package/Hub/definition.d.ts +37 -81
- package/Hub/internal.d.ts +4 -11
- package/Hub.d.ts +1 -1
- package/IO/api/acquireRelease.d.ts +1 -1
- package/IO/api/acquireReleaseExit.d.ts +1 -1
- package/IO/api/bracket.d.ts +1 -1
- package/IO/api/bracketExit.d.ts +1 -1
- package/IO/api/concurrency.d.ts +2 -2
- package/IO/api/core-scope.d.ts +5 -5
- package/IO/api/ensuringChildren.d.ts +3 -3
- package/IO/api/environment.d.ts +11 -15
- package/IO/api/foreachC.d.ts +2 -2
- package/IO/api/foreachExec.d.ts +1 -1
- package/IO/api/forkIn.d.ts +3 -3
- package/IO/api/fulfill.d.ts +3 -3
- package/IO/api/interrupt.d.ts +6 -6
- package/IO/api/onExit.d.ts +3 -3
- package/IO/api/onTermination.d.ts +4 -4
- package/IO/api/provideLayer.d.ts +3 -3
- package/IO/api/provideSomeLayer.d.ts +3 -7
- package/IO/api/race.d.ts +2 -2
- package/IO/api/raceFirst.d.ts +2 -2
- package/IO/api/repeat.d.ts +3 -3
- package/IO/api/retry.d.ts +7 -7
- package/IO/api/schedule.d.ts +5 -5
- package/IO/api/scoped.d.ts +2 -2
- package/IO/api/supervised.d.ts +3 -3
- package/IO/api/timeout.d.ts +5 -5
- package/IO/api/withFinalizer.d.ts +3 -3
- package/IO/api/withFinalizerExit.d.ts +3 -3
- package/IO/api/withRuntimeConfig.d.ts +3 -3
- package/IO/api/zipC.d.ts +4 -4
- package/IO/api.d.ts +179 -176
- package/IO/definition.d.ts +15 -9
- package/IOEnv/services.d.ts +2 -2
- package/Layer/MemoMap.d.ts +4 -4
- package/Layer/api.d.ts +28 -28
- package/LogLevel.d.ts +12 -12
- package/LogSpan.d.ts +2 -2
- package/Logger/api.d.ts +5 -5
- package/Queue/constructors.d.ts +2 -1
- package/Queue/definition.d.ts +91 -82
- package/Queue/internal.d.ts +7 -9
- package/Queue.d.ts +0 -2
- package/Ref/Atomic.d.ts +15 -2
- package/Ref/Synchronized.d.ts +72 -0
- package/Ref/constructors.d.ts +7 -0
- package/Ref/definition.d.ts +60 -58
- package/Ref.d.ts +1 -6
- package/STM/api/core-api.d.ts +10 -10
- package/STM/api.d.ts +61 -61
- package/STM/internal/Journal.d.ts +4 -4
- package/Schedule/Decision.d.ts +2 -2
- package/Schedule/api.d.ts +94 -94
- package/Scope/ReleaseMap/api/releaseAll.d.ts +2 -2
- package/Scope/ReleaseMap/api.d.ts +10 -10
- package/Scope/api.d.ts +8 -8
- package/Sink/api.d.ts +68 -68
- package/State/api.d.ts +4 -4
- package/State/internal.d.ts +1 -1
- package/Stream/api/zipAllWith.d.ts +2 -2
- package/Stream/api/zipWith.d.ts +2 -2
- package/Stream/api/zipWithChunks.d.ts +2 -2
- package/Stream/api.d.ts +216 -205
- package/Stream/internal/DebounceState.d.ts +3 -3
- package/Stream/internal/Handoff.d.ts +5 -5
- package/Stream/internal/Pull.d.ts +2 -2
- package/Stream/internal/SinkEndReason.d.ts +3 -3
- package/Stream/internal/Take.d.ts +8 -8
- package/SubscriptionRef.d.ts +29 -0
- package/Supervisor/api.d.ts +13 -7
- package/Supervisor/definition.d.ts +28 -0
- package/SupervisorPatch.d.ts +61 -0
- package/TFuture/api.d.ts +7 -7
- package/TReentrantLock/api.d.ts +4 -4
- package/TRef/api.d.ts +24 -24
- package/TSemaphore/api.d.ts +4 -4
- package/TSemaphore/constructors.d.ts +6 -0
- package/_cjs/Cached/api.cjs +9 -9
- package/_cjs/Cached/api.cjs.map +1 -1
- package/_cjs/Channel/ChildExecutorDecision/api.cjs +19 -17
- package/_cjs/Channel/ChildExecutorDecision/api.cjs.map +1 -1
- package/_cjs/Channel/UpstreamPullRequest/api.cjs +16 -14
- package/_cjs/Channel/UpstreamPullRequest/api.cjs.map +1 -1
- package/_cjs/Channel/api/interruptWhen.cjs +14 -10
- package/_cjs/Channel/api/interruptWhen.cjs.map +1 -1
- package/_cjs/Channel/api/mapOutIOC.cjs +25 -25
- package/_cjs/Channel/api/mapOutIOC.cjs.map +1 -1
- package/_cjs/Channel/api/mergeAll.cjs +6 -4
- package/_cjs/Channel/api/mergeAll.cjs.map +1 -1
- package/_cjs/Channel/api/mergeAllUnboundedWith.cjs +6 -4
- package/_cjs/Channel/api/mergeAllUnboundedWith.cjs.map +1 -1
- package/_cjs/Channel/api/mergeAllWith.cjs +48 -52
- package/_cjs/Channel/api/mergeAllWith.cjs.map +1 -1
- package/_cjs/Channel/api/mergeMap.cjs +6 -4
- package/_cjs/Channel/api/mergeMap.cjs.map +1 -1
- package/_cjs/Channel/api/mergeWith.cjs +48 -46
- package/_cjs/Channel/api/mergeWith.cjs.map +1 -1
- package/_cjs/Channel/api/run.cjs +1 -1
- package/_cjs/Channel/api/run.cjs.map +1 -1
- package/_cjs/Channel/api/runScoped.cjs +2 -2
- package/_cjs/Channel/api/runScoped.cjs.map +1 -1
- package/_cjs/Channel/api/toPull.cjs +3 -3
- package/_cjs/Channel/api/toPull.cjs.map +1 -1
- package/_cjs/Channel/api/zipC.cjs +20 -14
- package/_cjs/Channel/api/zipC.cjs.map +1 -1
- package/_cjs/Channel/api.cjs +264 -218
- package/_cjs/Channel/api.cjs.map +1 -1
- package/_cjs/Channel/core-api.cjs +34 -24
- package/_cjs/Channel/core-api.cjs.map +1 -1
- package/_cjs/Channel/definition.cjs +1 -1
- package/_cjs/Channel/definition.cjs.map +1 -1
- package/_cjs/Channel/internal/ChannelExecutor.cjs +83 -83
- package/_cjs/Channel/internal/ChannelExecutor.cjs.map +1 -1
- package/_cjs/Channel/internal/SingleProducerAsyncInput.cjs +22 -24
- package/_cjs/Channel/internal/SingleProducerAsyncInput.cjs.map +1 -1
- package/_cjs/Differ/api.cjs +108 -0
- package/_cjs/Differ/api.cjs.map +1 -0
- package/_cjs/Differ/definition.cjs +23 -0
- package/_cjs/Differ/definition.cjs.map +1 -0
- package/_cjs/Fiber/FiberContext.cjs +48 -48
- package/_cjs/Fiber/FiberContext.cjs.map +1 -1
- package/_cjs/Fiber/api/awaitAll.cjs +1 -1
- package/_cjs/Fiber/api/awaitAll.cjs.map +1 -1
- package/_cjs/Fiber/api/collectAll.cjs +1 -1
- package/_cjs/Fiber/api/collectAll.cjs.map +1 -1
- package/_cjs/Fiber/api/evalOn.cjs +12 -10
- package/_cjs/Fiber/api/evalOn.cjs.map +1 -1
- package/_cjs/Fiber/api/evalOnIO.cjs +6 -4
- package/_cjs/Fiber/api/evalOnIO.cjs.map +1 -1
- package/_cjs/Fiber/api/fromIO.cjs +1 -1
- package/_cjs/Fiber/api/fromIO.cjs.map +1 -1
- package/_cjs/Fiber/api/interrupt.cjs +1 -1
- package/_cjs/Fiber/api/interrupt.cjs.map +1 -1
- package/_cjs/Fiber/api/interruptAll.cjs +2 -2
- package/_cjs/Fiber/api/interruptAll.cjs.map +1 -1
- package/_cjs/Fiber/api/interruptAs.cjs +6 -4
- package/_cjs/Fiber/api/interruptAs.cjs.map +1 -1
- package/_cjs/Fiber/api/interruptAsFork.cjs +6 -4
- package/_cjs/Fiber/api/interruptAsFork.cjs.map +1 -1
- package/_cjs/Fiber/api/interruptFork.cjs +1 -1
- package/_cjs/Fiber/api/interruptFork.cjs.map +1 -1
- package/_cjs/Fiber/api/join.cjs +1 -1
- package/_cjs/Fiber/api/join.cjs.map +1 -1
- package/_cjs/Fiber/api/joinAll.cjs +1 -1
- package/_cjs/Fiber/api/joinAll.cjs.map +1 -1
- package/_cjs/Fiber/api/mapFiber.cjs +6 -4
- package/_cjs/Fiber/api/mapFiber.cjs.map +1 -1
- package/_cjs/Fiber/api/mapIO.cjs +14 -10
- package/_cjs/Fiber/api/mapIO.cjs.map +1 -1
- package/_cjs/Fiber/api/zipWith.cjs +6 -4
- package/_cjs/Fiber/api/zipWith.cjs.map +1 -1
- package/_cjs/Fiber/definition.cjs.map +1 -1
- package/_cjs/Fiber.cjs +13 -0
- package/_cjs/Fiber.cjs.map +1 -1
- package/_cjs/FiberRef/api/locallyScoped.cjs +6 -4
- package/_cjs/FiberRef/api/locallyScoped.cjs.map +1 -1
- package/_cjs/FiberRef/api/locallyScopedWith.cjs +5 -3
- package/_cjs/FiberRef/api/locallyScopedWith.cjs.map +1 -1
- package/_cjs/FiberRef/api.cjs +64 -47
- package/_cjs/FiberRef/api.cjs.map +1 -1
- package/_cjs/FiberRef/constructors.cjs +1 -1
- package/_cjs/FiberRef/constructors.cjs.map +1 -1
- package/_cjs/FiberRef/unsafe.cjs +35 -21
- package/_cjs/FiberRef/unsafe.cjs.map +1 -1
- package/_cjs/FiberRef.cjs.map +1 -1
- package/_cjs/FiberRefs/api.cjs +15 -13
- package/_cjs/FiberRefs/api.cjs.map +1 -1
- package/_cjs/FiberRefs/join.cjs +37 -35
- package/_cjs/FiberRefs/join.cjs.map +1 -1
- package/_cjs/FiberState/definition.cjs.map +1 -1
- package/_cjs/Future/api.cjs +97 -79
- package/_cjs/Future/api.cjs.map +1 -1
- package/_cjs/Future/constructors.cjs +1 -1
- package/_cjs/Future/constructors.cjs.map +1 -1
- package/_cjs/Hub/constructors.cjs +93 -0
- package/_cjs/Hub/constructors.cjs.map +1 -0
- package/_cjs/Hub/definition.cjs +104 -13
- package/_cjs/Hub/definition.cjs.map +1 -1
- package/_cjs/Hub/internal.cjs +104 -129
- package/_cjs/Hub/internal.cjs.map +1 -1
- package/_cjs/Hub.cjs +4 -4
- package/_cjs/IO/api/acquireReleaseExit.cjs +1 -1
- package/_cjs/IO/api/acquireReleaseExit.cjs.map +1 -1
- package/_cjs/IO/api/acquireReleaseInterruptibleExit.cjs +1 -1
- package/_cjs/IO/api/acquireReleaseInterruptibleExit.cjs.map +1 -1
- package/_cjs/IO/api/addFinalizerExit.cjs +1 -1
- package/_cjs/IO/api/addFinalizerExit.cjs.map +1 -1
- package/_cjs/IO/api/asyncIO.cjs +4 -4
- package/_cjs/IO/api/asyncIO.cjs.map +1 -1
- package/_cjs/IO/api/bracket.cjs +3 -3
- package/_cjs/IO/api/bracket.cjs.map +1 -1
- package/_cjs/IO/api/bracketExit.cjs +3 -3
- package/_cjs/IO/api/bracketExit.cjs.map +1 -1
- package/_cjs/IO/api/clockWith.cjs +2 -2
- package/_cjs/IO/api/clockWith.cjs.map +1 -1
- package/_cjs/IO/api/concurrency.cjs +9 -7
- package/_cjs/IO/api/concurrency.cjs.map +1 -1
- package/_cjs/IO/api/concurrentFinalizers.cjs +1 -1
- package/_cjs/IO/api/concurrentFinalizers.cjs.map +1 -1
- package/_cjs/IO/api/consoleWith.cjs +2 -2
- package/_cjs/IO/api/consoleWith.cjs.map +1 -1
- package/_cjs/IO/api/core-scope.cjs +45 -41
- package/_cjs/IO/api/core-scope.cjs.map +1 -1
- package/_cjs/IO/api/ensuringChildren.cjs +5 -3
- package/_cjs/IO/api/ensuringChildren.cjs.map +1 -1
- package/_cjs/IO/api/environment.cjs +35 -35
- package/_cjs/IO/api/environment.cjs.map +1 -1
- package/_cjs/IO/api/foreachC.cjs +19 -23
- package/_cjs/IO/api/foreachC.cjs.map +1 -1
- package/_cjs/IO/api/foreachExec.cjs +3 -3
- package/_cjs/IO/api/foreachExec.cjs.map +1 -1
- package/_cjs/IO/api/forkAll.cjs +1 -1
- package/_cjs/IO/api/forkAll.cjs.map +1 -1
- package/_cjs/IO/api/forkIn.cjs +8 -6
- package/_cjs/IO/api/forkIn.cjs.map +1 -1
- package/_cjs/IO/api/forkScoped.cjs +1 -1
- package/_cjs/IO/api/forkScoped.cjs.map +1 -1
- package/_cjs/IO/api/fulfill.cjs +8 -6
- package/_cjs/IO/api/fulfill.cjs.map +1 -1
- package/_cjs/IO/api/interrupt.cjs +36 -30
- package/_cjs/IO/api/interrupt.cjs.map +1 -1
- package/_cjs/IO/api/memoize.cjs +1 -1
- package/_cjs/IO/api/memoize.cjs.map +1 -1
- package/_cjs/IO/api/onExit.cjs +6 -4
- package/_cjs/IO/api/onExit.cjs.map +1 -1
- package/_cjs/IO/api/onTermination.cjs +5 -3
- package/_cjs/IO/api/onTermination.cjs.map +1 -1
- package/_cjs/IO/api/once.cjs +3 -5
- package/_cjs/IO/api/once.cjs.map +1 -1
- package/_cjs/IO/api/provideLayer.cjs +6 -4
- package/_cjs/IO/api/provideLayer.cjs.map +1 -1
- package/_cjs/IO/api/provideSomeLayer.cjs +5 -15
- package/_cjs/IO/api/provideSomeLayer.cjs.map +1 -1
- package/_cjs/IO/api/race.cjs +6 -4
- package/_cjs/IO/api/race.cjs.map +1 -1
- package/_cjs/IO/api/raceFirst.cjs +6 -4
- package/_cjs/IO/api/raceFirst.cjs.map +1 -1
- package/_cjs/IO/api/randomWith.cjs +1 -1
- package/_cjs/IO/api/randomWith.cjs.map +1 -1
- package/_cjs/IO/api/repeat.cjs +12 -12
- package/_cjs/IO/api/repeat.cjs.map +1 -1
- package/_cjs/IO/api/retry.cjs +14 -14
- package/_cjs/IO/api/retry.cjs.map +1 -1
- package/_cjs/IO/api/schedule.cjs +15 -11
- package/_cjs/IO/api/schedule.cjs.map +1 -1
- package/_cjs/IO/api/scoped.cjs +6 -6
- package/_cjs/IO/api/scoped.cjs.map +1 -1
- package/_cjs/IO/api/sequenceT.cjs +1 -1
- package/_cjs/IO/api/sequenceT.cjs.map +1 -1
- package/_cjs/IO/api/stateful.cjs.map +1 -1
- package/_cjs/IO/api/supervised.cjs +6 -4
- package/_cjs/IO/api/supervised.cjs.map +1 -1
- package/_cjs/IO/api/timeout.cjs +10 -6
- package/_cjs/IO/api/timeout.cjs.map +1 -1
- package/_cjs/IO/api/withChildren.cjs +1 -1
- package/_cjs/IO/api/withChildren.cjs.map +1 -1
- package/_cjs/IO/api/withEarlyRelease.cjs +1 -1
- package/_cjs/IO/api/withEarlyRelease.cjs.map +1 -1
- package/_cjs/IO/api/withFinalizer.cjs +6 -4
- package/_cjs/IO/api/withFinalizer.cjs.map +1 -1
- package/_cjs/IO/api/withFinalizerExit.cjs +6 -4
- package/_cjs/IO/api/withFinalizerExit.cjs.map +1 -1
- package/_cjs/IO/api/withRuntimeConfig.cjs +6 -4
- package/_cjs/IO/api/withRuntimeConfig.cjs.map +1 -1
- package/_cjs/IO/api/zipC.cjs +21 -17
- package/_cjs/IO/api/zipC.cjs.map +1 -1
- package/_cjs/IO/api.cjs +634 -509
- package/_cjs/IO/api.cjs.map +1 -1
- package/_cjs/IO/definition.cjs.map +1 -1
- package/_cjs/IO/runtime.cjs +7 -7
- package/_cjs/IO/runtime.cjs.map +1 -1
- package/_cjs/IO.cjs.map +1 -1
- package/_cjs/IOEnv/definition.cjs +1 -1
- package/_cjs/IOEnv/definition.cjs.map +1 -1
- package/_cjs/IOEnv/live.cjs +1 -1
- package/_cjs/IOEnv/live.cjs.map +1 -1
- package/_cjs/IOEnv/services.cjs.map +1 -1
- package/_cjs/Layer/MemoMap.cjs +86 -92
- package/_cjs/Layer/MemoMap.cjs.map +1 -1
- package/_cjs/Layer/api.cjs +110 -81
- package/_cjs/Layer/api.cjs.map +1 -1
- package/_cjs/Layer/definition.cjs.map +1 -1
- package/_cjs/LogLevel.cjs +24 -16
- package/_cjs/LogLevel.cjs.map +1 -1
- package/_cjs/LogSpan.cjs +18 -16
- package/_cjs/LogSpan.cjs.map +1 -1
- package/_cjs/Logger/api.cjs +18 -14
- package/_cjs/Logger/api.cjs.map +1 -1
- package/_cjs/Logger/constructors.cjs +1 -1
- package/_cjs/Logger/constructors.cjs.map +1 -1
- package/_cjs/Queue/constructors.cjs +19 -5
- package/_cjs/Queue/constructors.cjs.map +1 -1
- package/_cjs/Queue/definition.cjs +191 -16
- package/_cjs/Queue/definition.cjs.map +1 -1
- package/_cjs/Queue/internal.cjs +27 -181
- package/_cjs/Queue/internal.cjs.map +1 -1
- package/_cjs/Queue/strategy.cjs +19 -19
- package/_cjs/Queue/strategy.cjs.map +1 -1
- package/_cjs/Queue.cjs +0 -26
- package/_cjs/Queue.cjs.map +1 -1
- package/_cjs/Random/live.cjs +2 -2
- package/_cjs/Random/live.cjs.map +1 -1
- package/_cjs/Ref/Atomic.cjs +47 -24
- package/_cjs/Ref/Atomic.cjs.map +1 -1
- package/_cjs/Ref/Synchronized.cjs +140 -0
- package/_cjs/Ref/Synchronized.cjs.map +1 -0
- package/_cjs/Ref/constructors.cjs +21 -2
- package/_cjs/Ref/constructors.cjs.map +1 -1
- package/_cjs/Ref/definition.cjs +105 -10
- package/_cjs/Ref/definition.cjs.map +1 -1
- package/_cjs/Ref.cjs +4 -69
- package/_cjs/Ref.cjs.map +1 -1
- package/_cjs/Reloadable/constructors.cjs +10 -10
- package/_cjs/Reloadable/constructors.cjs.map +1 -1
- package/_cjs/RuntimeConfig.cjs +2 -2
- package/_cjs/RuntimeConfig.cjs.map +1 -1
- package/_cjs/STM/api/core-api.cjs +36 -26
- package/_cjs/STM/api/core-api.cjs.map +1 -1
- package/_cjs/STM/api.cjs +217 -163
- package/_cjs/STM/api.cjs.map +1 -1
- package/_cjs/STM/driver.cjs +3 -3
- package/_cjs/STM/driver.cjs.map +1 -1
- package/_cjs/STM/internal/Entry.cjs.map +1 -1
- package/_cjs/STM/internal/Journal.cjs +33 -29
- package/_cjs/STM/internal/Journal.cjs.map +1 -1
- package/_cjs/STM.cjs.map +1 -1
- package/_cjs/Schedule/Decision.cjs +16 -14
- package/_cjs/Schedule/Decision.cjs.map +1 -1
- package/_cjs/Schedule/api/driver.cjs +16 -20
- package/_cjs/Schedule/api/driver.cjs.map +1 -1
- package/_cjs/Schedule/api.cjs +381 -290
- package/_cjs/Schedule/api.cjs.map +1 -1
- package/_cjs/Scope/ReleaseMap/api/releaseAll.cjs +14 -14
- package/_cjs/Scope/ReleaseMap/api/releaseAll.cjs.map +1 -1
- package/_cjs/Scope/ReleaseMap/api.cjs +68 -61
- package/_cjs/Scope/ReleaseMap/api.cjs.map +1 -1
- package/_cjs/Scope/api.cjs +34 -27
- package/_cjs/Scope/api.cjs.map +1 -1
- package/_cjs/ScopedRef/api.cjs +9 -13
- package/_cjs/ScopedRef/api.cjs.map +1 -1
- package/_cjs/ScopedRef/definition.cjs +1 -1
- package/_cjs/ScopedRef/definition.cjs.map +1 -1
- package/_cjs/Sink/api.cjs +307 -249
- package/_cjs/Sink/api.cjs.map +1 -1
- package/_cjs/State/api.cjs +18 -14
- package/_cjs/State/api.cjs.map +1 -1
- package/_cjs/Stream/api/zipAllWith.cjs +15 -13
- package/_cjs/Stream/api/zipAllWith.cjs.map +1 -1
- package/_cjs/Stream/api/zipWith.cjs +6 -4
- package/_cjs/Stream/api/zipWith.cjs.map +1 -1
- package/_cjs/Stream/api/zipWithChunks.cjs +13 -11
- package/_cjs/Stream/api/zipWithChunks.cjs.map +1 -1
- package/_cjs/Stream/api.cjs +992 -788
- package/_cjs/Stream/api.cjs.map +1 -1
- package/_cjs/Stream/definition.cjs.map +1 -1
- package/_cjs/Stream/internal/DebounceState.cjs +21 -19
- package/_cjs/Stream/internal/DebounceState.cjs.map +1 -1
- package/_cjs/Stream/internal/Handoff.cjs +35 -33
- package/_cjs/Stream/internal/Handoff.cjs.map +1 -1
- package/_cjs/Stream/internal/Pull.cjs +9 -11
- package/_cjs/Stream/internal/Pull.cjs.map +1 -1
- package/_cjs/Stream/internal/SinkEndReason.cjs +16 -14
- package/_cjs/Stream/internal/SinkEndReason.cjs.map +1 -1
- package/_cjs/Stream/internal/Take.cjs +32 -24
- package/_cjs/Stream/internal/Take.cjs.map +1 -1
- package/_cjs/Stream/internal/util.cjs +3 -3
- package/_cjs/Stream/internal/util.cjs.map +1 -1
- package/_cjs/SubscriptionRef.cjs +68 -0
- package/_cjs/SubscriptionRef.cjs.map +1 -0
- package/_cjs/Supervisor/api.cjs +49 -34
- package/_cjs/Supervisor/api.cjs.map +1 -1
- package/_cjs/Supervisor/constructors.cjs +2 -2
- package/_cjs/Supervisor/constructors.cjs.map +1 -1
- package/_cjs/Supervisor/definition.cjs +66 -1
- package/_cjs/Supervisor/definition.cjs.map +1 -1
- package/_cjs/SupervisorPatch.cjs +176 -0
- package/_cjs/SupervisorPatch.cjs.map +1 -0
- package/_cjs/TExit/definition.cjs.map +1 -1
- package/_cjs/TFuture/api.cjs +21 -15
- package/_cjs/TFuture/api.cjs.map +1 -1
- package/_cjs/TFuture/constructors.cjs +1 -1
- package/_cjs/TFuture/constructors.cjs.map +1 -1
- package/_cjs/TFuture/definition.cjs.map +1 -1
- package/_cjs/TReentrantLock/api.cjs +32 -28
- package/_cjs/TReentrantLock/api.cjs.map +1 -1
- package/_cjs/TReentrantLock/definition.cjs +4 -4
- package/_cjs/TReentrantLock/definition.cjs.map +1 -1
- package/_cjs/TRef/api.cjs +233 -209
- package/_cjs/TRef/api.cjs.map +1 -1
- package/_cjs/TRef/definition.cjs +4 -4
- package/_cjs/TRef/definition.cjs.map +1 -1
- package/_cjs/TSemaphore/api.cjs +27 -23
- package/_cjs/TSemaphore/api.cjs.map +1 -1
- package/_cjs/TSemaphore/constructors.cjs +18 -3
- package/_cjs/TSemaphore/constructors.cjs.map +1 -1
- package/_cjs/collection/immutable/Conc/dropUntilIO.cjs +21 -19
- package/_cjs/collection/immutable/Conc/dropUntilIO.cjs.map +1 -1
- package/_cjs/collection/immutable/Conc/dropWhileIO.cjs +21 -19
- package/_cjs/collection/immutable/Conc/dropWhileIO.cjs.map +1 -1
- package/_cjs/collection/immutable/Conc/filterIO.cjs +16 -14
- package/_cjs/collection/immutable/Conc/filterIO.cjs.map +1 -1
- package/_cjs/collection/immutable/Conc/findIO.cjs +19 -17
- package/_cjs/collection/immutable/Conc/findIO.cjs.map +1 -1
- package/_cjs/collection/immutable/Conc/mapIO.cjs +11 -9
- package/_cjs/collection/immutable/Conc/mapIO.cjs.map +1 -1
- package/_cjs/collection/immutable/Conc/takeWhileIO.cjs +31 -29
- package/_cjs/collection/immutable/Conc/takeWhileIO.cjs.map +1 -1
- package/_cjs/data/Exit/foreachIO.cjs +6 -4
- package/_cjs/data/Exit/foreachIO.cjs.map +1 -1
- package/_cjs/internal/Hub.cjs +13 -11
- package/_cjs/internal/Hub.cjs.map +1 -1
- package/_cjs/internal/IsFatal.cjs +18 -16
- package/_cjs/internal/IsFatal.cjs.map +1 -1
- package/_cjs/internal/MutableQueue.cjs +11 -9
- package/_cjs/internal/MutableQueue.cjs.map +1 -1
- package/_cjs/internal/StackTraceBuilder.cjs.map +1 -1
- package/_mjs/Cached/api.mjs +6 -6
- package/_mjs/Cached/api.mjs.map +1 -1
- package/_mjs/Channel/ChildExecutorDecision/api.mjs +18 -16
- package/_mjs/Channel/ChildExecutorDecision/api.mjs.map +1 -1
- package/_mjs/Channel/UpstreamPullRequest/api.mjs +14 -12
- package/_mjs/Channel/UpstreamPullRequest/api.mjs.map +1 -1
- package/_mjs/Channel/api/interruptWhen.mjs +11 -7
- package/_mjs/Channel/api/interruptWhen.mjs.map +1 -1
- package/_mjs/Channel/api/mapOutIOC.mjs +24 -23
- package/_mjs/Channel/api/mapOutIOC.mjs.map +1 -1
- package/_mjs/Channel/api/mergeAll.mjs +5 -3
- package/_mjs/Channel/api/mergeAll.mjs.map +1 -1
- package/_mjs/Channel/api/mergeAllUnboundedWith.mjs +5 -3
- package/_mjs/Channel/api/mergeAllUnboundedWith.mjs.map +1 -1
- package/_mjs/Channel/api/mergeAllWith.mjs +45 -46
- package/_mjs/Channel/api/mergeAllWith.mjs.map +1 -1
- package/_mjs/Channel/api/mergeMap.mjs +5 -3
- package/_mjs/Channel/api/mergeMap.mjs.map +1 -1
- package/_mjs/Channel/api/mergeWith.mjs +46 -44
- package/_mjs/Channel/api/mergeWith.mjs.map +1 -1
- package/_mjs/Channel/api/run.mjs +1 -1
- package/_mjs/Channel/api/run.mjs.map +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 +3 -3
- package/_mjs/Channel/api/toPull.mjs.map +1 -1
- package/_mjs/Channel/api/zipC.mjs +16 -10
- package/_mjs/Channel/api/zipC.mjs.map +1 -1
- package/_mjs/Channel/api.mjs +224 -173
- package/_mjs/Channel/api.mjs.map +1 -1
- package/_mjs/Channel/core-api.mjs +28 -18
- package/_mjs/Channel/core-api.mjs.map +1 -1
- package/_mjs/Channel/definition.mjs +1 -1
- package/_mjs/Channel/definition.mjs.map +1 -1
- package/_mjs/Channel/internal/ChannelExecutor.mjs +83 -83
- package/_mjs/Channel/internal/ChannelExecutor.mjs.map +1 -1
- package/_mjs/Channel/internal/SingleProducerAsyncInput.mjs +22 -23
- package/_mjs/Channel/internal/SingleProducerAsyncInput.mjs.map +1 -1
- package/_mjs/Differ/api.mjs +90 -0
- package/_mjs/Differ/api.mjs.map +1 -0
- package/_mjs/Differ/definition.mjs +13 -0
- package/_mjs/Differ/definition.mjs.map +1 -0
- package/_mjs/Fiber/FiberContext.mjs +48 -48
- package/_mjs/Fiber/FiberContext.mjs.map +1 -1
- package/_mjs/Fiber/api/awaitAll.mjs +1 -1
- package/_mjs/Fiber/api/awaitAll.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/evalOn.mjs +11 -9
- package/_mjs/Fiber/api/evalOn.mjs.map +1 -1
- package/_mjs/Fiber/api/evalOnIO.mjs +5 -3
- package/_mjs/Fiber/api/evalOnIO.mjs.map +1 -1
- package/_mjs/Fiber/api/fromIO.mjs +1 -1
- package/_mjs/Fiber/api/fromIO.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 +2 -2
- package/_mjs/Fiber/api/interruptAll.mjs.map +1 -1
- package/_mjs/Fiber/api/interruptAs.mjs +6 -4
- package/_mjs/Fiber/api/interruptAs.mjs.map +1 -1
- package/_mjs/Fiber/api/interruptAsFork.mjs +6 -4
- package/_mjs/Fiber/api/interruptAsFork.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/join.mjs +1 -1
- package/_mjs/Fiber/api/join.mjs.map +1 -1
- package/_mjs/Fiber/api/joinAll.mjs +1 -1
- package/_mjs/Fiber/api/joinAll.mjs.map +1 -1
- package/_mjs/Fiber/api/mapFiber.mjs +5 -3
- package/_mjs/Fiber/api/mapFiber.mjs.map +1 -1
- package/_mjs/Fiber/api/mapIO.mjs +11 -7
- package/_mjs/Fiber/api/mapIO.mjs.map +1 -1
- package/_mjs/Fiber/api/zipWith.mjs +5 -3
- package/_mjs/Fiber/api/zipWith.mjs.map +1 -1
- package/_mjs/Fiber/definition.mjs.map +1 -1
- package/_mjs/Fiber.mjs +1 -0
- package/_mjs/Fiber.mjs.map +1 -1
- package/_mjs/FiberRef/api/locallyScoped.mjs +5 -3
- package/_mjs/FiberRef/api/locallyScoped.mjs.map +1 -1
- package/_mjs/FiberRef/api/locallyScopedWith.mjs +5 -3
- package/_mjs/FiberRef/api/locallyScopedWith.mjs.map +1 -1
- package/_mjs/FiberRef/api.mjs +52 -36
- package/_mjs/FiberRef/api.mjs.map +1 -1
- package/_mjs/FiberRef/constructors.mjs +1 -1
- package/_mjs/FiberRef/constructors.mjs.map +1 -1
- package/_mjs/FiberRef/unsafe.mjs +31 -20
- package/_mjs/FiberRef/unsafe.mjs.map +1 -1
- package/_mjs/FiberRef.mjs.map +1 -1
- package/_mjs/FiberRefs/api.mjs +14 -12
- package/_mjs/FiberRefs/api.mjs.map +1 -1
- package/_mjs/FiberRefs/join.mjs +35 -33
- package/_mjs/FiberRefs/join.mjs.map +1 -1
- package/_mjs/FiberState/definition.mjs.map +1 -1
- package/_mjs/Future/api.mjs +84 -66
- package/_mjs/Future/api.mjs.map +1 -1
- package/_mjs/Future/constructors.mjs +1 -1
- package/_mjs/Future/constructors.mjs.map +1 -1
- package/_mjs/Hub/constructors.mjs +66 -0
- package/_mjs/Hub/constructors.mjs.map +1 -0
- package/_mjs/Hub/definition.mjs +88 -9
- package/_mjs/Hub/definition.mjs.map +1 -1
- package/_mjs/Hub/internal.mjs +105 -122
- package/_mjs/Hub/internal.mjs.map +1 -1
- package/_mjs/Hub.mjs +1 -1
- package/_mjs/Hub.mjs.map +1 -1
- package/_mjs/IO/api/acquireReleaseExit.mjs +1 -1
- package/_mjs/IO/api/acquireReleaseExit.mjs.map +1 -1
- package/_mjs/IO/api/acquireReleaseInterruptibleExit.mjs +1 -1
- package/_mjs/IO/api/acquireReleaseInterruptibleExit.mjs.map +1 -1
- package/_mjs/IO/api/addFinalizerExit.mjs +1 -1
- package/_mjs/IO/api/addFinalizerExit.mjs.map +1 -1
- package/_mjs/IO/api/asyncIO.mjs +4 -4
- package/_mjs/IO/api/asyncIO.mjs.map +1 -1
- package/_mjs/IO/api/bracket.mjs +2 -2
- package/_mjs/IO/api/bracket.mjs.map +1 -1
- package/_mjs/IO/api/bracketExit.mjs +2 -2
- package/_mjs/IO/api/bracketExit.mjs.map +1 -1
- package/_mjs/IO/api/clockWith.mjs +2 -2
- package/_mjs/IO/api/clockWith.mjs.map +1 -1
- package/_mjs/IO/api/concurrency.mjs +8 -6
- package/_mjs/IO/api/concurrency.mjs.map +1 -1
- package/_mjs/IO/api/concurrentFinalizers.mjs +1 -1
- package/_mjs/IO/api/concurrentFinalizers.mjs.map +1 -1
- package/_mjs/IO/api/consoleWith.mjs +2 -2
- package/_mjs/IO/api/consoleWith.mjs.map +1 -1
- package/_mjs/IO/api/core-scope.mjs +40 -36
- package/_mjs/IO/api/core-scope.mjs.map +1 -1
- package/_mjs/IO/api/ensuringChildren.mjs +5 -3
- package/_mjs/IO/api/ensuringChildren.mjs.map +1 -1
- package/_mjs/IO/api/environment.mjs +29 -27
- package/_mjs/IO/api/environment.mjs.map +1 -1
- package/_mjs/IO/api/foreachC.mjs +17 -19
- package/_mjs/IO/api/foreachC.mjs.map +1 -1
- package/_mjs/IO/api/foreachExec.mjs +2 -2
- package/_mjs/IO/api/foreachExec.mjs.map +1 -1
- package/_mjs/IO/api/forkAll.mjs +1 -1
- package/_mjs/IO/api/forkAll.mjs.map +1 -1
- package/_mjs/IO/api/forkIn.mjs +7 -5
- package/_mjs/IO/api/forkIn.mjs.map +1 -1
- package/_mjs/IO/api/forkScoped.mjs +1 -1
- package/_mjs/IO/api/forkScoped.mjs.map +1 -1
- package/_mjs/IO/api/fulfill.mjs +7 -5
- package/_mjs/IO/api/fulfill.mjs.map +1 -1
- package/_mjs/IO/api/interrupt.mjs +34 -28
- package/_mjs/IO/api/interrupt.mjs.map +1 -1
- package/_mjs/IO/api/memoize.mjs +1 -1
- package/_mjs/IO/api/memoize.mjs.map +1 -1
- package/_mjs/IO/api/onExit.mjs +5 -3
- package/_mjs/IO/api/onExit.mjs.map +1 -1
- package/_mjs/IO/api/onTermination.mjs +5 -3
- package/_mjs/IO/api/onTermination.mjs.map +1 -1
- package/_mjs/IO/api/once.mjs +3 -4
- package/_mjs/IO/api/once.mjs.map +1 -1
- package/_mjs/IO/api/provideLayer.mjs +5 -3
- package/_mjs/IO/api/provideLayer.mjs.map +1 -1
- package/_mjs/IO/api/provideSomeLayer.mjs +5 -11
- package/_mjs/IO/api/provideSomeLayer.mjs.map +1 -1
- package/_mjs/IO/api/race.mjs +5 -3
- package/_mjs/IO/api/race.mjs.map +1 -1
- package/_mjs/IO/api/raceFirst.mjs +5 -3
- package/_mjs/IO/api/raceFirst.mjs.map +1 -1
- package/_mjs/IO/api/randomWith.mjs +1 -1
- package/_mjs/IO/api/randomWith.mjs.map +1 -1
- package/_mjs/IO/api/repeat.mjs +8 -8
- package/_mjs/IO/api/repeat.mjs.map +1 -1
- package/_mjs/IO/api/retry.mjs +12 -12
- package/_mjs/IO/api/retry.mjs.map +1 -1
- package/_mjs/IO/api/schedule.mjs +15 -11
- package/_mjs/IO/api/schedule.mjs.map +1 -1
- package/_mjs/IO/api/scoped.mjs +3 -3
- package/_mjs/IO/api/scoped.mjs.map +1 -1
- package/_mjs/IO/api/sequenceT.mjs +1 -1
- package/_mjs/IO/api/sequenceT.mjs.map +1 -1
- package/_mjs/IO/api/stateful.mjs.map +1 -1
- package/_mjs/IO/api/supervised.mjs +5 -3
- package/_mjs/IO/api/supervised.mjs.map +1 -1
- package/_mjs/IO/api/timeout.mjs +10 -6
- package/_mjs/IO/api/timeout.mjs.map +1 -1
- package/_mjs/IO/api/withChildren.mjs +1 -1
- package/_mjs/IO/api/withChildren.mjs.map +1 -1
- package/_mjs/IO/api/withEarlyRelease.mjs +1 -1
- package/_mjs/IO/api/withEarlyRelease.mjs.map +1 -1
- package/_mjs/IO/api/withFinalizer.mjs +5 -3
- package/_mjs/IO/api/withFinalizer.mjs.map +1 -1
- package/_mjs/IO/api/withFinalizerExit.mjs +5 -3
- package/_mjs/IO/api/withFinalizerExit.mjs.map +1 -1
- package/_mjs/IO/api/withRuntimeConfig.mjs +5 -3
- package/_mjs/IO/api/withRuntimeConfig.mjs.map +1 -1
- package/_mjs/IO/api/zipC.mjs +18 -14
- package/_mjs/IO/api/zipC.mjs.map +1 -1
- package/_mjs/IO/api.mjs +511 -387
- package/_mjs/IO/api.mjs.map +1 -1
- package/_mjs/IO/definition.mjs.map +1 -1
- package/_mjs/IO/runtime.mjs +7 -7
- package/_mjs/IO/runtime.mjs.map +1 -1
- package/_mjs/IO.mjs.map +1 -1
- package/_mjs/IOEnv/definition.mjs +1 -1
- package/_mjs/IOEnv/definition.mjs.map +1 -1
- package/_mjs/IOEnv/live.mjs +1 -1
- package/_mjs/IOEnv/live.mjs.map +1 -1
- package/_mjs/IOEnv/services.mjs.map +1 -1
- package/_mjs/Layer/MemoMap.mjs +86 -87
- package/_mjs/Layer/MemoMap.mjs.map +1 -1
- package/_mjs/Layer/api.mjs +91 -63
- package/_mjs/Layer/api.mjs.map +1 -1
- package/_mjs/Layer/definition.mjs.map +1 -1
- package/_mjs/LogLevel.mjs +24 -16
- package/_mjs/LogLevel.mjs.map +1 -1
- package/_mjs/LogSpan.mjs +16 -14
- package/_mjs/LogSpan.mjs.map +1 -1
- package/_mjs/Logger/api.mjs +16 -12
- package/_mjs/Logger/api.mjs.map +1 -1
- package/_mjs/Logger/constructors.mjs +1 -1
- package/_mjs/Logger/constructors.mjs.map +1 -1
- package/_mjs/Queue/constructors.mjs +16 -5
- package/_mjs/Queue/constructors.mjs.map +1 -1
- package/_mjs/Queue/definition.mjs +174 -12
- package/_mjs/Queue/definition.mjs.map +1 -1
- package/_mjs/Queue/internal.mjs +21 -170
- package/_mjs/Queue/internal.mjs.map +1 -1
- package/_mjs/Queue/strategy.mjs +20 -23
- package/_mjs/Queue/strategy.mjs.map +1 -1
- package/_mjs/Queue.mjs +1 -3
- package/_mjs/Queue.mjs.map +1 -1
- package/_mjs/Random/live.mjs +2 -2
- package/_mjs/Random/live.mjs.map +1 -1
- package/_mjs/Ref/Atomic.mjs +39 -3
- package/_mjs/Ref/Atomic.mjs.map +1 -1
- package/_mjs/Ref/Synchronized.mjs +123 -0
- package/_mjs/Ref/Synchronized.mjs.map +1 -0
- package/_mjs/Ref/constructors.mjs +15 -1
- package/_mjs/Ref/constructors.mjs.map +1 -1
- package/_mjs/Ref/definition.mjs +96 -4
- package/_mjs/Ref/definition.mjs.map +1 -1
- package/_mjs/Ref.mjs +1 -8
- package/_mjs/Ref.mjs.map +1 -1
- package/_mjs/Reloadable/constructors.mjs +10 -10
- package/_mjs/Reloadable/constructors.mjs.map +1 -1
- package/_mjs/RuntimeConfig.mjs +2 -2
- package/_mjs/RuntimeConfig.mjs.map +1 -1
- package/_mjs/STM/api/core-api.mjs +29 -19
- package/_mjs/STM/api/core-api.mjs.map +1 -1
- package/_mjs/STM/api.mjs +180 -127
- package/_mjs/STM/api.mjs.map +1 -1
- package/_mjs/STM/driver.mjs +3 -3
- package/_mjs/STM/driver.mjs.map +1 -1
- package/_mjs/STM/internal/Entry.mjs.map +1 -1
- package/_mjs/STM/internal/Journal.mjs +33 -29
- package/_mjs/STM/internal/Journal.mjs.map +1 -1
- package/_mjs/STM.mjs.map +1 -1
- package/_mjs/Schedule/Decision.mjs +14 -12
- package/_mjs/Schedule/Decision.mjs.map +1 -1
- package/_mjs/Schedule/api/driver.mjs +15 -17
- package/_mjs/Schedule/api/driver.mjs.map +1 -1
- package/_mjs/Schedule/api.mjs +326 -234
- package/_mjs/Schedule/api.mjs.map +1 -1
- package/_mjs/Scope/ReleaseMap/api/releaseAll.mjs +12 -11
- package/_mjs/Scope/ReleaseMap/api/releaseAll.mjs.map +1 -1
- package/_mjs/Scope/ReleaseMap/api.mjs +60 -51
- package/_mjs/Scope/ReleaseMap/api.mjs.map +1 -1
- package/_mjs/Scope/api.mjs +28 -22
- package/_mjs/Scope/api.mjs.map +1 -1
- package/_mjs/ScopedRef/api.mjs +9 -11
- package/_mjs/ScopedRef/api.mjs.map +1 -1
- package/_mjs/ScopedRef/definition.mjs +1 -1
- package/_mjs/ScopedRef/definition.mjs.map +1 -1
- package/_mjs/Sink/api.mjs +301 -240
- package/_mjs/Sink/api.mjs.map +1 -1
- package/_mjs/State/api.mjs +16 -12
- package/_mjs/State/api.mjs.map +1 -1
- package/_mjs/Stream/api/zipAllWith.mjs +14 -12
- package/_mjs/Stream/api/zipAllWith.mjs.map +1 -1
- package/_mjs/Stream/api/zipWith.mjs +5 -3
- package/_mjs/Stream/api/zipWith.mjs.map +1 -1
- package/_mjs/Stream/api/zipWithChunks.mjs +12 -10
- package/_mjs/Stream/api/zipWithChunks.mjs.map +1 -1
- package/_mjs/Stream/api.mjs +856 -653
- package/_mjs/Stream/api.mjs.map +1 -1
- package/_mjs/Stream/definition.mjs.map +1 -1
- package/_mjs/Stream/internal/DebounceState.mjs +18 -16
- package/_mjs/Stream/internal/DebounceState.mjs.map +1 -1
- package/_mjs/Stream/internal/Handoff.mjs +35 -32
- package/_mjs/Stream/internal/Handoff.mjs.map +1 -1
- package/_mjs/Stream/internal/Pull.mjs +9 -10
- package/_mjs/Stream/internal/Pull.mjs.map +1 -1
- package/_mjs/Stream/internal/SinkEndReason.mjs +14 -12
- package/_mjs/Stream/internal/SinkEndReason.mjs.map +1 -1
- package/_mjs/Stream/internal/Take.mjs +28 -20
- package/_mjs/Stream/internal/Take.mjs.map +1 -1
- package/_mjs/Stream/internal/util.mjs +3 -3
- package/_mjs/Stream/internal/util.mjs.map +1 -1
- package/_mjs/SubscriptionRef.mjs +45 -0
- package/_mjs/SubscriptionRef.mjs.map +1 -0
- package/_mjs/Supervisor/api.mjs +44 -33
- package/_mjs/Supervisor/api.mjs.map +1 -1
- package/_mjs/Supervisor/constructors.mjs +2 -2
- package/_mjs/Supervisor/constructors.mjs.map +1 -1
- package/_mjs/Supervisor/definition.mjs +55 -0
- package/_mjs/Supervisor/definition.mjs.map +1 -1
- package/_mjs/SupervisorPatch.mjs +135 -0
- package/_mjs/SupervisorPatch.mjs.map +1 -0
- package/_mjs/TExit/definition.mjs.map +1 -1
- package/_mjs/TFuture/api.mjs +17 -11
- package/_mjs/TFuture/api.mjs.map +1 -1
- package/_mjs/TFuture/constructors.mjs +1 -1
- package/_mjs/TFuture/constructors.mjs.map +1 -1
- package/_mjs/TFuture/definition.mjs.map +1 -1
- package/_mjs/TReentrantLock/api.mjs +32 -28
- package/_mjs/TReentrantLock/api.mjs.map +1 -1
- package/_mjs/TReentrantLock/definition.mjs +4 -4
- package/_mjs/TReentrantLock/definition.mjs.map +1 -1
- package/_mjs/TRef/api.mjs +218 -194
- package/_mjs/TRef/api.mjs.map +1 -1
- package/_mjs/TRef/definition.mjs +4 -4
- package/_mjs/TRef/definition.mjs.map +1 -1
- package/_mjs/TSemaphore/api.mjs +23 -19
- package/_mjs/TSemaphore/api.mjs.map +1 -1
- package/_mjs/TSemaphore/constructors.mjs +12 -2
- package/_mjs/TSemaphore/constructors.mjs.map +1 -1
- package/_mjs/collection/immutable/Conc/dropUntilIO.mjs +19 -17
- package/_mjs/collection/immutable/Conc/dropUntilIO.mjs.map +1 -1
- package/_mjs/collection/immutable/Conc/dropWhileIO.mjs +19 -17
- package/_mjs/collection/immutable/Conc/dropWhileIO.mjs.map +1 -1
- package/_mjs/collection/immutable/Conc/filterIO.mjs +14 -12
- package/_mjs/collection/immutable/Conc/filterIO.mjs.map +1 -1
- package/_mjs/collection/immutable/Conc/findIO.mjs +17 -15
- package/_mjs/collection/immutable/Conc/findIO.mjs.map +1 -1
- package/_mjs/collection/immutable/Conc/mapIO.mjs +10 -8
- package/_mjs/collection/immutable/Conc/mapIO.mjs.map +1 -1
- package/_mjs/collection/immutable/Conc/takeWhileIO.mjs +28 -26
- package/_mjs/collection/immutable/Conc/takeWhileIO.mjs.map +1 -1
- package/_mjs/data/Exit/foreachIO.mjs +5 -3
- package/_mjs/data/Exit/foreachIO.mjs.map +1 -1
- package/_mjs/internal/Hub.mjs +13 -11
- package/_mjs/internal/Hub.mjs.map +1 -1
- package/_mjs/internal/IsFatal.mjs +18 -16
- package/_mjs/internal/IsFatal.mjs.map +1 -1
- package/_mjs/internal/MutableQueue.mjs +10 -8
- package/_mjs/internal/MutableQueue.mjs.map +1 -1
- package/_mjs/internal/StackTraceBuilder.mjs.map +1 -1
- package/_src/Cached/api.ts +2 -2
- package/_src/Channel/ChildExecutorDecision/api.ts +14 -17
- package/_src/Channel/UpstreamPullRequest/api.ts +11 -13
- package/_src/Channel/api/interruptWhen.ts +18 -17
- package/_src/Channel/api/mapOutIOC.ts +58 -58
- package/_src/Channel/api/mergeAll.ts +15 -16
- package/_src/Channel/api/mergeAllUnboundedWith.ts +15 -27
- package/_src/Channel/api/mergeAllWith.ts +114 -126
- package/_src/Channel/api/mergeMap.ts +8 -18
- package/_src/Channel/api/mergeWith.ts +154 -158
- package/_src/Channel/api/toPull.ts +1 -1
- package/_src/Channel/api/zipC.ts +52 -88
- package/_src/Channel/api.ts +345 -405
- package/_src/Channel/core-api.ts +75 -122
- package/_src/Channel/definition.ts +49 -7
- package/_src/Channel/internal/ChannelExecutor.ts +1 -5
- package/_src/Channel/internal/SingleProducerAsyncInput.ts +1 -3
- package/_src/Differ/api.ts +72 -0
- package/_src/Differ/definition.ts +16 -0
- package/_src/Fiber/FiberContext.ts +13 -33
- package/_src/Fiber/api/collectAll.ts +1 -2
- package/_src/Fiber/api/evalOn.ts +11 -14
- package/_src/Fiber/api/evalOnIO.ts +10 -13
- package/_src/Fiber/api/interruptAll.ts +1 -2
- package/_src/Fiber/api/interruptAs.ts +6 -4
- package/_src/Fiber/api/interruptAsFork.ts +6 -4
- package/_src/Fiber/api/interruptFork.ts +1 -1
- package/_src/Fiber/api/mapFiber.ts +5 -7
- package/_src/Fiber/api/mapIO.ts +21 -21
- package/_src/Fiber/api/zipWith.ts +14 -17
- package/_src/Fiber/definition.ts +1 -15
- package/_src/Fiber.ts +1 -1
- package/_src/FiberRef/api/locallyScoped.ts +8 -6
- package/_src/FiberRef/api/locallyScopedWith.ts +5 -7
- package/_src/FiberRef/api.ts +50 -39
- package/_src/FiberRef/unsafe.ts +24 -22
- package/_src/FiberRef.ts +0 -1
- package/_src/FiberRefs/api.ts +14 -12
- package/_src/FiberRefs/join.ts +37 -46
- package/_src/FiberState/definition.ts +1 -2
- package/_src/Future/api.ts +67 -53
- package/_src/Hub/constructors.ts +80 -0
- package/_src/Hub/definition.ts +95 -89
- package/_src/Hub/internal.ts +115 -165
- package/_src/Hub.ts +1 -1
- package/_src/IO/api/acquireRelease.ts +1 -1
- package/_src/IO/api/acquireReleaseExit.ts +1 -1
- package/_src/IO/api/bracket.ts +1 -1
- package/_src/IO/api/bracketExit.ts +1 -1
- package/_src/IO/api/clockWith.ts +0 -1
- package/_src/IO/api/concurrency.ts +5 -7
- package/_src/IO/api/consoleWith.ts +0 -2
- package/_src/IO/api/core-scope.ts +36 -33
- package/_src/IO/api/ensuringChildren.ts +8 -7
- package/_src/IO/api/environment.ts +24 -42
- package/_src/IO/api/foreachC.ts +24 -12
- package/_src/IO/api/foreachExec.ts +1 -1
- package/_src/IO/api/forkIn.ts +7 -9
- package/_src/IO/api/fulfill.ts +5 -3
- package/_src/IO/api/interrupt.ts +37 -40
- package/_src/IO/api/onExit.ts +8 -10
- package/_src/IO/api/onTermination.ts +12 -14
- package/_src/IO/api/provideLayer.ts +8 -10
- package/_src/IO/api/provideSomeLayer.ts +5 -14
- package/_src/IO/api/race.ts +19 -21
- package/_src/IO/api/raceFirst.ts +5 -7
- package/_src/IO/api/repeat.ts +3 -5
- package/_src/IO/api/retry.ts +19 -21
- package/_src/IO/api/schedule.ts +20 -21
- package/_src/IO/api/scoped.ts +2 -2
- package/_src/IO/api/sequenceT.ts +7 -1
- package/_src/IO/api/stateful.ts +0 -2
- package/_src/IO/api/supervised.ts +5 -7
- package/_src/IO/api/timeout.ts +10 -16
- package/_src/IO/api/withFinalizer.ts +5 -7
- package/_src/IO/api/withFinalizerExit.ts +6 -5
- package/_src/IO/api/withRuntimeConfig.ts +12 -14
- package/_src/IO/api/zipC.ts +57 -62
- package/_src/IO/api.ts +512 -539
- package/_src/IO/definition.ts +21 -9
- package/_src/IO/runtime.ts +0 -12
- package/_src/IO.ts +0 -1
- package/_src/IOEnv/definition.ts +0 -2
- package/_src/IOEnv/services.ts +5 -4
- package/_src/Layer/MemoMap.ts +61 -63
- package/_src/Layer/api.ts +95 -104
- package/_src/Layer/definition.ts +0 -1
- package/_src/LogLevel.ts +24 -16
- package/_src/LogSpan.ts +16 -16
- package/_src/Logger/api.ts +18 -17
- package/_src/Logger/constructors.ts +9 -15
- package/_src/Queue/constructors.ts +22 -6
- package/_src/Queue/definition.ts +230 -81
- package/_src/Queue/internal.ts +9 -180
- package/_src/Queue/strategy.ts +9 -23
- package/_src/Queue.ts +1 -3
- package/_src/Ref/Atomic.ts +37 -4
- package/_src/Ref/Synchronized.ts +107 -0
- package/_src/Ref/constructors.ts +15 -0
- package/_src/Ref/definition.ts +86 -85
- package/_src/Ref.ts +1 -9
- package/_src/Reloadable/constructors.ts +2 -2
- package/_src/RuntimeConfig.ts +0 -2
- package/_src/STM/api/core-api.ts +32 -35
- package/_src/STM/api.ts +210 -200
- package/_src/STM/internal/Entry.ts +0 -10
- package/_src/STM/internal/Journal.ts +23 -26
- package/_src/STM.ts +0 -1
- package/_src/Schedule/Decision.ts +10 -8
- package/_src/Schedule/api/driver.ts +0 -4
- package/_src/Schedule/api.ts +419 -444
- package/_src/Schedule/definition.ts +0 -1
- package/_src/Scope/ReleaseMap/api/releaseAll.ts +23 -26
- package/_src/Scope/ReleaseMap/api.ts +77 -74
- package/_src/Scope/api.ts +16 -18
- package/_src/ScopedRef/api.ts +0 -3
- package/_src/ScopedRef/definition.ts +1 -2
- package/_src/Sink/api.ts +326 -357
- package/_src/State/api.ts +12 -8
- package/_src/State/internal.ts +1 -1
- package/_src/Stream/api/zipAllWith.ts +6 -5
- package/_src/Stream/api/zipWith.ts +5 -8
- package/_src/Stream/api/zipWithChunks.ts +6 -5
- package/_src/Stream/api.ts +1049 -1176
- package/_src/Stream/definition.ts +0 -2
- package/_src/Stream/internal/DebounceState.ts +16 -17
- package/_src/Stream/internal/Handoff.ts +31 -35
- package/_src/Stream/internal/Pull.ts +1 -2
- package/_src/Stream/internal/SinkEndReason.ts +13 -14
- package/_src/Stream/internal/Take.ts +21 -21
- package/_src/Stream/internal/util.ts +0 -2
- package/_src/SubscriptionRef.ts +44 -0
- package/_src/Supervisor/api.ts +39 -31
- package/_src/Supervisor/definition.ts +58 -0
- package/_src/SupervisorPatch.ts +111 -0
- package/_src/TExit/definition.ts +0 -8
- package/_src/TFuture/api.ts +23 -17
- package/_src/TFuture/definition.ts +0 -1
- package/_src/TReentrantLock/api.ts +14 -10
- package/_src/TReentrantLock/definition.ts +0 -7
- package/_src/TRef/api.ts +207 -209
- package/_src/TRef/definition.ts +0 -12
- package/_src/TSemaphore/api.ts +19 -18
- package/_src/TSemaphore/constructors.ts +7 -0
- package/_src/collection/immutable/Conc/dropUntilIO.ts +19 -21
- package/_src/collection/immutable/Conc/dropWhileIO.ts +21 -23
- package/_src/collection/immutable/Conc/filterIO.ts +15 -17
- package/_src/collection/immutable/Conc/findIO.ts +17 -19
- package/_src/collection/immutable/Conc/mapIO.ts +12 -10
- package/_src/collection/immutable/Conc/takeWhileIO.ts +27 -29
- package/_src/data/Exit/foreachIO.ts +8 -10
- package/_src/global.ts +11 -3
- package/_src/index.ts +3 -0
- package/_src/internal/Hub.ts +17 -27
- package/_src/internal/IsFatal.ts +14 -12
- package/_src/internal/MutableQueue.ts +8 -8
- package/_src/internal/StackTraceBuilder.ts +1 -2
- package/collection/immutable/Conc/dropUntilIO.d.ts +3 -3
- package/collection/immutable/Conc/dropWhileIO.d.ts +3 -3
- package/collection/immutable/Conc/filterIO.d.ts +3 -3
- package/collection/immutable/Conc/findIO.d.ts +2 -2
- package/collection/immutable/Conc/mapIO.d.ts +3 -3
- package/collection/immutable/Conc/takeWhileIO.d.ts +3 -3
- package/data/Exit/foreachIO.d.ts +3 -3
- package/global.d.ts +11 -3
- package/index.d.ts +3 -0
- package/internal/Hub.d.ts +2 -2
- package/internal/IsFatal.d.ts +3 -3
- package/internal/MutableQueue.d.ts +3 -3
- package/package.json +3 -3
- package/Hub/api.d.ts +0 -190
- package/Queue/api/dimapIO.d.ts +0 -41
- package/Queue/api/filterInputIO.d.ts +0 -33
- package/Queue/api/filterOutputIO.d.ts +0 -31
- package/Queue/api/operations.d.ts +0 -82
- package/Queue/api/poll.d.ts +0 -9
- package/Queue/api/takeBetween.d.ts +0 -11
- package/Queue/api/zipWithIO.d.ts +0 -44
- package/Queue/api.d.ts +0 -7
- package/Ref/Atomic/Atomic.d.ts +0 -18
- package/Ref/Atomic/api.d.ts +0 -53
- package/Ref/Derived.d.ts +0 -14
- package/Ref/DerivedAll.d.ts +0 -14
- package/Ref/Synchronized/api.d.ts +0 -100
- package/Ref/Synchronized/constructors.d.ts +0 -8
- package/Ref/Synchronized/definition.d.ts +0 -42
- package/Ref/api/collect.d.ts +0 -11
- package/Ref/api/dimap.d.ts +0 -56
- package/Ref/api/filter.d.ts +0 -20
- package/Ref/api/get.d.ts +0 -9
- package/Ref/api/match.d.ts +0 -13
- package/Ref/api/matchAll.d.ts +0 -11
- package/Ref/api/modify.d.ts +0 -79
- package/Ref/api/set.d.ts +0 -10
- package/Ref/api.d.ts +0 -23
- package/_cjs/Hub/api.cjs +0 -456
- package/_cjs/Hub/api.cjs.map +0 -1
- package/_cjs/Queue/api/dimapIO.cjs +0 -120
- package/_cjs/Queue/api/dimapIO.cjs.map +0 -1
- package/_cjs/Queue/api/filterInputIO.cjs +0 -84
- package/_cjs/Queue/api/filterInputIO.cjs.map +0 -1
- package/_cjs/Queue/api/filterOutputIO.cjs +0 -89
- package/_cjs/Queue/api/filterOutputIO.cjs.map +0 -1
- package/_cjs/Queue/api/operations.cjs +0 -147
- package/_cjs/Queue/api/operations.cjs.map +0 -1
- package/_cjs/Queue/api/poll.cjs +0 -27
- package/_cjs/Queue/api/poll.cjs.map +0 -1
- package/_cjs/Queue/api/takeBetween.cjs +0 -57
- package/_cjs/Queue/api/takeBetween.cjs.map +0 -1
- package/_cjs/Queue/api/zipWithIO.cjs +0 -97
- package/_cjs/Queue/api/zipWithIO.cjs.map +0 -1
- package/_cjs/Queue/api.cjs +0 -97
- package/_cjs/Queue/api.cjs.map +0 -1
- package/_cjs/Ref/Atomic/Atomic.cjs +0 -64
- package/_cjs/Ref/Atomic/Atomic.cjs.map +0 -1
- package/_cjs/Ref/Atomic/api.cjs +0 -156
- package/_cjs/Ref/Atomic/api.cjs.map +0 -1
- package/_cjs/Ref/Derived.cjs +0 -55
- package/_cjs/Ref/Derived.cjs.map +0 -1
- package/_cjs/Ref/DerivedAll.cjs +0 -55
- package/_cjs/Ref/DerivedAll.cjs.map +0 -1
- package/_cjs/Ref/Synchronized/api.cjs +0 -196
- package/_cjs/Ref/Synchronized/api.cjs.map +0 -1
- package/_cjs/Ref/Synchronized/constructors.cjs +0 -32
- package/_cjs/Ref/Synchronized/constructors.cjs.map +0 -1
- package/_cjs/Ref/Synchronized/definition.cjs +0 -88
- package/_cjs/Ref/Synchronized/definition.cjs.map +0 -1
- package/_cjs/Ref/api/collect.cjs +0 -31
- package/_cjs/Ref/api/collect.cjs.map +0 -1
- package/_cjs/Ref/api/dimap.cjs +0 -110
- package/_cjs/Ref/api/dimap.cjs.map +0 -1
- package/_cjs/Ref/api/filter.cjs +0 -45
- package/_cjs/Ref/api/filter.cjs.map +0 -1
- package/_cjs/Ref/api/get.cjs +0 -20
- package/_cjs/Ref/api/get.cjs.map +0 -1
- package/_cjs/Ref/api/match.cjs +0 -26
- package/_cjs/Ref/api/match.cjs.map +0 -1
- package/_cjs/Ref/api/matchAll.cjs +0 -24
- package/_cjs/Ref/api/matchAll.cjs.map +0 -1
- package/_cjs/Ref/api/modify.cjs +0 -239
- package/_cjs/Ref/api/modify.cjs.map +0 -1
- package/_cjs/Ref/api/set.cjs +0 -21
- package/_cjs/Ref/api/set.cjs.map +0 -1
- package/_cjs/Ref/api.cjs +0 -158
- package/_cjs/Ref/api.cjs.map +0 -1
- package/_mjs/Hub/api.mjs +0 -384
- package/_mjs/Hub/api.mjs.map +0 -1
- package/_mjs/Queue/api/dimapIO.mjs +0 -97
- package/_mjs/Queue/api/dimapIO.mjs.map +0 -1
- package/_mjs/Queue/api/filterInputIO.mjs +0 -63
- package/_mjs/Queue/api/filterInputIO.mjs.map +0 -1
- package/_mjs/Queue/api/filterOutputIO.mjs +0 -68
- package/_mjs/Queue/api/filterOutputIO.mjs.map +0 -1
- package/_mjs/Queue/api/operations.mjs +0 -122
- package/_mjs/Queue/api/operations.mjs.map +0 -1
- package/_mjs/Queue/api/poll.mjs +0 -14
- package/_mjs/Queue/api/poll.mjs.map +0 -1
- package/_mjs/Queue/api/takeBetween.mjs +0 -43
- package/_mjs/Queue/api/takeBetween.mjs.map +0 -1
- package/_mjs/Queue/api/zipWithIO.mjs +0 -74
- package/_mjs/Queue/api/zipWithIO.mjs.map +0 -1
- package/_mjs/Queue/api.mjs +0 -9
- package/_mjs/Queue/api.mjs.map +0 -1
- package/_mjs/Ref/Atomic/Atomic.mjs +0 -47
- package/_mjs/Ref/Atomic/Atomic.mjs.map +0 -1
- package/_mjs/Ref/Atomic/api.mjs +0 -127
- package/_mjs/Ref/Atomic/api.mjs.map +0 -1
- package/_mjs/Ref/Derived.mjs +0 -35
- package/_mjs/Ref/Derived.mjs.map +0 -1
- package/_mjs/Ref/DerivedAll.mjs +0 -35
- package/_mjs/Ref/DerivedAll.mjs.map +0 -1
- package/_mjs/Ref/Synchronized/api.mjs +0 -154
- package/_mjs/Ref/Synchronized/api.mjs.map +0 -1
- package/_mjs/Ref/Synchronized/constructors.mjs +0 -15
- package/_mjs/Ref/Synchronized/constructors.mjs.map +0 -1
- package/_mjs/Ref/Synchronized/definition.mjs +0 -66
- package/_mjs/Ref/Synchronized/definition.mjs.map +0 -1
- package/_mjs/Ref/api/collect.mjs +0 -17
- package/_mjs/Ref/api/collect.mjs.map +0 -1
- package/_mjs/Ref/api/dimap.mjs +0 -84
- package/_mjs/Ref/api/dimap.mjs.map +0 -1
- package/_mjs/Ref/api/filter.mjs +0 -29
- package/_mjs/Ref/api/filter.mjs.map +0 -1
- package/_mjs/Ref/api/get.mjs +0 -13
- package/_mjs/Ref/api/get.mjs.map +0 -1
- package/_mjs/Ref/api/match.mjs +0 -18
- package/_mjs/Ref/api/match.mjs.map +0 -1
- package/_mjs/Ref/api/matchAll.mjs +0 -16
- package/_mjs/Ref/api/matchAll.mjs.map +0 -1
- package/_mjs/Ref/api/modify.mjs +0 -204
- package/_mjs/Ref/api/modify.mjs.map +0 -1
- package/_mjs/Ref/api/set.mjs +0 -14
- package/_mjs/Ref/api/set.mjs.map +0 -1
- package/_mjs/Ref/api.mjs +0 -34
- package/_mjs/Ref/api.mjs.map +0 -1
- package/_src/Hub/api.ts +0 -461
- package/_src/Queue/api/dimapIO.ts +0 -130
- package/_src/Queue/api/filterInputIO.ts +0 -75
- package/_src/Queue/api/filterOutputIO.ts +0 -76
- package/_src/Queue/api/operations.ts +0 -139
- package/_src/Queue/api/poll.ts +0 -14
- package/_src/Queue/api/takeBetween.ts +0 -45
- package/_src/Queue/api/zipWithIO.ts +0 -99
- package/_src/Queue/api.ts +0 -9
- package/_src/Ref/Atomic/Atomic.ts +0 -56
- package/_src/Ref/Atomic/api.ts +0 -124
- package/_src/Ref/Derived.ts +0 -71
- package/_src/Ref/DerivedAll.ts +0 -75
- package/_src/Ref/Synchronized/api.ts +0 -249
- package/_src/Ref/Synchronized/constructors.ts +0 -12
- package/_src/Ref/Synchronized/definition.ts +0 -126
- package/_src/Ref/api/collect.ts +0 -19
- package/_src/Ref/api/dimap.ts +0 -115
- package/_src/Ref/api/filter.ts +0 -35
- package/_src/Ref/api/get.ts +0 -17
- package/_src/Ref/api/match.ts +0 -24
- package/_src/Ref/api/matchAll.ts +0 -23
- package/_src/Ref/api/modify.ts +0 -237
- package/_src/Ref/api/set.ts +0 -19
- package/_src/Ref/api.ts +0 -39
package/_mjs/Stream/api.mjs
CHANGED
|
@@ -11,78 +11,73 @@ import * as tsplus_module_9 from "@fncts/io/IO/api/sequenceT";
|
|
|
11
11
|
import * as tsplus_module_10 from "@fncts/io/Channel/api";
|
|
12
12
|
import * as tsplus_module_11 from "@fncts/io/Channel/core-api";
|
|
13
13
|
import * as tsplus_module_12 from "@fncts/base/collection/immutable/Conc/api";
|
|
14
|
-
import * as tsplus_module_13 from "@fncts/io/
|
|
15
|
-
import * as tsplus_module_14 from "@fncts/io/
|
|
16
|
-
import * as tsplus_module_15 from "@fncts/
|
|
17
|
-
import * as tsplus_module_16 from "@fncts/
|
|
18
|
-
import * as tsplus_module_17 from "@fncts/
|
|
19
|
-
import * as tsplus_module_18 from "@fncts/
|
|
20
|
-
import * as tsplus_module_19 from "@fncts/
|
|
21
|
-
import * as tsplus_module_20 from "@fncts/
|
|
22
|
-
import * as tsplus_module_21 from "@fncts/io/
|
|
23
|
-
import * as tsplus_module_22 from "@fncts/
|
|
24
|
-
import * as tsplus_module_23 from "@fncts/io/
|
|
25
|
-
import * as tsplus_module_24 from "@fncts/io/IO/
|
|
26
|
-
import * as tsplus_module_25 from "@fncts/
|
|
27
|
-
import * as tsplus_module_26 from "@fncts/io/
|
|
28
|
-
import * as tsplus_module_27 from "@fncts/io/
|
|
29
|
-
import * as tsplus_module_28 from "@fncts/
|
|
30
|
-
import * as tsplus_module_29 from "@fncts/io/
|
|
31
|
-
import * as tsplus_module_30 from "@fncts/
|
|
32
|
-
import * as tsplus_module_31 from "@fncts/io/
|
|
33
|
-
import * as tsplus_module_32 from "@fncts/io/
|
|
34
|
-
import * as tsplus_module_33 from "@fncts/base/
|
|
35
|
-
import * as tsplus_module_34 from "@fncts/base/
|
|
36
|
-
import * as tsplus_module_35 from "@fncts/
|
|
37
|
-
import * as tsplus_module_36 from "@fncts/io/
|
|
38
|
-
import * as tsplus_module_37 from "@fncts/
|
|
39
|
-
import * as tsplus_module_38 from "@fncts/base/collection/
|
|
40
|
-
import * as tsplus_module_39 from "@fncts/
|
|
41
|
-
import * as tsplus_module_40 from "@fncts/io/
|
|
42
|
-
import * as tsplus_module_41 from "@fncts/io/
|
|
43
|
-
import * as tsplus_module_42 from "@fncts/
|
|
44
|
-
import * as tsplus_module_43 from "@fncts/
|
|
45
|
-
import * as tsplus_module_44 from "@fncts/io/
|
|
46
|
-
import * as tsplus_module_45 from "@fncts/io/
|
|
47
|
-
import * as tsplus_module_46 from "@fncts/io/
|
|
48
|
-
import * as tsplus_module_47 from "@fncts/base/data/
|
|
49
|
-
import * as tsplus_module_48 from "@fncts/io/
|
|
50
|
-
import * as tsplus_module_49 from "@fncts/io/
|
|
51
|
-
import * as tsplus_module_50 from "@fncts/io/
|
|
52
|
-
import * as tsplus_module_51 from "@fncts/
|
|
53
|
-
import * as tsplus_module_52 from "@fncts/io/
|
|
54
|
-
import * as tsplus_module_53 from "@fncts/io/
|
|
55
|
-
import * as tsplus_module_54 from "@fncts/io/
|
|
56
|
-
import * as tsplus_module_55 from "@fncts/io/
|
|
57
|
-
import * as tsplus_module_56 from "@fncts/io/Channel/api/
|
|
58
|
-
import * as tsplus_module_57 from "@fncts/
|
|
59
|
-
import * as tsplus_module_58 from "@fncts/io/Channel/api/
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
import * as tsplus_module_62 from "@fncts/base/data/exceptions";
|
|
64
|
-
import * as tsplus_module_63 from "@fncts/io/Channel/api/toPull";
|
|
65
|
-
export const aggregateAsyncWithin_ = aggregateAsyncWithin_1;
|
|
66
|
-
export const aggregateAsyncWithinEither_ = aggregateAsyncWithinEither_1;
|
|
67
|
-
export const apSecond_ = apSecond_1;
|
|
14
|
+
import * as tsplus_module_13 from "@fncts/io/Channel/api/runScoped";
|
|
15
|
+
import * as tsplus_module_14 from "@fncts/io/IO/api/forkScoped";
|
|
16
|
+
import * as tsplus_module_15 from "@fncts/base/data/Either/constructors";
|
|
17
|
+
import * as tsplus_module_16 from "@fncts/base/collection/immutable/Conc/constructors";
|
|
18
|
+
import * as tsplus_module_17 from "@fncts/base/data/Maybe/destructors";
|
|
19
|
+
import * as tsplus_module_18 from "@fncts/io/Stream/internal/SinkEndReason";
|
|
20
|
+
import * as tsplus_module_19 from "@fncts/io/Fiber/api/join";
|
|
21
|
+
import * as tsplus_module_20 from "@fncts/io/Fiber/api/interrupt";
|
|
22
|
+
import * as tsplus_module_21 from "@fncts/io/IO/api/core-scope";
|
|
23
|
+
import * as tsplus_module_22 from "@fncts/base/data/Cause/api";
|
|
24
|
+
import * as tsplus_module_23 from "@fncts/io/Stream/internal/Take";
|
|
25
|
+
import * as tsplus_module_24 from "@fncts/io/IO/runtime";
|
|
26
|
+
import * as tsplus_module_25 from "@fncts/io/Queue/constructors";
|
|
27
|
+
import * as tsplus_module_26 from "@fncts/io/IO/api/acquireRelease";
|
|
28
|
+
import * as tsplus_module_27 from "@fncts/io/IO/api/acquireReleaseExit";
|
|
29
|
+
import * as tsplus_module_28 from "@fncts/base/collection/immutable/Conc/api/replicate";
|
|
30
|
+
import * as tsplus_module_29 from "@fncts/io/Hub/constructors";
|
|
31
|
+
import * as tsplus_module_30 from "@fncts/base/data/Exit/api";
|
|
32
|
+
import * as tsplus_module_31 from "@fncts/io/Future/api";
|
|
33
|
+
import * as tsplus_module_32 from "@fncts/io/Future/constructors";
|
|
34
|
+
import * as tsplus_module_33 from "@fncts/base/data/Maybe/api";
|
|
35
|
+
import * as tsplus_module_34 from "@fncts/base/collection/Iterable/constructors";
|
|
36
|
+
import * as tsplus_module_35 from "@fncts/base/data/Exit/constructors";
|
|
37
|
+
import * as tsplus_module_36 from "@fncts/io/Stream/internal/DebounceState";
|
|
38
|
+
import * as tsplus_module_37 from "@fncts/io/Clock/api";
|
|
39
|
+
import * as tsplus_module_38 from "@fncts/base/collection/immutable/HashMap/api";
|
|
40
|
+
import * as tsplus_module_39 from "@fncts/io/TSemaphore/api";
|
|
41
|
+
import * as tsplus_module_40 from "@fncts/io/TSemaphore/constructors";
|
|
42
|
+
import * as tsplus_module_41 from "@fncts/io/STM/api";
|
|
43
|
+
import * as tsplus_module_42 from "@fncts/io/Sink/api";
|
|
44
|
+
import * as tsplus_module_43 from "@fncts/base/data/Predicate/api";
|
|
45
|
+
import * as tsplus_module_44 from "@fncts/io/Fiber/api/poll";
|
|
46
|
+
import * as tsplus_module_45 from "@fncts/io/IO/api/environment";
|
|
47
|
+
import * as tsplus_module_46 from "@fncts/io/collection/immutable/Conc/findIO";
|
|
48
|
+
import * as tsplus_module_47 from "@fncts/base/data/Exit/definition";
|
|
49
|
+
import * as tsplus_module_48 from "@fncts/io/Stream/internal/Pull";
|
|
50
|
+
import * as tsplus_module_49 from "@fncts/io/Channel/api/interruptWhen";
|
|
51
|
+
import * as tsplus_module_50 from "@fncts/io/Channel/api/mapOutIOC";
|
|
52
|
+
import * as tsplus_module_51 from "@fncts/io/Channel/api/mergeMap";
|
|
53
|
+
import * as tsplus_module_52 from "@fncts/io/Channel/internal/MergeDecision";
|
|
54
|
+
import * as tsplus_module_53 from "@fncts/io/Channel/api/mergeWith";
|
|
55
|
+
import * as tsplus_module_54 from "@fncts/io/Layer/MemoMap";
|
|
56
|
+
import * as tsplus_module_55 from "@fncts/io/Layer/api";
|
|
57
|
+
import * as tsplus_module_56 from "@fncts/io/Channel/api/runDrain";
|
|
58
|
+
import * as tsplus_module_57 from "@fncts/base/data/exceptions";
|
|
59
|
+
import * as tsplus_module_58 from "@fncts/io/Channel/api/toPull";
|
|
60
|
+
export const aggregateAsyncWithin = aggregateAsyncWithin_1;
|
|
61
|
+
export const aggregateAsyncWithinEither = aggregateAsyncWithinEither_1;
|
|
62
|
+
export const apSecond = apSecond_1;
|
|
68
63
|
export const asyncInterrupt = asyncInterrupt_1;
|
|
69
64
|
export const asyncMaybe = asyncMaybe_1;
|
|
70
|
-
export const
|
|
71
|
-
export const
|
|
72
|
-
export const
|
|
73
|
-
export const
|
|
74
|
-
export const
|
|
65
|
+
export const broadcastedQueues = broadcastedQueues_1;
|
|
66
|
+
export const broadcastedQueuesDynamic = broadcastedQueuesDynamic_1;
|
|
67
|
+
export const catchAll = catchAll_1;
|
|
68
|
+
export const catchAllCause = catchAllCause_1;
|
|
69
|
+
export const flatMap = flatMap_1;
|
|
75
70
|
export const chunks = chunks_1;
|
|
76
|
-
export const
|
|
77
|
-
export const
|
|
78
|
-
export const
|
|
79
|
-
export const
|
|
80
|
-
export const
|
|
81
|
-
export const
|
|
71
|
+
export const concat = concat_1;
|
|
72
|
+
export const crossWith = crossWith_1;
|
|
73
|
+
export const distributedWithDynamic = distributedWithDynamic_1;
|
|
74
|
+
export const drop = drop_1;
|
|
75
|
+
export const dropWhile = dropWhile_1;
|
|
76
|
+
export const ensuring = ensuring_1;
|
|
82
77
|
export const environment = environment_1;
|
|
83
78
|
export const failNow = failNow_1;
|
|
84
79
|
export const failCauseNow = failCauseNow_1;
|
|
85
|
-
export const
|
|
80
|
+
export const filterMap = filterMap_1;
|
|
86
81
|
export const flatten = flatten_1;
|
|
87
82
|
export const flattenExitOption = flattenExitOption_1;
|
|
88
83
|
export const flattenTake = flattenTake_1;
|
|
@@ -94,40 +89,40 @@ export const scoped = scoped_1;
|
|
|
94
89
|
export const fromIO = fromIO_1;
|
|
95
90
|
export const fromIOMaybe = fromIOMaybe_1;
|
|
96
91
|
export const fromPull = fromPull_1;
|
|
97
|
-
export const
|
|
92
|
+
export const fromQueue = fromQueue_1;
|
|
98
93
|
export const fromQueueWithShutdown = fromQueueWithShutdown_1;
|
|
99
94
|
export const halt = halt_1;
|
|
100
|
-
export const
|
|
101
|
-
export const
|
|
102
|
-
export const
|
|
103
|
-
export const
|
|
104
|
-
export const
|
|
105
|
-
export const
|
|
106
|
-
export const
|
|
107
|
-
export const
|
|
108
|
-
export const
|
|
109
|
-
export const
|
|
110
|
-
export const
|
|
111
|
-
export const
|
|
112
|
-
export const
|
|
113
|
-
export const
|
|
114
|
-
export const
|
|
95
|
+
export const interleaveWith = interleaveWith_1;
|
|
96
|
+
export const map = map_1;
|
|
97
|
+
export const mapAccum = mapAccum_1;
|
|
98
|
+
export const mapAccumIO = mapAccumIO_1;
|
|
99
|
+
export const mapChunks = mapChunks_1;
|
|
100
|
+
export const mapConcatChunk = mapConcatChunk_1;
|
|
101
|
+
export const mapError = mapError_1;
|
|
102
|
+
export const mapIO = mapIO_1;
|
|
103
|
+
export const mergeMap = mergeMap_1;
|
|
104
|
+
export const mergeEither = mergeEither_1;
|
|
105
|
+
export const mergeWith = mergeWith_1;
|
|
106
|
+
export const orElse = orElse_1;
|
|
107
|
+
export const pipeThrough = pipeThrough_1;
|
|
108
|
+
export const provideEnvironment = provideEnvironment_1;
|
|
109
|
+
export const provideLayer = provideLayer_1;
|
|
115
110
|
export const repeatIOMaybe = repeatIOMaybe_1;
|
|
116
111
|
export const repeatIOChunkMaybe = repeatIOChunkMaybe_1;
|
|
117
|
-
export const
|
|
118
|
-
export const
|
|
119
|
-
export const
|
|
120
|
-
export const
|
|
121
|
-
export const
|
|
122
|
-
export const
|
|
123
|
-
export const
|
|
124
|
-
export const
|
|
112
|
+
export const run = run_1;
|
|
113
|
+
export const runForeachScoped = runForeachScoped_1;
|
|
114
|
+
export const runIntoElementsScoped = runIntoElementsScoped_1;
|
|
115
|
+
export const runIntoQueueScoped = runIntoQueueScoped_1;
|
|
116
|
+
export const runIntoHubScoped = runIntoHubScoped_1;
|
|
117
|
+
export const runScoped = runScoped_1;
|
|
118
|
+
export const scanIO = scanIO_1;
|
|
119
|
+
export const scanReduceIO = scanReduceIO_1;
|
|
125
120
|
export const succeedNow = succeedNow_1;
|
|
126
|
-
export const
|
|
127
|
-
export const
|
|
121
|
+
export const throttleEnforceIO = throttleEnforceIO_1;
|
|
122
|
+
export const toHub = toHub_1;
|
|
128
123
|
export const toPull = toPull_1;
|
|
129
|
-
export const
|
|
130
|
-
export const
|
|
124
|
+
export const toQueue = toQueue_1;
|
|
125
|
+
export const toQueueOfElements = toQueueOfElements_1;
|
|
131
126
|
export const toQueueUnbounded = toQueueUnbounded_1;
|
|
132
127
|
export const unfoldChunkIO = unfoldChunkIO_1;
|
|
133
128
|
export const unfoldIO = unfoldIO_1;
|
|
@@ -145,7 +140,7 @@ import { ScheduleEnd, UpstreamEnd } from "./internal/SinkEndReason.mjs";
|
|
|
145
140
|
*/
|
|
146
141
|
|
|
147
142
|
export function absolve(self, __tsplusTrace) {
|
|
148
|
-
return mapIO_1(
|
|
143
|
+
return mapIO_1(either => tsplus_module_1.fromEither(() => either, __tsplusTrace), __tsplusTrace)(self);
|
|
149
144
|
}
|
|
150
145
|
/**
|
|
151
146
|
* Aggregates elements of this stream using the provided sink for as long
|
|
@@ -159,20 +154,24 @@ export function absolve(self, __tsplusTrace) {
|
|
|
159
154
|
* Any sink can be used here, but see `Sink.foldWeightedM` and `Sink.foldUntilM` for
|
|
160
155
|
* sinks that cover the common usecases.
|
|
161
156
|
*
|
|
162
|
-
* @tsplus
|
|
157
|
+
* @tsplus pipeable fncts.io.Stream aggregateAsync
|
|
163
158
|
*/
|
|
164
159
|
|
|
165
|
-
export function
|
|
166
|
-
return
|
|
160
|
+
export function aggregateAsync(sink, __tsplusTrace) {
|
|
161
|
+
return stream => {
|
|
162
|
+
return aggregateAsyncWithin_1(sink, tsplus_module_2.forever, __tsplusTrace)(stream);
|
|
163
|
+
};
|
|
167
164
|
}
|
|
168
165
|
/**
|
|
169
166
|
* Like `aggregateAsyncWithinEither`, but only returns the `Right` results.
|
|
170
167
|
*
|
|
171
|
-
* @tsplus
|
|
168
|
+
* @tsplus pipeable fncts.io.Stream aggregateAsyncWithin
|
|
172
169
|
*/
|
|
173
170
|
|
|
174
|
-
function aggregateAsyncWithin_1(
|
|
175
|
-
return
|
|
171
|
+
function aggregateAsyncWithin_1(sink, schedule, __tsplusTrace) {
|
|
172
|
+
return stream => {
|
|
173
|
+
return filterMap_1(cb => tsplus_module_4.match(() => tsplus_module_3.nothing(), tsplus_module_3.just)(cb), __tsplusTrace)(aggregateAsyncWithinEither_1(sink, schedule, __tsplusTrace)(stream));
|
|
174
|
+
};
|
|
176
175
|
}
|
|
177
176
|
/**
|
|
178
177
|
* Aggregates elements using the provided sink until it completes, or until the
|
|
@@ -186,108 +185,116 @@ function aggregateAsyncWithin_1(stream, sink, schedule, __tsplusTrace) {
|
|
|
186
185
|
* Aggregated elements will be fed into the schedule to determine the delays between
|
|
187
186
|
* pulls.
|
|
188
187
|
*
|
|
189
|
-
* @tsplus
|
|
190
|
-
*/
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
function aggregateAsyncWithinEither_1(
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
188
|
+
* @tsplus pipeable fncts.io.Stream aggregateAsyncWithinEither
|
|
189
|
+
*/
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
function aggregateAsyncWithinEither_1(sink, schedule, __tsplusTrace) {
|
|
193
|
+
return stream => {
|
|
194
|
+
const deps = tsplus_module_9.sequenceT(tsplus_module_5.make(), tsplus_module_6.make(() => new ScheduleEnd(), __tsplusTrace), tsplus_module_6.make(() => tsplus_module_7.empty(), __tsplusTrace), tsplus_module_8.driver(schedule, __tsplusTrace), tsplus_module_6.make(() => false, __tsplusTrace));
|
|
195
|
+
return flatMap_1(([handoff, sinkEndReason, sinkLeftovers, scheduleDriver, consumed]) => {
|
|
196
|
+
const handoffProducer = tsplus_module_10.readWithCause(_in => tsplus_module_11.apSecond(handoffProducer)(tsplus_module_10.fromIO(() => tsplus_module_5.offer(tsplus_module_5.emit(_in))(handoff))), cause => tsplus_module_10.fromIO(() => tsplus_module_5.offer(tsplus_module_5.halt(cause))(handoff)), _ => tsplus_module_10.fromIO(() => tsplus_module_5.offer(tsplus_module_5.end(new UpstreamEnd()))(handoff)));
|
|
197
|
+
const handoffConsumer = tsplus_module_10.unwrap(() => tsplus_module_1.flatMap(leftovers => {
|
|
198
|
+
if (tsplus_module_12.isNonEmpty(leftovers)) {
|
|
199
|
+
return tsplus_module_1.apSecond(tsplus_module_1.succeedNow(tsplus_module_11.apSecond(handoffConsumer)(tsplus_module_10.writeNow(leftovers)), __tsplusTrace), __tsplusTrace)(consumed.set(true, __tsplusTrace));
|
|
200
|
+
} else {
|
|
201
|
+
return tsplus_module_1.map(signal => tsplus_module_5.matchSignal({
|
|
202
|
+
Emit: ({
|
|
203
|
+
els
|
|
204
|
+
}) => tsplus_module_11.apSecond(handoffConsumer)(tsplus_module_11.apSecond(tsplus_module_10.writeNow(els))(tsplus_module_10.fromIO(() => consumed.set(true, __tsplusTrace)))),
|
|
205
|
+
Halt: ({
|
|
206
|
+
error
|
|
207
|
+
}) => tsplus_module_11.failCause(() => error),
|
|
208
|
+
End: ({
|
|
209
|
+
reason
|
|
210
|
+
}) => {
|
|
211
|
+
if (reason._tag === "ScheduleEnd"
|
|
212
|
+
/* SinkEndReasonTag.ScheduleEnd */
|
|
213
|
+
) {
|
|
214
|
+
return tsplus_module_10.unwrap(() => tsplus_module_1.map(p => p ? tsplus_module_10.fromIO(() => sinkEndReason.set(new ScheduleEnd(), __tsplusTrace)) : tsplus_module_11.apSecond(handoffConsumer)(tsplus_module_10.fromIO(() => sinkEndReason.set(new ScheduleEnd(), __tsplusTrace))), __tsplusTrace)(consumed.get));
|
|
215
|
+
} else {
|
|
216
|
+
return tsplus_module_10.fromIO(() => sinkEndReason.set(reason, __tsplusTrace));
|
|
217
|
+
}
|
|
217
218
|
}
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
}, __tsplusTrace));
|
|
222
|
-
|
|
223
|
-
function timeout(lastB, __tsplusTrace) {
|
|
224
|
-
return scheduleDriver.next(lastB, __tsplusTrace);
|
|
225
|
-
}
|
|
219
|
+
})(signal), __tsplusTrace)(tsplus_module_5.take(handoff));
|
|
220
|
+
}
|
|
221
|
+
}, __tsplusTrace)(sinkLeftovers.getAndSet(tsplus_module_7.empty(), __tsplusTrace)));
|
|
226
222
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
function handleSide(leftovers, b, c, __tsplusTrace) {
|
|
231
|
-
return tsplus_module_10.unwrap(() => tsplus_module_1.apSecond_(tsplus_module_13.set_(sinkLeftovers, tsplus_module_12.flatten(leftovers), __tsplusTrace), tsplus_module_1.map_(tsplus_module_14.get(sinkEndReason, __tsplusTrace), reason => tsplus_module_21.matchSinkEndReason_(reason, {
|
|
232
|
-
ScheduleEnd: () => tsplus_module_10.unwrapScoped(() => tsplus_module_1.flatMap_(tsplus_module_14.get(consumed, __tsplusTrace), consumed_ => tsplus_module_1.flatMap_(forkSink, sinkFiber => tsplus_module_1.map_(tsplus_module_17.forkScoped(timeout(tsplus_module_3.just(b), __tsplusTrace), __tsplusTrace), scheduleFiber => {
|
|
233
|
-
const toWrite = tsplus_module_20.match_(c, () => tsplus_module_19.make(tsplus_module_18.right(b)), c => tsplus_module_19.make(tsplus_module_18.right(b), tsplus_module_18.left(c)));
|
|
234
|
-
return consumed_ ? tsplus_module_11.apSecond_(tsplus_module_10.write(() => toWrite), scheduledAggregator(sinkFiber, scheduleFiber)) : scheduledAggregator(sinkFiber, scheduleFiber);
|
|
235
|
-
}, __tsplusTrace), __tsplusTrace), __tsplusTrace)),
|
|
236
|
-
UpstreamEnd: () => tsplus_module_10.unwrap(() => tsplus_module_1.map_(tsplus_module_14.get(consumed, __tsplusTrace), p => p ? tsplus_module_10.write(() => tsplus_module_19.make(tsplus_module_18.right(b))) : tsplus_module_10.unit, __tsplusTrace))
|
|
237
|
-
}), __tsplusTrace), __tsplusTrace));
|
|
223
|
+
function timeout(lastB, __tsplusTrace) {
|
|
224
|
+
return scheduleDriver.next(lastB, __tsplusTrace);
|
|
238
225
|
}
|
|
239
226
|
|
|
240
|
-
|
|
241
|
-
|
|
227
|
+
const scheduledAggregator = (sinkFiber, scheduleFiber) => {
|
|
228
|
+
const forkSink = tsplus_module_1.apSecond(tsplus_module_14.forkScoped(tsplus_module_13.runScoped(tsplus_module_10.doneCollect(tsplus_module_10.pipeToOrFail(sink.channel)(handoffConsumer))), __tsplusTrace), __tsplusTrace)(consumed.set(false, __tsplusTrace));
|
|
229
|
+
|
|
230
|
+
function handleSide(leftovers, b, c, __tsplusTrace) {
|
|
231
|
+
return tsplus_module_10.unwrap(() => tsplus_module_1.apSecond(tsplus_module_1.map(reason => tsplus_module_18.matchSinkEndReason({
|
|
232
|
+
ScheduleEnd: () => tsplus_module_10.unwrapScoped(() => tsplus_module_1.flatMap(consumed_ => tsplus_module_1.flatMap(sinkFiber => tsplus_module_1.map(scheduleFiber => {
|
|
233
|
+
const toWrite = tsplus_module_17.match(() => tsplus_module_16.make(tsplus_module_15.right(b)), c => tsplus_module_16.make(tsplus_module_15.right(b), tsplus_module_15.left(c)))(c);
|
|
234
|
+
return consumed_ ? tsplus_module_11.apSecond(scheduledAggregator(sinkFiber, scheduleFiber))(tsplus_module_10.write(() => toWrite)) : scheduledAggregator(sinkFiber, scheduleFiber);
|
|
235
|
+
}, __tsplusTrace)(tsplus_module_14.forkScoped(timeout(tsplus_module_3.just(b), __tsplusTrace), __tsplusTrace)), __tsplusTrace)(forkSink), __tsplusTrace)(consumed.get)),
|
|
236
|
+
UpstreamEnd: () => tsplus_module_10.unwrap(() => tsplus_module_1.map(p => p ? tsplus_module_10.write(() => tsplus_module_16.make(tsplus_module_15.right(b))) : tsplus_module_10.unit, __tsplusTrace)(consumed.get))
|
|
237
|
+
})(reason), __tsplusTrace)(sinkEndReason.get), __tsplusTrace)(sinkLeftovers.set(tsplus_module_12.flatten(leftovers), __tsplusTrace)));
|
|
238
|
+
}
|
|
242
239
|
|
|
243
|
-
|
|
244
|
-
|
|
240
|
+
return tsplus_module_10.unwrap(() => tsplus_module_21.raceWith(() => tsplus_module_19.join(scheduleFiber, __tsplusTrace), (sinkExit, scheduleFiber) => tsplus_module_1.apSecond(tsplus_module_1.map(([leftovers, b]) => handleSide(leftovers, b, tsplus_module_3.nothing(), __tsplusTrace), __tsplusTrace)(tsplus_module_1.fromExit(() => sinkExit, __tsplusTrace)), __tsplusTrace)(tsplus_module_20.interrupt(scheduleFiber, __tsplusTrace)), (scheduleExit, sinkFiber) => tsplus_module_1.matchCauseIO(cause => tsplus_module_4.match(() => tsplus_module_1.apSecond(tsplus_module_1.map(([leftovers, b]) => handleSide(leftovers, b, tsplus_module_3.nothing(), __tsplusTrace), __tsplusTrace)(tsplus_module_19.join(sinkFiber, __tsplusTrace)), __tsplusTrace)(tsplus_module_21.forkDaemon(tsplus_module_5.offer(tsplus_module_5.end(new ScheduleEnd()))(handoff), __tsplusTrace)), cause => tsplus_module_1.apSecond(tsplus_module_1.map(([leftovers, b]) => handleSide(leftovers, b, tsplus_module_3.nothing(), __tsplusTrace), __tsplusTrace)(tsplus_module_19.join(sinkFiber, __tsplusTrace)), __tsplusTrace)(tsplus_module_21.forkDaemon(tsplus_module_5.offer(tsplus_module_5.halt(cause))(handoff), __tsplusTrace)))(tsplus_module_22.failureOrCause(cause)), c => tsplus_module_1.apSecond(tsplus_module_1.map(([leftovers, b]) => handleSide(leftovers, b, tsplus_module_3.just(c), __tsplusTrace), __tsplusTrace)(tsplus_module_19.join(sinkFiber, __tsplusTrace)), __tsplusTrace)(tsplus_module_21.forkDaemon(tsplus_module_5.offer(tsplus_module_5.end(new ScheduleEnd()))(handoff), __tsplusTrace)), __tsplusTrace)(tsplus_module_1.fromExit(() => scheduleExit, __tsplusTrace)), __tsplusTrace)(tsplus_module_19.join(sinkFiber, __tsplusTrace)));
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
return unwrapScoped_1(tsplus_module_1.flatMap(() => tsplus_module_1.flatMap(sinkFiber => tsplus_module_1.map(scheduleFiber => new Stream(scheduledAggregator(sinkFiber, scheduleFiber)), __tsplusTrace)(tsplus_module_14.forkScoped(timeout(tsplus_module_3.nothing(), __tsplusTrace), __tsplusTrace)), __tsplusTrace)(tsplus_module_14.forkScoped(tsplus_module_13.runScoped(tsplus_module_10.doneCollect(tsplus_module_10.pipeToOrFail(sink.channel)(handoffConsumer))), __tsplusTrace)), __tsplusTrace)(tsplus_module_14.forkScoped(tsplus_module_13.runScoped(tsplus_module_10.pipeTo(handoffProducer)(stream.channel)), __tsplusTrace)), __tsplusTrace);
|
|
244
|
+
}, __tsplusTrace)(fromIO_1(deps, __tsplusTrace));
|
|
245
|
+
};
|
|
245
246
|
}
|
|
246
247
|
/**
|
|
247
248
|
* Composes this stream with the specified stream to create a cartesian product of elements,
|
|
248
249
|
* but keeps only elements from this stream.
|
|
249
250
|
* The `that` stream would be run multiple times, for every element in the `this` stream.
|
|
250
251
|
*
|
|
251
|
-
* @tsplus
|
|
252
|
+
* @tsplus pipeable fncts.io.Stream apFirst
|
|
252
253
|
*/
|
|
253
254
|
|
|
254
255
|
|
|
255
|
-
export function
|
|
256
|
-
return
|
|
256
|
+
export function apFirst(that, __tsplusTrace) {
|
|
257
|
+
return stream => {
|
|
258
|
+
return crossWith_1(that, (a, _) => a, __tsplusTrace)(stream);
|
|
259
|
+
};
|
|
257
260
|
}
|
|
258
261
|
/**
|
|
259
262
|
* Composes this stream with the specified stream to create a cartesian product of elements,
|
|
260
263
|
* but keeps only elements from the other stream.
|
|
261
264
|
* The `that` stream would be run multiple times, for every element in the `this` stream.
|
|
262
265
|
*
|
|
263
|
-
* @tsplus
|
|
266
|
+
* @tsplus pipeable fncts.io.Stream apSecond
|
|
264
267
|
*/
|
|
265
268
|
|
|
266
|
-
function apSecond_1(
|
|
267
|
-
return
|
|
269
|
+
function apSecond_1(that, __tsplusTrace) {
|
|
270
|
+
return stream => {
|
|
271
|
+
return crossWith_1(that, (_, b) => b, __tsplusTrace)(stream);
|
|
272
|
+
};
|
|
268
273
|
}
|
|
269
274
|
/**
|
|
270
275
|
* Maps the success values of this stream to the specified constant value.
|
|
271
276
|
*
|
|
272
|
-
* @tsplus
|
|
277
|
+
* @tsplus pipeable fncts.io.Stream as
|
|
273
278
|
*/
|
|
274
279
|
|
|
275
280
|
|
|
276
|
-
export function
|
|
277
|
-
return
|
|
281
|
+
export function as(b, __tsplusTrace) {
|
|
282
|
+
return stream => {
|
|
283
|
+
return map_1(() => b(), __tsplusTrace)(stream);
|
|
284
|
+
};
|
|
278
285
|
}
|
|
279
286
|
/**
|
|
280
287
|
* @tsplus static fncts.io.StreamOps asyncInterrupt
|
|
281
288
|
*/
|
|
282
289
|
|
|
283
290
|
function asyncInterrupt_1(register, outputBuffer = 16, __tsplusTrace) {
|
|
284
|
-
return unwrapScoped_1(tsplus_module_1.
|
|
285
|
-
const
|
|
291
|
+
return unwrapScoped_1(tsplus_module_1.flatMap(output => tsplus_module_1.flatMap(runtime => tsplus_module_1.map(eitherStream => tsplus_module_4.match(canceler => {
|
|
292
|
+
const loop = tsplus_module_10.unwrap(() => tsplus_module_1.match(maybeError => tsplus_module_17.match(() => tsplus_module_11.endNow(undefined), tsplus_module_10.failNow)(maybeError), as => tsplus_module_11.apSecond(loop)(tsplus_module_10.writeNow(as)), __tsplusTrace)(tsplus_module_1.flatMap(take => tsplus_module_23.done(take), __tsplusTrace)(output.take)));
|
|
293
|
+
return ensuring_1(canceler, __tsplusTrace)(new Stream(loop));
|
|
294
|
+
}, stream => unwrap_1(tsplus_module_1.as(() => stream, __tsplusTrace)(output.shutdown), __tsplusTrace))(eitherStream), __tsplusTrace)(tsplus_module_1.succeed(() => register((k, cb) => {
|
|
295
|
+
const effect = tsplus_module_1.flatMap(a => output.offer(a, __tsplusTrace), __tsplusTrace)(tsplus_module_23.fromPull(k));
|
|
286
296
|
return runtime.unsafeRunAsyncWith(effect, cb || constVoid, __tsplusTrace);
|
|
287
|
-
}), __tsplusTrace),
|
|
288
|
-
const loop = tsplus_module_10.unwrap(() => tsplus_module_1.match_(tsplus_module_1.flatMap_(tsplus_module_27.take(output, __tsplusTrace), take => tsplus_module_26.done(take), __tsplusTrace), maybeError => tsplus_module_20.match_(maybeError, () => tsplus_module_11.endNow(undefined), tsplus_module_10.failNow), as => tsplus_module_11.apSecond_(tsplus_module_10.writeNow(as), loop), __tsplusTrace));
|
|
289
|
-
return ensuring_1(new Stream(loop), canceler, __tsplusTrace);
|
|
290
|
-
}, stream => unwrap_1(tsplus_module_1.as_(tsplus_module_27.shutdown(output, __tsplusTrace), () => stream, __tsplusTrace), __tsplusTrace)), __tsplusTrace), __tsplusTrace), __tsplusTrace), __tsplusTrace);
|
|
297
|
+
}), __tsplusTrace)), __tsplusTrace)(tsplus_module_24.runtime(__tsplusTrace)), __tsplusTrace)(tsplus_module_26.acquireRelease(() => tsplus_module_25.makeBounded(outputBuffer, __tsplusTrace), queue => queue.shutdown, __tsplusTrace)), __tsplusTrace);
|
|
291
298
|
}
|
|
292
299
|
/**
|
|
293
300
|
* Creates a stream from an asynchronous callback that can be called multiple times.
|
|
@@ -300,7 +307,7 @@ function asyncInterrupt_1(register, outputBuffer = 16, __tsplusTrace) {
|
|
|
300
307
|
|
|
301
308
|
|
|
302
309
|
function asyncMaybe_1(register, outputBuffer = 16, __tsplusTrace) {
|
|
303
|
-
return asyncInterrupt_1(k =>
|
|
310
|
+
return asyncInterrupt_1(k => tsplus_module_17.match(() => tsplus_module_15.left(tsplus_module_1.unit), tsplus_module_15.right)(register(k)), outputBuffer, __tsplusTrace);
|
|
304
311
|
}
|
|
305
312
|
/**
|
|
306
313
|
* @tsplus static fncts.io.StreamOps async
|
|
@@ -318,18 +325,20 @@ export function async(register, outputBuffer = 16, __tsplusTrace) {
|
|
|
318
325
|
*/
|
|
319
326
|
|
|
320
327
|
export function asyncIO(register, outputBuffer = 16, __tsplusTrace) {
|
|
321
|
-
return new Stream(tsplus_module_10.unwrapScoped(() => tsplus_module_1.
|
|
322
|
-
const loop = tsplus_module_10.unwrap(() => tsplus_module_1.
|
|
328
|
+
return new Stream(tsplus_module_10.unwrapScoped(() => tsplus_module_1.flatMap(output => tsplus_module_1.flatMap(runtime => tsplus_module_1.map(() => {
|
|
329
|
+
const loop = tsplus_module_10.unwrap(() => tsplus_module_1.matchCauseIO(cause => tsplus_module_1.as(() => tsplus_module_4.match(maybeError => tsplus_module_17.match(() => tsplus_module_11.endNow(undefined), tsplus_module_10.failNow)(maybeError), tsplus_module_11.failCauseNow)(tsplus_module_22.failureOrCause(cause)), __tsplusTrace)(output.shutdown), as => tsplus_module_1.succeed(() => tsplus_module_11.apSecond(loop)(tsplus_module_10.writeNow(as)), __tsplusTrace), __tsplusTrace)(tsplus_module_1.flatMap(take => tsplus_module_23.done(take), __tsplusTrace)(output.take)));
|
|
323
330
|
return loop;
|
|
324
|
-
}, __tsplusTrace), __tsplusTrace), __tsplusTrace)));
|
|
331
|
+
}, __tsplusTrace)(register((k, cb) => runtime.unsafeRunAsyncWith(tsplus_module_1.flatMap(a => output.offer(a, __tsplusTrace), __tsplusTrace)(tsplus_module_23.fromPull(k)), cb || constVoid, __tsplusTrace))), __tsplusTrace)(tsplus_module_24.runtime(__tsplusTrace)), __tsplusTrace)(tsplus_module_26.acquireRelease(() => tsplus_module_25.makeBounded(outputBuffer, __tsplusTrace), _ => _.shutdown, __tsplusTrace))));
|
|
325
332
|
}
|
|
326
333
|
/**
|
|
327
334
|
* Returns a stream whose failure and success channels have been mapped by
|
|
328
335
|
* the specified pair of functions, `f` and `g`.
|
|
336
|
+
*
|
|
337
|
+
* @tsplus pipeable fncts.io.Stream bimap
|
|
329
338
|
*/
|
|
330
339
|
|
|
331
|
-
export function
|
|
332
|
-
return map_1(
|
|
340
|
+
export function bimap(f, g, __tsplusTrace) {
|
|
341
|
+
return stream => map_1(g, __tsplusTrace)(mapError_1(f, __tsplusTrace)(stream));
|
|
333
342
|
}
|
|
334
343
|
/**
|
|
335
344
|
* Creates a stream from a single value that will get cleaned up after the
|
|
@@ -338,8 +347,8 @@ export function bimap_(stream, f, g, __tsplusTrace) {
|
|
|
338
347
|
* @tsplus static fncts.io.StreamOps acquireRelease
|
|
339
348
|
*/
|
|
340
349
|
|
|
341
|
-
export function
|
|
342
|
-
return scoped_1(
|
|
350
|
+
export function acquireRelease(acquire, release, __tsplusTrace) {
|
|
351
|
+
return scoped_1(() => tsplus_module_26.acquireRelease(() => acquire, release, __tsplusTrace), __tsplusTrace);
|
|
343
352
|
}
|
|
344
353
|
/**
|
|
345
354
|
* Creates a stream from a single value that will get cleaned up after the
|
|
@@ -348,30 +357,34 @@ export function acquireRelease_(acquire, release, __tsplusTrace) {
|
|
|
348
357
|
* @tsplus static fncts.io.StreamOps acquireReleaseExit
|
|
349
358
|
*/
|
|
350
359
|
|
|
351
|
-
export function
|
|
352
|
-
return scoped_1(
|
|
360
|
+
export function acquireReleaseExit(acquire, release, __tsplusTrace) {
|
|
361
|
+
return scoped_1(() => tsplus_module_27.acquireReleaseExit(() => acquire, release, __tsplusTrace), __tsplusTrace);
|
|
353
362
|
}
|
|
354
363
|
/**
|
|
355
364
|
* Fan out the stream, producing a list of streams that have the same elements as this stream.
|
|
356
365
|
* The driver stream will only ever advance of the `maximumLag` chunks before the
|
|
357
366
|
* slowest downstream stream.
|
|
358
367
|
*
|
|
359
|
-
* @tsplus
|
|
368
|
+
* @tsplus pipeable fncts.io.Stream broadcast
|
|
360
369
|
*/
|
|
361
370
|
|
|
362
|
-
export function
|
|
363
|
-
return
|
|
371
|
+
export function broadcast(n, maximumLag, __tsplusTrace) {
|
|
372
|
+
return stream => {
|
|
373
|
+
return tsplus_module_1.map(c => tsplus_module_12.map(hub => flattenTake_1(fromQueueWithShutdown_1(hub), __tsplusTrace))(c), __tsplusTrace)(broadcastedQueues_1(n, maximumLag, __tsplusTrace)(stream));
|
|
374
|
+
};
|
|
364
375
|
}
|
|
365
376
|
/**
|
|
366
377
|
* Fan out the stream, producing a dynamic number of streams that have the same elements as this stream.
|
|
367
378
|
* The driver stream will only ever advance of the `maximumLag` chunks before the
|
|
368
379
|
* slowest downstream stream.
|
|
369
380
|
*
|
|
370
|
-
* @tsplus
|
|
381
|
+
* @tsplus pipeable fncts.io.Stream broadcastDynamic
|
|
371
382
|
*/
|
|
372
383
|
|
|
373
|
-
export function
|
|
374
|
-
return
|
|
384
|
+
export function broadcastDynamic(maximumLag, __tsplusTrace) {
|
|
385
|
+
return stream => {
|
|
386
|
+
return tsplus_module_1.map(scoped => flattenTake_1(flatMap_1(fromQueue_1, __tsplusTrace)(scoped_1(() => scoped, __tsplusTrace)), __tsplusTrace), __tsplusTrace)(broadcastedQueuesDynamic_1(maximumLag, __tsplusTrace)(stream));
|
|
387
|
+
};
|
|
375
388
|
}
|
|
376
389
|
/**
|
|
377
390
|
* Converts the stream to a managed list of queues. Every value will be replicated to every queue with the
|
|
@@ -379,11 +392,13 @@ export function broadcastDynamic_(stream, maximumLag, __tsplusTrace) {
|
|
|
379
392
|
*
|
|
380
393
|
* Queues can unsubscribe from upstream by shutting down.
|
|
381
394
|
*
|
|
382
|
-
* @tsplus
|
|
395
|
+
* @tsplus pipeable fncts.io.Stream broadcastedQueues
|
|
383
396
|
*/
|
|
384
397
|
|
|
385
|
-
function broadcastedQueues_1(
|
|
386
|
-
return
|
|
398
|
+
function broadcastedQueues_1(n, maximumLag, __tsplusTrace) {
|
|
399
|
+
return stream => {
|
|
400
|
+
return tsplus_module_1.flatMap(hub => tsplus_module_1.flatMap(queues => tsplus_module_1.map(() => queues, __tsplusTrace)(tsplus_module_1.fork(runIntoHubScoped_1(hub, __tsplusTrace)(stream), __tsplusTrace)), __tsplusTrace)(tsplus_module_1.sequenceIterable(tsplus_module_28.replicate(n, hub.subscribe), __tsplusTrace)), __tsplusTrace)(tsplus_module_29.makeBounded(maximumLag, __tsplusTrace));
|
|
401
|
+
};
|
|
387
402
|
}
|
|
388
403
|
/**
|
|
389
404
|
* Converts the stream to a managed dynamic amount of queues. Every chunk will be replicated to every queue with the
|
|
@@ -391,38 +406,44 @@ function broadcastedQueues_1(stream, n, maximumLag, __tsplusTrace) {
|
|
|
391
406
|
*
|
|
392
407
|
* Queues can unsubscribe from upstream by shutting down.
|
|
393
408
|
*
|
|
394
|
-
* @tsplus
|
|
409
|
+
* @tsplus pipeable fncts.io.Stream broadcastedQueuesDynamic
|
|
395
410
|
*/
|
|
396
411
|
|
|
397
412
|
|
|
398
|
-
function broadcastedQueuesDynamic_1(
|
|
399
|
-
return
|
|
413
|
+
function broadcastedQueuesDynamic_1(maximumLag, __tsplusTrace) {
|
|
414
|
+
return stream => {
|
|
415
|
+
return tsplus_module_1.map(hub => hub.subscribe, __tsplusTrace)(toHub_1(maximumLag, __tsplusTrace)(stream));
|
|
416
|
+
};
|
|
400
417
|
}
|
|
401
418
|
/**
|
|
402
419
|
* Allows a faster producer to progress independently of a slower consumer by buffering
|
|
403
420
|
* up to `capacity` elements in a queue.
|
|
404
421
|
*
|
|
405
|
-
* @tsplus
|
|
422
|
+
* @tsplus pipeable fncts.io.Stream buffer
|
|
406
423
|
*/
|
|
407
424
|
|
|
408
425
|
|
|
409
|
-
export function
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
426
|
+
export function buffer(capacity, __tsplusTrace) {
|
|
427
|
+
return stream => {
|
|
428
|
+
const queue = toQueueOfElements_1(capacity, __tsplusTrace)(stream);
|
|
429
|
+
return new Stream(tsplus_module_10.unwrapScoped(() => tsplus_module_1.map(queue => {
|
|
430
|
+
const process = tsplus_module_11.flatMap(exit => tsplus_module_30.match(cause => tsplus_module_17.match(() => tsplus_module_11.endNow(undefined), tsplus_module_11.failCauseNow)(tsplus_module_22.flipCauseOption(cause)), value => tsplus_module_11.apSecond(process)(tsplus_module_10.writeNow(tsplus_module_16.single(value))))(exit))(tsplus_module_10.fromIO(() => queue.take));
|
|
431
|
+
return process;
|
|
432
|
+
}, __tsplusTrace)(queue)));
|
|
433
|
+
};
|
|
415
434
|
}
|
|
416
435
|
/**
|
|
417
|
-
* @tsplus
|
|
436
|
+
* @tsplus pipeable fncts.io.Stream bufferChunks
|
|
418
437
|
*/
|
|
419
438
|
|
|
420
|
-
export function
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
439
|
+
export function bufferChunks(capacity, __tsplusTrace) {
|
|
440
|
+
return stream => {
|
|
441
|
+
const queue = toQueue_1(capacity, __tsplusTrace)(stream);
|
|
442
|
+
return new Stream(tsplus_module_10.unwrapScoped(() => tsplus_module_1.map(queue => {
|
|
443
|
+
const process = tsplus_module_11.flatMap(take => tsplus_module_23.match(tsplus_module_11.endNow(undefined), tsplus_module_11.failCauseNow, value => tsplus_module_11.apSecond(process)(tsplus_module_10.writeNow(value)))(take))(tsplus_module_10.fromIO(() => queue.take));
|
|
444
|
+
return process;
|
|
445
|
+
}, __tsplusTrace)(queue)));
|
|
446
|
+
};
|
|
426
447
|
}
|
|
427
448
|
/**
|
|
428
449
|
* Allows a faster producer to progress independently of a slower consumer by buffering
|
|
@@ -433,77 +454,87 @@ export function bufferChunks_(stream, capacity, __tsplusTrace) {
|
|
|
433
454
|
|
|
434
455
|
export function bufferUnbounded(stream, __tsplusTrace) {
|
|
435
456
|
const queue = toQueueUnbounded_1(stream, __tsplusTrace);
|
|
436
|
-
return new Stream(tsplus_module_10.unwrapScoped(() => tsplus_module_1.
|
|
437
|
-
const process = tsplus_module_11.
|
|
457
|
+
return new Stream(tsplus_module_10.unwrapScoped(() => tsplus_module_1.map(queue => {
|
|
458
|
+
const process = tsplus_module_11.flatMap(take => tsplus_module_23.match(tsplus_module_11.endNow(undefined), tsplus_module_11.failCauseNow, value => tsplus_module_11.apSecond(process)(tsplus_module_10.writeNow(value)))(take))(tsplus_module_10.fromIO(() => queue.take));
|
|
438
459
|
return process;
|
|
439
|
-
}, __tsplusTrace)));
|
|
460
|
+
}, __tsplusTrace)(queue)));
|
|
440
461
|
}
|
|
441
462
|
|
|
442
463
|
function bufferSignalProducer(queue, ref, __tsplusTrace) {
|
|
443
|
-
const terminate = take => tsplus_module_10.fromIO(() => tsplus_module_1.
|
|
464
|
+
const terminate = take => tsplus_module_10.fromIO(() => tsplus_module_1.flatMap(latch => tsplus_module_1.flatMap(() => tsplus_module_1.flatMap(p => tsplus_module_1.flatMap(() => tsplus_module_1.flatMap(() => tsplus_module_1.map(() => void 0, __tsplusTrace)(tsplus_module_31.wait(p, __tsplusTrace)), __tsplusTrace)(ref.set(p, __tsplusTrace)), __tsplusTrace)(queue.offer(tuple(take, p), __tsplusTrace)), __tsplusTrace)(tsplus_module_32.make(__tsplusTrace)), __tsplusTrace)(tsplus_module_31.wait(latch, __tsplusTrace)), __tsplusTrace)(ref.get));
|
|
444
465
|
|
|
445
|
-
return tsplus_module_10.readWith(inp => tsplus_module_11.
|
|
466
|
+
return tsplus_module_10.readWith(inp => tsplus_module_11.apSecond(bufferSignalProducer(queue, ref, __tsplusTrace))(tsplus_module_10.fromIO(() => tsplus_module_1.flatMap(p => tsplus_module_1.flatMap(added => tsplus_module_1.map(() => void 0, __tsplusTrace)(tsplus_module_1.when(() => added, __tsplusTrace)(ref.set(p, __tsplusTrace))), __tsplusTrace)(queue.offer(tuple(tsplus_module_23.chunk(inp), p), __tsplusTrace)), __tsplusTrace)(tsplus_module_32.make(__tsplusTrace)))), e => terminate(tsplus_module_23.fail(e)), () => terminate(tsplus_module_23.end));
|
|
446
467
|
}
|
|
447
468
|
|
|
448
469
|
function bufferSignalConsumer(queue, __tsplusTrace) {
|
|
449
|
-
const process = tsplus_module_11.
|
|
470
|
+
const process = tsplus_module_11.flatMap(([take, promise]) => tsplus_module_11.apSecond(tsplus_module_23.match(tsplus_module_11.endNow(undefined), tsplus_module_11.failCauseNow, value => tsplus_module_11.apSecond(process)(tsplus_module_10.writeNow(value)))(take))(tsplus_module_10.fromIO(() => tsplus_module_31.succeed_(undefined, __tsplusTrace)(promise))))(tsplus_module_10.fromIO(() => queue.take));
|
|
450
471
|
return process;
|
|
451
472
|
}
|
|
452
473
|
/**
|
|
453
474
|
* Switches over to the stream produced by the provided function in case this one
|
|
454
475
|
* fails with a typed error.
|
|
455
476
|
*
|
|
456
|
-
* @tsplus
|
|
477
|
+
* @tsplus pipeable fncts.io.Stream catchAll
|
|
457
478
|
*/
|
|
458
479
|
|
|
459
480
|
|
|
460
|
-
function catchAll_1(
|
|
461
|
-
return
|
|
481
|
+
function catchAll_1(f, __tsplusTrace) {
|
|
482
|
+
return stream => {
|
|
483
|
+
return catchAllCause_1(cause => tsplus_module_4.match(f, failCauseNow_1)(tsplus_module_22.failureOrCause(cause)), __tsplusTrace)(stream);
|
|
484
|
+
};
|
|
462
485
|
}
|
|
463
486
|
/**
|
|
464
487
|
* Switches over to the stream produced by the provided function in case this one
|
|
465
488
|
* fails. Allows recovery from all causes of failure, including interruption if the
|
|
466
489
|
* stream is uninterruptible.
|
|
467
490
|
*
|
|
468
|
-
* @tsplus
|
|
491
|
+
* @tsplus pipeable fncts.io.Stream catchAllCause
|
|
469
492
|
*/
|
|
470
493
|
|
|
471
494
|
|
|
472
|
-
function catchAllCause_1(
|
|
473
|
-
|
|
474
|
-
|
|
495
|
+
function catchAllCause_1(f, __tsplusTrace) {
|
|
496
|
+
return stream => {
|
|
497
|
+
const channel = tsplus_module_10.catchAllCause(cause => f(cause).channel)(stream.channel);
|
|
498
|
+
return new Stream(channel);
|
|
499
|
+
};
|
|
475
500
|
}
|
|
476
501
|
/**
|
|
477
502
|
* Switches over to the stream produced by the provided function in case this one
|
|
478
503
|
* fails with some typed error.
|
|
479
504
|
*
|
|
480
|
-
* @tsplus
|
|
505
|
+
* @tsplus pipeable fncts.io.Stream catchJust
|
|
481
506
|
*/
|
|
482
507
|
|
|
483
508
|
|
|
484
|
-
export function
|
|
485
|
-
return
|
|
509
|
+
export function catchJust(pf, __tsplusTrace) {
|
|
510
|
+
return stream => {
|
|
511
|
+
return catchAll_1(e => tsplus_module_33.getOrElse(() => failNow_1(e, __tsplusTrace))(pf(e)), __tsplusTrace)(stream);
|
|
512
|
+
};
|
|
486
513
|
}
|
|
487
514
|
/**
|
|
488
515
|
* Switches over to the stream produced by the provided function in case this one
|
|
489
516
|
* fails with some errors. Allows recovery from all causes of failure, including interruption if the
|
|
490
517
|
* stream is uninterruptible.
|
|
491
518
|
*
|
|
492
|
-
* @tsplus
|
|
519
|
+
* @tsplus pipeable fncts.io.Stream catchJustCause
|
|
493
520
|
*/
|
|
494
521
|
|
|
495
|
-
export function
|
|
496
|
-
return
|
|
522
|
+
export function catchJustCause(pf, __tsplusTrace) {
|
|
523
|
+
return stream => {
|
|
524
|
+
return catchAllCause_1(cause => tsplus_module_33.getOrElse(() => failCauseNow_1(cause, __tsplusTrace))(pf(cause)), __tsplusTrace)(stream);
|
|
525
|
+
};
|
|
497
526
|
}
|
|
498
527
|
/**
|
|
499
528
|
* Returns a stream made of the concatenation in strict order of all the streams
|
|
500
529
|
* produced by passing each element of this stream to `f`
|
|
501
530
|
*
|
|
502
|
-
* @tsplus
|
|
531
|
+
* @tsplus pipeable fncts.io.Stream flatMap
|
|
503
532
|
*/
|
|
504
533
|
|
|
505
|
-
function flatMap_1(
|
|
506
|
-
return
|
|
534
|
+
function flatMap_1(f, __tsplusTrace) {
|
|
535
|
+
return stream => {
|
|
536
|
+
return new Stream(tsplus_module_10.concatMap(as => tsplus_module_12.foldLeft(tsplus_module_10.unit, (s, a) => tsplus_module_11.flatMap(() => a)(s))(tsplus_module_12.map(a => f(a).channel)(as)))(stream.channel));
|
|
537
|
+
};
|
|
507
538
|
}
|
|
508
539
|
/**
|
|
509
540
|
* Exposes the underlying chunks of the stream as a stream of chunks of elements
|
|
@@ -513,24 +544,26 @@ function flatMap_1(stream, f, __tsplusTrace) {
|
|
|
513
544
|
|
|
514
545
|
|
|
515
546
|
function chunks_1(stream, __tsplusTrace) {
|
|
516
|
-
return mapChunks_1(
|
|
547
|
+
return mapChunks_1(tsplus_module_16.single, __tsplusTrace)(stream);
|
|
517
548
|
}
|
|
518
549
|
/**
|
|
519
550
|
* Performs the specified stream transformation with the chunk structure of
|
|
520
551
|
* the stream exposed.
|
|
521
552
|
*
|
|
522
|
-
* @tsplus
|
|
553
|
+
* @tsplus pipeable fncts.io.Stream chunksWith
|
|
523
554
|
*/
|
|
524
555
|
|
|
525
556
|
|
|
526
|
-
export function chunksWith(
|
|
527
|
-
return
|
|
557
|
+
export function chunksWith(f, __tsplusTrace) {
|
|
558
|
+
return self => {
|
|
559
|
+
return flattenChunks_1(f(chunks_1(self, __tsplusTrace)), __tsplusTrace);
|
|
560
|
+
};
|
|
528
561
|
}
|
|
529
562
|
|
|
530
563
|
function changesWithWriter(f, last, __tsplusTrace) {
|
|
531
564
|
return tsplus_module_10.readWithCause(chunk => {
|
|
532
|
-
const [newLast, newChunk] = tsplus_module_12.
|
|
533
|
-
return tsplus_module_11.
|
|
565
|
+
const [newLast, newChunk] = tsplus_module_12.foldLeft([last, tsplus_module_7.empty()], ([maybeLast, os], o1) => tsplus_module_17.match(() => [tsplus_module_3.just(o1), tsplus_module_12.append(o1)(os)], o => f(o, o1) ? [tsplus_module_3.just(o1), os] : [tsplus_module_3.just(o1), tsplus_module_12.append(o1)(os)])(maybeLast))(chunk);
|
|
566
|
+
return tsplus_module_11.apSecond(changesWithWriter(f, newLast, __tsplusTrace))(tsplus_module_10.writeNow(newChunk));
|
|
534
567
|
}, tsplus_module_11.failCauseNow, () => tsplus_module_10.unit);
|
|
535
568
|
}
|
|
536
569
|
/**
|
|
@@ -538,37 +571,41 @@ function changesWithWriter(f, last, __tsplusTrace) {
|
|
|
538
571
|
* previous element emitted, using the specified function to determine
|
|
539
572
|
* whether two elements are equal.
|
|
540
573
|
*
|
|
541
|
-
* @tsplus
|
|
574
|
+
* @tsplus pipeable fncts.io.Stream changesWith
|
|
542
575
|
*/
|
|
543
576
|
|
|
544
577
|
|
|
545
|
-
export function
|
|
546
|
-
return
|
|
578
|
+
export function changesWith(f, __tsplusTrace) {
|
|
579
|
+
return stream => {
|
|
580
|
+
return new Stream(tsplus_module_10.pipeTo(changesWithWriter(f, tsplus_module_3.nothing(), __tsplusTrace))(stream.channel));
|
|
581
|
+
};
|
|
547
582
|
}
|
|
548
583
|
/**
|
|
549
584
|
* Transforms all elements of the stream for as long as the specified partial function is defined.
|
|
550
585
|
*
|
|
551
|
-
* @tsplus
|
|
586
|
+
* @tsplus pipeable fncts.io.Stream collectWhile
|
|
552
587
|
*/
|
|
553
588
|
|
|
554
|
-
export function
|
|
555
|
-
|
|
556
|
-
const
|
|
589
|
+
export function collectWhile(pf, __tsplusTrace) {
|
|
590
|
+
return stream => {
|
|
591
|
+
const loop = tsplus_module_10.readWith(inp => {
|
|
592
|
+
const mapped = tsplus_module_12.collectWhile(pf)(inp);
|
|
557
593
|
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
594
|
+
if (mapped.length === inp.length) {
|
|
595
|
+
return tsplus_module_11.apSecond(loop)(tsplus_module_10.writeNow(mapped));
|
|
596
|
+
} else {
|
|
597
|
+
return tsplus_module_10.writeNow(mapped);
|
|
598
|
+
}
|
|
599
|
+
}, tsplus_module_10.failNow, tsplus_module_11.succeedNow);
|
|
600
|
+
return new Stream(tsplus_module_10.pipeTo(loop)(stream.channel));
|
|
601
|
+
};
|
|
565
602
|
}
|
|
566
603
|
/**
|
|
567
604
|
* Effectfully transforms all elements of the stream for as long as the specified partial function is defined.
|
|
568
605
|
*/
|
|
569
606
|
|
|
570
|
-
export function
|
|
571
|
-
return new Stream(tsplus_module_10.
|
|
607
|
+
export function collectWhileIO(stream, pf, __tsplusTrace) {
|
|
608
|
+
return new Stream(tsplus_module_10.pipeTo(collectWhileIOLoop(tsplus_module_34.empty()[Symbol.iterator](), pf, __tsplusTrace))(stream.channel));
|
|
572
609
|
}
|
|
573
610
|
|
|
574
611
|
function collectWhileIOLoop(iterator, pf, __tsplusTrace) {
|
|
@@ -577,12 +614,12 @@ function collectWhileIOLoop(iterator, pf, __tsplusTrace) {
|
|
|
577
614
|
if (next.done) {
|
|
578
615
|
return tsplus_module_10.readWithCause(elem => collectWhileIOLoop(elem[Symbol.iterator](), pf, __tsplusTrace), tsplus_module_11.failCauseNow, tsplus_module_11.succeedNow);
|
|
579
616
|
} else {
|
|
580
|
-
return tsplus_module_10.unwrap(() =>
|
|
617
|
+
return tsplus_module_10.unwrap(() => tsplus_module_17.match(() => tsplus_module_1.succeedNow(tsplus_module_10.unit, __tsplusTrace), b => tsplus_module_1.map(b => tsplus_module_11.apSecond(collectWhileIOLoop(iterator, pf, __tsplusTrace))(tsplus_module_10.writeNow(tsplus_module_16.single(b))), __tsplusTrace)(b))(pf(next.value)));
|
|
581
618
|
}
|
|
582
619
|
}
|
|
583
620
|
|
|
584
621
|
function combineProducer(handoff, latch, __tsplusTrace) {
|
|
585
|
-
return tsplus_module_11.
|
|
622
|
+
return tsplus_module_11.apSecond(tsplus_module_10.readWithCause(value => tsplus_module_11.apSecond(combineProducer(handoff, latch, __tsplusTrace))(tsplus_module_10.fromIO(() => tsplus_module_5.offer(tsplus_module_35.succeed(value))(handoff))), cause => tsplus_module_10.fromIO(() => tsplus_module_5.offer(tsplus_module_35.failCause(tsplus_module_22.map(tsplus_module_3.just)(cause)))(handoff)), () => tsplus_module_11.apSecond(combineProducer(handoff, latch, __tsplusTrace))(tsplus_module_10.fromIO(() => tsplus_module_5.offer(tsplus_module_35.fail(tsplus_module_3.nothing()))(handoff)))))(tsplus_module_10.fromIO(() => tsplus_module_5.take(latch)));
|
|
586
623
|
}
|
|
587
624
|
/**
|
|
588
625
|
* Combines the elements from this stream and the specified stream by repeatedly applying the
|
|
@@ -592,20 +629,22 @@ function combineProducer(handoff, latch, __tsplusTrace) {
|
|
|
592
629
|
*
|
|
593
630
|
* Where possible, prefer `Stream#combineChunks` for a more efficient implementation.
|
|
594
631
|
*
|
|
595
|
-
* @tsplus
|
|
632
|
+
* @tsplus pipeable fncts.io.Stream combine
|
|
596
633
|
*/
|
|
597
634
|
|
|
598
635
|
|
|
599
|
-
export function
|
|
600
|
-
return
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
636
|
+
export function combine(that, s, f, __tsplusTrace) {
|
|
637
|
+
return stream => {
|
|
638
|
+
return new Stream(tsplus_module_10.unwrapScoped(() => tsplus_module_1.map(([left, right, latchL, latchR]) => {
|
|
639
|
+
const pullLeft = tsplus_module_1.flatMap(tsplus_module_1.fromExitNow, __tsplusTrace)(tsplus_module_1.apSecond(tsplus_module_5.take(left), __tsplusTrace)(tsplus_module_5.offer(undefined)(latchL)));
|
|
640
|
+
const pullRight = tsplus_module_1.flatMap(tsplus_module_1.fromExitNow, __tsplusTrace)(tsplus_module_1.apSecond(tsplus_module_5.take(right), __tsplusTrace)(tsplus_module_5.offer(undefined)(latchR)));
|
|
641
|
+
return unfoldIO_1(s, s => tsplus_module_1.flatMap(exit => tsplus_module_1.optional(tsplus_module_1.fromExitNow(exit, __tsplusTrace), __tsplusTrace), __tsplusTrace)(f(s, pullLeft, pullRight)), __tsplusTrace).channel;
|
|
642
|
+
}, __tsplusTrace)(tsplus_module_1.flatMap(left => tsplus_module_1.flatMap(right => tsplus_module_1.flatMap(latchL => tsplus_module_1.flatMap(latchR => tsplus_module_1.flatMap(() => tsplus_module_1.map(() => tuple(left, right, latchL, latchR), __tsplusTrace)(tsplus_module_1.fork(tsplus_module_13.runScoped(tsplus_module_10.pipeTo(combineProducer(right, latchR, __tsplusTrace))(tsplus_module_10.concatMap(tsplus_module_10.writeChunk)(that.channel))), __tsplusTrace)), __tsplusTrace)(tsplus_module_1.fork(tsplus_module_13.runScoped(tsplus_module_10.pipeTo(combineProducer(left, latchL, __tsplusTrace))(tsplus_module_10.concatMap(tsplus_module_10.writeChunk)(stream.channel))), __tsplusTrace)), __tsplusTrace)(tsplus_module_5.make()), __tsplusTrace)(tsplus_module_5.make()), __tsplusTrace)(tsplus_module_5.make()), __tsplusTrace)(tsplus_module_5.make()))));
|
|
643
|
+
};
|
|
605
644
|
}
|
|
606
645
|
|
|
607
646
|
function combineChunksProducer(handoff, latch, __tsplusTrace) {
|
|
608
|
-
return tsplus_module_11.
|
|
647
|
+
return tsplus_module_11.apSecond(tsplus_module_10.readWithCause(chunk => tsplus_module_11.apSecond(combineChunksProducer(handoff, latch, __tsplusTrace))(tsplus_module_10.fromIO(() => tsplus_module_5.offer(tsplus_module_23.chunk(chunk))(handoff))), cause => tsplus_module_10.fromIO(() => tsplus_module_5.offer(tsplus_module_23.failCause(cause))(handoff)), () => tsplus_module_11.apSecond(combineChunksProducer(handoff, latch, __tsplusTrace))(tsplus_module_10.fromIO(() => tsplus_module_5.offer(tsplus_module_23.end)(handoff)))))(tsplus_module_10.fromIO(() => tsplus_module_5.take(latch)));
|
|
609
648
|
}
|
|
610
649
|
/**
|
|
611
650
|
* Combines the chunks from this stream and the specified stream by repeatedly applying the
|
|
@@ -613,138 +652,154 @@ function combineChunksProducer(handoff, latch, __tsplusTrace) {
|
|
|
613
652
|
* it to the destination stream. `f` can maintain some internal state to control
|
|
614
653
|
* the combining process, with the initial state being specified by `s`.
|
|
615
654
|
*
|
|
616
|
-
* @tsplus
|
|
655
|
+
* @tsplus pipeable fncts.io.Stream combineChunks
|
|
617
656
|
*/
|
|
618
657
|
|
|
619
658
|
|
|
620
|
-
export function
|
|
621
|
-
return
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
659
|
+
export function combineChunks(that, s, f, __tsplusTrace) {
|
|
660
|
+
return stream => {
|
|
661
|
+
return new Stream(tsplus_module_10.unwrapScoped(() => tsplus_module_1.map(([left, right, latchL, latchR]) => {
|
|
662
|
+
const pullLeft = tsplus_module_1.flatMap(take => tsplus_module_23.done(take), __tsplusTrace)(tsplus_module_1.apSecond(tsplus_module_5.take(left), __tsplusTrace)(tsplus_module_5.offer(undefined)(latchL)));
|
|
663
|
+
const pullRight = tsplus_module_1.flatMap(take => tsplus_module_23.done(take), __tsplusTrace)(tsplus_module_1.apSecond(tsplus_module_5.take(right), __tsplusTrace)(tsplus_module_5.offer(undefined)(latchR)));
|
|
664
|
+
return unfoldChunkIO_1(s, s => tsplus_module_1.flatMap(exit => tsplus_module_1.optional(tsplus_module_1.fromExit(() => exit, __tsplusTrace), __tsplusTrace), __tsplusTrace)(f(s, pullLeft, pullRight)), __tsplusTrace).channel;
|
|
665
|
+
}, __tsplusTrace)(tsplus_module_1.flatMap(left => tsplus_module_1.flatMap(right => tsplus_module_1.flatMap(latchL => tsplus_module_1.flatMap(latchR => tsplus_module_1.flatMap(() => tsplus_module_1.map(() => tuple(left, right, latchL, latchR), __tsplusTrace)(tsplus_module_1.fork(tsplus_module_13.runScoped(tsplus_module_10.pipeTo(combineChunksProducer(right, latchR, __tsplusTrace))(that.channel)), __tsplusTrace)), __tsplusTrace)(tsplus_module_1.fork(tsplus_module_13.runScoped(tsplus_module_10.pipeTo(combineChunksProducer(left, latchL, __tsplusTrace))(stream.channel)), __tsplusTrace)), __tsplusTrace)(tsplus_module_5.make()), __tsplusTrace)(tsplus_module_5.make()), __tsplusTrace)(tsplus_module_5.make()), __tsplusTrace)(tsplus_module_5.make()))));
|
|
666
|
+
};
|
|
626
667
|
}
|
|
627
668
|
/**
|
|
628
669
|
* Concatenates the specified stream with this stream, resulting in a stream
|
|
629
670
|
* that emits the elements from this stream and then the elements from the specified stream.
|
|
630
671
|
*
|
|
631
|
-
* @tsplus
|
|
672
|
+
* @tsplus pipeable fncts.io.Stream concat
|
|
632
673
|
*/
|
|
633
674
|
|
|
634
|
-
function concat_1(
|
|
635
|
-
return
|
|
675
|
+
function concat_1(that, __tsplusTrace) {
|
|
676
|
+
return stream => {
|
|
677
|
+
return new Stream(tsplus_module_11.apSecond(that.channel)(stream.channel));
|
|
678
|
+
};
|
|
636
679
|
}
|
|
637
680
|
/**
|
|
638
681
|
* Composes this stream with the specified stream to create a cartesian product of elements.
|
|
639
682
|
* The `that` stream would be run multiple times, for every element in the `this` stream.
|
|
640
683
|
*
|
|
641
|
-
* @tsplus
|
|
684
|
+
* @tsplus pipeable fncts.io.Stream cross
|
|
642
685
|
*/
|
|
643
686
|
|
|
644
687
|
|
|
645
|
-
export function
|
|
646
|
-
return
|
|
688
|
+
export function cross(that, __tsplusTrace) {
|
|
689
|
+
return stream => {
|
|
690
|
+
return new Stream(tsplus_module_10.concatMap(as => tsplus_module_10.mapOut(bs => tsplus_module_12.flatMap(a => tsplus_module_12.map(b => tuple(a, b))(bs))(as))(that.channel))(stream.channel));
|
|
691
|
+
};
|
|
647
692
|
}
|
|
648
693
|
/**
|
|
649
694
|
* Composes this stream with the specified stream to create a cartesian product of elements
|
|
650
695
|
* with a specified function.
|
|
651
696
|
* The `fb` stream would be run multiple times, for every element in the `fa` stream.
|
|
652
697
|
*
|
|
653
|
-
* @tsplus
|
|
698
|
+
* @tsplus pipeable fncts.io.Stream crossWith
|
|
654
699
|
*/
|
|
655
700
|
|
|
656
|
-
function crossWith_1(
|
|
657
|
-
return
|
|
701
|
+
function crossWith_1(fb, f, __tsplusTrace) {
|
|
702
|
+
return fa => {
|
|
703
|
+
return flatMap_1(a => map_1(b => f(a, b), __tsplusTrace)(fb), __tsplusTrace)(fa);
|
|
704
|
+
};
|
|
658
705
|
}
|
|
659
706
|
/**
|
|
660
707
|
* Provides some of the environment required to run this effect,
|
|
661
708
|
* leaving the remainder `R0`.
|
|
662
709
|
*
|
|
663
|
-
* @tsplus
|
|
710
|
+
* @tsplus pipeable fncts.io.Stream contramapEnvironment
|
|
664
711
|
*/
|
|
665
712
|
|
|
666
713
|
|
|
667
|
-
export function
|
|
668
|
-
return
|
|
714
|
+
export function contramapEnvironment(f, __tsplusTrace) {
|
|
715
|
+
return ra => {
|
|
716
|
+
return flatMap_1(r0 => provideEnvironment_1(f(r0), __tsplusTrace)(ra), __tsplusTrace)(environment_1(__tsplusTrace));
|
|
717
|
+
};
|
|
669
718
|
}
|
|
670
719
|
/**
|
|
671
|
-
* @tsplus
|
|
720
|
+
* @tsplus pipeable fncts.io.Stream debounce
|
|
672
721
|
*/
|
|
673
722
|
|
|
674
|
-
export function
|
|
675
|
-
return
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
723
|
+
export function debounce(duration, __tsplusTrace) {
|
|
724
|
+
return stream => {
|
|
725
|
+
return unwrap_1(tsplus_module_21.transplant(grafter => tsplus_module_1.map(handoff => {
|
|
726
|
+
function enqueue(last, __tsplusTrace) {
|
|
727
|
+
return tsplus_module_1.map(f => consumer(tsplus_module_36.previous(f), __tsplusTrace), __tsplusTrace)(grafter(tsplus_module_1.fork(tsplus_module_1.as(() => last, __tsplusTrace)(tsplus_module_37.sleep(duration, __tsplusTrace)), __tsplusTrace)));
|
|
728
|
+
}
|
|
679
729
|
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
730
|
+
const producer = tsplus_module_10.readWithCause(inp => tsplus_module_17.match(() => producer, last => tsplus_module_11.apSecond(producer)(tsplus_module_10.fromIO(() => tsplus_module_5.offer(tsplus_module_5.emit(tsplus_module_16.single(last)))(handoff))))(tsplus_module_12.last(inp)), cause => tsplus_module_10.fromIO(() => tsplus_module_5.offer(tsplus_module_5.halt(cause))(handoff)), () => tsplus_module_10.fromIO(() => tsplus_module_5.offer(tsplus_module_5.end(new UpstreamEnd()))(handoff)));
|
|
731
|
+
|
|
732
|
+
function consumer(state, __tsplusTrace) {
|
|
733
|
+
return tsplus_module_10.unwrap(() => tsplus_module_36.match({
|
|
734
|
+
NotStarted: () => tsplus_module_1.map(signal => tsplus_module_5.matchSignal({
|
|
735
|
+
Emit: ({
|
|
736
|
+
els
|
|
737
|
+
}) => tsplus_module_10.unwrap(() => enqueue(els, __tsplusTrace)),
|
|
738
|
+
Halt: ({
|
|
739
|
+
error
|
|
740
|
+
}) => tsplus_module_11.failCauseNow(error),
|
|
741
|
+
End: () => tsplus_module_10.unit
|
|
742
|
+
})(signal), __tsplusTrace)(tsplus_module_5.take(handoff)),
|
|
743
|
+
Current: ({
|
|
744
|
+
fiber
|
|
745
|
+
}) => tsplus_module_1.map(signal => tsplus_module_5.matchSignal({
|
|
746
|
+
Emit: ({
|
|
747
|
+
els
|
|
748
|
+
}) => tsplus_module_10.unwrap(() => enqueue(els, __tsplusTrace)),
|
|
749
|
+
Halt: ({
|
|
750
|
+
error
|
|
751
|
+
}) => tsplus_module_11.failCauseNow(error),
|
|
752
|
+
End: () => tsplus_module_10.unit
|
|
753
|
+
})(signal), __tsplusTrace)(tsplus_module_19.join(fiber, __tsplusTrace)),
|
|
754
|
+
Previous: ({
|
|
755
|
+
fiber
|
|
756
|
+
}) => tsplus_module_21.raceWith(() => tsplus_module_5.take(handoff), (ex, current) => tsplus_module_30.match(cause => tsplus_module_1.as(() => tsplus_module_11.failCauseNow(cause), __tsplusTrace)(tsplus_module_20.interrupt(current, __tsplusTrace)), chunk => tsplus_module_1.succeedNow(tsplus_module_11.apSecond(consumer(tsplus_module_36.current(current), __tsplusTrace))(tsplus_module_10.writeNow(chunk)), __tsplusTrace))(ex), (ex, previous) => tsplus_module_30.match(cause => tsplus_module_1.as(() => tsplus_module_11.failCauseNow(cause), __tsplusTrace)(tsplus_module_20.interrupt(previous, __tsplusTrace)), signal => tsplus_module_5.matchSignal({
|
|
757
|
+
Emit: ({
|
|
758
|
+
els
|
|
759
|
+
}) => tsplus_module_1.apSecond(enqueue(els, __tsplusTrace), __tsplusTrace)(tsplus_module_20.interrupt(previous, __tsplusTrace)),
|
|
760
|
+
Halt: ({
|
|
761
|
+
error
|
|
762
|
+
}) => tsplus_module_1.as(() => tsplus_module_11.failCauseNow(error), __tsplusTrace)(tsplus_module_20.interrupt(previous, __tsplusTrace)),
|
|
763
|
+
End: () => tsplus_module_1.map(chunk => tsplus_module_11.apSecond(tsplus_module_10.unit)(tsplus_module_10.writeNow(chunk)), __tsplusTrace)(tsplus_module_19.join(previous, __tsplusTrace))
|
|
764
|
+
})(signal))(ex), __tsplusTrace)(tsplus_module_19.join(fiber, __tsplusTrace))
|
|
765
|
+
})(state));
|
|
766
|
+
}
|
|
717
767
|
|
|
718
|
-
|
|
719
|
-
|
|
768
|
+
return apSecond_1(new Stream(consumer(tsplus_module_36.notStarted, __tsplusTrace)), __tsplusTrace)(scoped_1(() => tsplus_module_1.fork(tsplus_module_13.runScoped(tsplus_module_10.pipeTo(producer)(stream.channel)), __tsplusTrace), __tsplusTrace));
|
|
769
|
+
}, __tsplusTrace)(tsplus_module_5.make()), __tsplusTrace), __tsplusTrace);
|
|
770
|
+
};
|
|
720
771
|
}
|
|
721
772
|
|
|
722
773
|
function defaultIfEmptyWriter(fb, __tsplusTrace) {
|
|
723
|
-
return tsplus_module_10.readWith(i => tsplus_module_12.isEmpty(i) ? defaultIfEmptyWriter(fb, __tsplusTrace) : tsplus_module_11.
|
|
774
|
+
return tsplus_module_10.readWith(i => tsplus_module_12.isEmpty(i) ? defaultIfEmptyWriter(fb, __tsplusTrace) : tsplus_module_11.apSecond(tsplus_module_10.id())(tsplus_module_10.writeNow(i)), tsplus_module_10.failNow, () => fb.channel);
|
|
724
775
|
}
|
|
725
776
|
/**
|
|
726
777
|
* Switches to the provided stream in case this one is empty.
|
|
727
778
|
*
|
|
728
|
-
* @tsplus
|
|
779
|
+
* @tsplus pipeable fncts.io.Stream defaultIfEmpty
|
|
729
780
|
*/
|
|
730
781
|
|
|
731
782
|
|
|
732
|
-
export function
|
|
733
|
-
return
|
|
783
|
+
export function defaultIfEmpty(fb, __tsplusTrace) {
|
|
784
|
+
return fa => {
|
|
785
|
+
return new Stream(tsplus_module_10.pipeTo(defaultIfEmptyWriter(fb, __tsplusTrace))(fa.channel));
|
|
786
|
+
};
|
|
734
787
|
}
|
|
735
788
|
/**
|
|
736
789
|
* More powerful version of `broadcast`. Allows to provide a function that determines what
|
|
737
790
|
* queues should receive which elements. The decide function will receive the indices of the queues
|
|
738
791
|
* in the resulting list.
|
|
739
792
|
*
|
|
740
|
-
* @tsplus
|
|
793
|
+
* @tsplus pipeable fncts.io.Stream distributedWith
|
|
741
794
|
*/
|
|
742
795
|
|
|
743
|
-
export function
|
|
744
|
-
return
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
796
|
+
export function distributedWith(n, maximumLag, decide, __tsplusTrace) {
|
|
797
|
+
return self => {
|
|
798
|
+
return tsplus_module_1.flatMap(p => tsplus_module_1.flatMap(next => tsplus_module_1.flatMap(entries => {
|
|
799
|
+
const [mappings, queues] = tsplus_module_12.foldRight([tsplus_module_38.makeDefault(), tsplus_module_7.empty()], ([mapping, queue], [mappings, queues]) => [tsplus_module_38.set(mapping[0], mapping[1])(mappings), tsplus_module_12.append(queue)(queues)])(entries);
|
|
800
|
+
return tsplus_module_1.as(() => queues, __tsplusTrace)(tsplus_module_31.succeed_(a => tsplus_module_1.map(f => key => f(tsplus_module_33.toUndefined(tsplus_module_38.get(key)(mappings))), __tsplusTrace)(decide(a)), __tsplusTrace)(p));
|
|
801
|
+
}, __tsplusTrace)(tsplus_module_1.sequenceIterable(tsplus_module_12.map(id => tsplus_module_1.map(([key, queue]) => [[key, id], queue], __tsplusTrace)(next))(tsplus_module_16.range(0, n)), __tsplusTrace)), __tsplusTrace)(distributedWithDynamic_1(maximumLag, a => tsplus_module_1.flatMap(f => f(a), __tsplusTrace)(tsplus_module_31.wait(p, __tsplusTrace)), () => tsplus_module_1.unit, __tsplusTrace)(self)), __tsplusTrace)(tsplus_module_32.make(__tsplusTrace));
|
|
802
|
+
};
|
|
748
803
|
}
|
|
749
804
|
/**
|
|
750
805
|
* More powerful version of `ZStream#distributedWith`. This returns a function that will produce
|
|
@@ -754,26 +809,28 @@ export function distributedWith_(self, n, maximumLag, decide, __tsplusTrace) {
|
|
|
754
809
|
* Downstream users can also shutdown queues manually. In this case the driver will
|
|
755
810
|
* continue but no longer backpressure on them.
|
|
756
811
|
*
|
|
757
|
-
* @tsplus
|
|
812
|
+
* @tsplus pipeable fncts.io.Stream distributedWithDynamic
|
|
758
813
|
*/
|
|
759
814
|
|
|
760
|
-
function distributedWithDynamic_1(
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
815
|
+
function distributedWithDynamic_1(maximumLag, decide, done = () => tsplus_module_1.unit, __tsplusTrace) {
|
|
816
|
+
return self => {
|
|
817
|
+
const offer = queuesRef => a => tsplus_module_1.flatMap(shouldProcess => tsplus_module_1.flatMap(queues => tsplus_module_1.flatMap(ids => tsplus_module_12.isNonEmpty(ids) ? queuesRef.update(map => tsplus_module_38.removeMany(ids)(map), __tsplusTrace) : tsplus_module_1.unit, __tsplusTrace)(tsplus_module_1.foldLeft(queues, tsplus_module_7.empty(), (b, [id, queue]) => {
|
|
818
|
+
if (shouldProcess(id)) {
|
|
819
|
+
return tsplus_module_1.matchCauseIO(c => tsplus_module_22.interrupted(c) ? tsplus_module_1.succeedNow(tsplus_module_12.append(id)(b), __tsplusTrace) : tsplus_module_1.failCauseNow(c, __tsplusTrace), () => tsplus_module_1.succeedNow(b, __tsplusTrace), __tsplusTrace)(queue.offer(tsplus_module_35.succeed(a), __tsplusTrace));
|
|
820
|
+
} else {
|
|
821
|
+
return tsplus_module_1.succeedNow(b, __tsplusTrace);
|
|
822
|
+
}
|
|
823
|
+
}, __tsplusTrace)), __tsplusTrace)(queuesRef.get), __tsplusTrace)(decide(a));
|
|
768
824
|
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
825
|
+
return tsplus_module_1.flatMap(queuesRef => tsplus_module_1.map(add => add, __tsplusTrace)(tsplus_module_1.flatMap(queuesLock => tsplus_module_1.flatMap(newQueue => {
|
|
826
|
+
const finalize = endTake => tsplus_module_39.withPermit(queuesLock, __tsplusTrace)(tsplus_module_1.asUnit(tsplus_module_1.flatMap(() => tsplus_module_1.flatMap(queues => tsplus_module_1.flatMap(() => tsplus_module_1.map(() => void 0, __tsplusTrace)(done(endTake)), __tsplusTrace)(tsplus_module_1.foreach(queues, queue => tsplus_module_1.catchJustCause(c => tsplus_module_22.interrupted(c) ? tsplus_module_3.just(tsplus_module_1.unit) : tsplus_module_3.nothing(), __tsplusTrace)(queue.offer(endTake, __tsplusTrace)), __tsplusTrace)), __tsplusTrace)(tsplus_module_1.map(map => tsplus_module_38.values(map), __tsplusTrace)(queuesRef.get)), __tsplusTrace)(newQueue.set(tsplus_module_1.flatMap(queue => tsplus_module_1.flatMap(() => {
|
|
827
|
+
const id = Symbol();
|
|
828
|
+
return tsplus_module_1.map(() => tuple(id, queue), __tsplusTrace)(queuesRef.update(map => tsplus_module_38.set(id, queue)(map), __tsplusTrace));
|
|
829
|
+
}, __tsplusTrace)(queue.offer(endTake, __tsplusTrace)), __tsplusTrace)(tsplus_module_25.makeBounded(1, __tsplusTrace)), __tsplusTrace)), __tsplusTrace));
|
|
774
830
|
|
|
775
|
-
|
|
776
|
-
|
|
831
|
+
return tsplus_module_1.map(() => tsplus_module_39.withPermit(queuesLock, __tsplusTrace)(tsplus_module_1.flatten(newQueue.get, __tsplusTrace)), __tsplusTrace)(tsplus_module_1.fork(tsplus_module_1.matchCauseIO(cause => finalize(tsplus_module_35.failCause(tsplus_module_22.map(tsplus_module_3.just)(cause))), () => finalize(tsplus_module_35.fail(tsplus_module_3.nothing())), __tsplusTrace)(runForeachScoped_1(offer(queuesRef), __tsplusTrace)(self)), __tsplusTrace));
|
|
832
|
+
}, __tsplusTrace)(tsplus_module_6.make(() => tsplus_module_1.flatMap(queue => tsplus_module_1.flatMap(id => tsplus_module_1.map(() => tuple(id, queue), __tsplusTrace)(queuesRef.update(map => tsplus_module_38.set(id, queue)(map), __tsplusTrace)), __tsplusTrace)(tsplus_module_1.succeed(() => Symbol(), __tsplusTrace)), __tsplusTrace)(tsplus_module_25.makeBounded(maximumLag, __tsplusTrace)), __tsplusTrace)), __tsplusTrace)(tsplus_module_41.atomically(tsplus_module_40.make(1, __tsplusTrace), __tsplusTrace))), __tsplusTrace)(tsplus_module_26.acquireRelease(() => tsplus_module_6.make(() => tsplus_module_38.makeDefault(), __tsplusTrace), ref => tsplus_module_1.flatMap(qs => tsplus_module_1.foreach(tsplus_module_38.values(qs), q => q.shutdown, __tsplusTrace), __tsplusTrace)(ref.get), __tsplusTrace));
|
|
833
|
+
};
|
|
777
834
|
}
|
|
778
835
|
/**
|
|
779
836
|
* Converts this stream to a stream that executes its effects but emits no
|
|
@@ -789,43 +846,49 @@ export function drain(fa, __tsplusTrace) {
|
|
|
789
846
|
|
|
790
847
|
function dropLoop(r, __tsplusTrace) {
|
|
791
848
|
return tsplus_module_10.readWith(inp => {
|
|
792
|
-
const dropped = tsplus_module_12.
|
|
849
|
+
const dropped = tsplus_module_12.drop(r)(inp);
|
|
793
850
|
const leftover = Math.max(0, r - inp.length);
|
|
794
851
|
const more = tsplus_module_12.isEmpty(inp) || leftover > 0;
|
|
795
|
-
return more ? dropLoop(leftover, __tsplusTrace) : tsplus_module_11.
|
|
852
|
+
return more ? dropLoop(leftover, __tsplusTrace) : tsplus_module_11.apSecond(tsplus_module_10.id())(tsplus_module_10.write(() => dropped));
|
|
796
853
|
}, tsplus_module_10.failNow, () => tsplus_module_10.unit);
|
|
797
854
|
}
|
|
798
855
|
/**
|
|
799
856
|
* Drops the specified number of elements from this stream.
|
|
800
857
|
*
|
|
801
|
-
* @tsplus
|
|
858
|
+
* @tsplus pipeable fncts.io.Stream drop
|
|
802
859
|
*/
|
|
803
860
|
|
|
804
861
|
|
|
805
|
-
function drop_1(
|
|
806
|
-
return
|
|
862
|
+
function drop_1(n, __tsplusTrace) {
|
|
863
|
+
return stream => {
|
|
864
|
+
return new Stream(tsplus_module_10.pipeTo(dropLoop(n, __tsplusTrace))(stream.channel));
|
|
865
|
+
};
|
|
807
866
|
}
|
|
808
867
|
/**
|
|
809
868
|
* Drops all elements of the stream for as long as the specified predicate
|
|
810
869
|
* evaluates to `true`.
|
|
811
870
|
*
|
|
812
|
-
* @tsplus
|
|
871
|
+
* @tsplus pipeable fncts.io.Stream dropWhile
|
|
813
872
|
*/
|
|
814
873
|
|
|
815
874
|
|
|
816
|
-
function dropWhile_1(
|
|
817
|
-
return
|
|
875
|
+
function dropWhile_1(p, __tsplusTrace) {
|
|
876
|
+
return stream => {
|
|
877
|
+
return pipeThrough_1(tsplus_module_42.makeDropWhile(p, __tsplusTrace), __tsplusTrace)(stream);
|
|
878
|
+
};
|
|
818
879
|
}
|
|
819
880
|
/**
|
|
820
881
|
* Drops all elements of the stream until the specified predicate evaluates
|
|
821
882
|
* to `true`.
|
|
822
883
|
*
|
|
823
|
-
* @tsplus
|
|
884
|
+
* @tsplus pipeable fncts.io.Stream dropUntil
|
|
824
885
|
*/
|
|
825
886
|
|
|
826
887
|
|
|
827
|
-
export function
|
|
828
|
-
return
|
|
888
|
+
export function dropUntil(p, __tsplusTrace) {
|
|
889
|
+
return stream => {
|
|
890
|
+
return drop_1(1, __tsplusTrace)(dropWhile_1(tsplus_module_43.invert(p), __tsplusTrace)(stream));
|
|
891
|
+
};
|
|
829
892
|
}
|
|
830
893
|
/**
|
|
831
894
|
* Returns a stream whose failures and successes have been lifted into an
|
|
@@ -838,17 +901,17 @@ export function dropUntil_(stream, p, __tsplusTrace) {
|
|
|
838
901
|
*/
|
|
839
902
|
|
|
840
903
|
export function either(stream, __tsplusTrace) {
|
|
841
|
-
return catchAll_1(
|
|
904
|
+
return catchAll_1(e => succeedNow_1(tsplus_module_15.left(e), __tsplusTrace), __tsplusTrace)(map_1(tsplus_module_15.right, __tsplusTrace)(stream));
|
|
842
905
|
}
|
|
843
906
|
/**
|
|
844
907
|
* @tsplus static fncts.io.StreamOps empty
|
|
845
908
|
*/
|
|
846
909
|
|
|
847
|
-
const empty_1 = /*#__PURE__*/fromChunkNow_1( /*#__PURE__*/tsplus_module_7.empty(), fileName_1 + ":
|
|
910
|
+
const empty_1 = /*#__PURE__*/fromChunkNow_1( /*#__PURE__*/tsplus_module_7.empty(), fileName_1 + ":1219:70");
|
|
848
911
|
export const empty = empty_1;
|
|
849
912
|
|
|
850
913
|
function endWhenWriter(fiber, __tsplusTrace) {
|
|
851
|
-
return tsplus_module_10.unwrap(() => tsplus_module_1.
|
|
914
|
+
return tsplus_module_10.unwrap(() => tsplus_module_1.map(maybeExit => tsplus_module_17.match(() => tsplus_module_10.readWith(inp => tsplus_module_11.apSecond(endWhenWriter(fiber, __tsplusTrace))(tsplus_module_10.writeNow(inp)), tsplus_module_10.failNow, () => tsplus_module_10.unit), exit => tsplus_module_30.match(tsplus_module_11.failCauseNow, () => tsplus_module_10.unit)(exit))(maybeExit), __tsplusTrace)(tsplus_module_44.poll(fiber, __tsplusTrace)));
|
|
852
915
|
}
|
|
853
916
|
/**
|
|
854
917
|
* Halts the evaluation of this stream when the provided IO completes. The given IO
|
|
@@ -859,19 +922,23 @@ function endWhenWriter(fiber, __tsplusTrace) {
|
|
|
859
922
|
*
|
|
860
923
|
* If the IO completes with a failure, the stream will emit that failure.
|
|
861
924
|
*
|
|
862
|
-
* @tsplus
|
|
925
|
+
* @tsplus pipeable fncts.io.Stream endWhen
|
|
863
926
|
*/
|
|
864
927
|
|
|
865
928
|
|
|
866
|
-
export function
|
|
867
|
-
return
|
|
929
|
+
export function endWhen(io, __tsplusTrace) {
|
|
930
|
+
return stream => {
|
|
931
|
+
return new Stream(tsplus_module_10.unwrapScoped(() => tsplus_module_1.map(fiber => tsplus_module_10.pipeTo(endWhenWriter(fiber, __tsplusTrace))(stream.channel), __tsplusTrace)(tsplus_module_14.forkScoped(io, __tsplusTrace))));
|
|
932
|
+
};
|
|
868
933
|
}
|
|
869
934
|
/**
|
|
870
|
-
* @tsplus
|
|
935
|
+
* @tsplus pipeable fncts.io.Stream ensuring
|
|
871
936
|
*/
|
|
872
937
|
|
|
873
|
-
function ensuring_1(
|
|
874
|
-
return
|
|
938
|
+
function ensuring_1(finalizer, __tsplusTrace) {
|
|
939
|
+
return self => {
|
|
940
|
+
return new Stream(tsplus_module_10.ensuring(finalizer)(self.channel));
|
|
941
|
+
};
|
|
875
942
|
}
|
|
876
943
|
/**
|
|
877
944
|
* @tsplus static fncts.io.StreamOps environment
|
|
@@ -879,7 +946,7 @@ function ensuring_1(self, finalizer, __tsplusTrace) {
|
|
|
879
946
|
|
|
880
947
|
|
|
881
948
|
function environment_1(__tsplusTrace) {
|
|
882
|
-
return fromIO_1(
|
|
949
|
+
return fromIO_1(tsplus_module_45.environment(__tsplusTrace), __tsplusTrace);
|
|
883
950
|
}
|
|
884
951
|
/**
|
|
885
952
|
* Accesses the environment of the stream.
|
|
@@ -889,7 +956,7 @@ function environment_1(__tsplusTrace) {
|
|
|
889
956
|
|
|
890
957
|
|
|
891
958
|
export function environmentWith(f, __tsplusTrace) {
|
|
892
|
-
return map_1(
|
|
959
|
+
return map_1(f, __tsplusTrace)(environment_1(__tsplusTrace));
|
|
893
960
|
}
|
|
894
961
|
/**
|
|
895
962
|
* Accesses the environment of the stream in the context of an effect.
|
|
@@ -898,7 +965,7 @@ export function environmentWith(f, __tsplusTrace) {
|
|
|
898
965
|
*/
|
|
899
966
|
|
|
900
967
|
export function environmentWithIO(f, __tsplusTrace) {
|
|
901
|
-
return mapIO_1(
|
|
968
|
+
return mapIO_1(f, __tsplusTrace)(environment_1(__tsplusTrace));
|
|
902
969
|
}
|
|
903
970
|
/**
|
|
904
971
|
* Accesses the environment of the stream in the context of a stream.
|
|
@@ -907,7 +974,7 @@ export function environmentWithIO(f, __tsplusTrace) {
|
|
|
907
974
|
*/
|
|
908
975
|
|
|
909
976
|
export function environmentWithStream(f, __tsplusTrace) {
|
|
910
|
-
return flatMap_1(
|
|
977
|
+
return flatMap_1(f, __tsplusTrace)(environment_1(__tsplusTrace));
|
|
911
978
|
}
|
|
912
979
|
/**
|
|
913
980
|
* Halt a stream with the specified error
|
|
@@ -947,15 +1014,19 @@ function failCauseNow_1(cause, __tsplusTrace) {
|
|
|
947
1014
|
export function failCause(cause, __tsplusTrace) {
|
|
948
1015
|
return fromIO_1(tsplus_module_1.failCause(cause, __tsplusTrace), __tsplusTrace);
|
|
949
1016
|
}
|
|
950
|
-
export function
|
|
951
|
-
return
|
|
1017
|
+
export function filter(predicate, __tsplusTrace) {
|
|
1018
|
+
return fa => {
|
|
1019
|
+
return mapChunks_1(chunk => tsplus_module_12.filter(predicate)(chunk), __tsplusTrace)(fa);
|
|
1020
|
+
};
|
|
952
1021
|
}
|
|
953
1022
|
/**
|
|
954
|
-
* @tsplus
|
|
1023
|
+
* @tsplus pipeable fncts.io.Stream filterIO
|
|
955
1024
|
*/
|
|
956
1025
|
|
|
957
|
-
export function
|
|
958
|
-
return
|
|
1026
|
+
export function filterIO(f, __tsplusTrace) {
|
|
1027
|
+
return fa => {
|
|
1028
|
+
return new Stream(tsplus_module_10.pipeTo(filterIOLoop(tsplus_module_34.empty()[Symbol.iterator](), f, __tsplusTrace))(fa.channel));
|
|
1029
|
+
};
|
|
959
1030
|
}
|
|
960
1031
|
|
|
961
1032
|
function filterIOLoop(iterator, f, __tsplusTrace) {
|
|
@@ -964,24 +1035,28 @@ function filterIOLoop(iterator, f, __tsplusTrace) {
|
|
|
964
1035
|
if (next.done) {
|
|
965
1036
|
return tsplus_module_10.readWithCause(elem => filterIOLoop(elem[Symbol.iterator](), f, __tsplusTrace), tsplus_module_11.failCauseNow, tsplus_module_11.succeedNow);
|
|
966
1037
|
} else {
|
|
967
|
-
return tsplus_module_10.unwrap(() => tsplus_module_1.
|
|
1038
|
+
return tsplus_module_10.unwrap(() => tsplus_module_1.map(b => b ? tsplus_module_11.apSecond(filterIOLoop(iterator, f, __tsplusTrace))(tsplus_module_10.writeNow(tsplus_module_16.single(next.value))) : filterIOLoop(iterator, f, __tsplusTrace), __tsplusTrace)(f(next.value)));
|
|
968
1039
|
}
|
|
969
1040
|
}
|
|
970
1041
|
/**
|
|
971
|
-
* @tsplus
|
|
1042
|
+
* @tsplus pipeable fncts.io.Stream filterMap
|
|
972
1043
|
*/
|
|
973
1044
|
|
|
974
1045
|
|
|
975
|
-
function filterMap_1(
|
|
976
|
-
return
|
|
1046
|
+
function filterMap_1(f, __tsplusTrace) {
|
|
1047
|
+
return fa => {
|
|
1048
|
+
return mapChunks_1(chunk => tsplus_module_12.filterMap(f)(chunk), __tsplusTrace)(fa);
|
|
1049
|
+
};
|
|
977
1050
|
}
|
|
978
1051
|
/**
|
|
979
|
-
* @tsplus
|
|
1052
|
+
* @tsplus pipeable fncts.io.Stream filterMapIO
|
|
980
1053
|
*/
|
|
981
1054
|
|
|
982
1055
|
|
|
983
|
-
export function
|
|
984
|
-
return
|
|
1056
|
+
export function filterMapIO(f, __tsplusTrace) {
|
|
1057
|
+
return fa => {
|
|
1058
|
+
return new Stream(tsplus_module_10.pipeTo(filterMapIOLoop(tsplus_module_34.empty()[Symbol.iterator](), f, __tsplusTrace))(fa.channel));
|
|
1059
|
+
};
|
|
985
1060
|
}
|
|
986
1061
|
|
|
987
1062
|
function filterMapIOLoop(iterator, f, __tsplusTrace) {
|
|
@@ -990,29 +1065,33 @@ function filterMapIOLoop(iterator, f, __tsplusTrace) {
|
|
|
990
1065
|
if (next.done) {
|
|
991
1066
|
return tsplus_module_10.readWithCause(elem => filterMapIOLoop(elem[Symbol.iterator](), f, __tsplusTrace), tsplus_module_11.failCauseNow, tsplus_module_11.succeedNow);
|
|
992
1067
|
} else {
|
|
993
|
-
return tsplus_module_10.unwrap(() => tsplus_module_1.
|
|
1068
|
+
return tsplus_module_10.unwrap(() => tsplus_module_1.map(b => tsplus_module_17.match(() => filterMapIOLoop(iterator, f, __tsplusTrace), b => tsplus_module_11.apSecond(filterMapIOLoop(iterator, f, __tsplusTrace))(tsplus_module_10.writeNow(tsplus_module_16.single(b))))(b), __tsplusTrace)(f(next.value)));
|
|
994
1069
|
}
|
|
995
1070
|
}
|
|
996
1071
|
/**
|
|
997
1072
|
* Finds the first element emitted by this stream that satisfies the provided predicate.
|
|
998
1073
|
*
|
|
999
|
-
* @tsplus
|
|
1074
|
+
* @tsplus pipeable fncts.io.Stream find
|
|
1000
1075
|
*/
|
|
1001
1076
|
|
|
1002
1077
|
|
|
1003
|
-
export function
|
|
1004
|
-
|
|
1005
|
-
|
|
1078
|
+
export function find(p, __tsplusTrace) {
|
|
1079
|
+
return stream => {
|
|
1080
|
+
const loop = tsplus_module_10.readWith(inp => tsplus_module_17.match(() => loop, a => tsplus_module_10.writeNow(tsplus_module_16.single(a)))(tsplus_module_12.find(p)(inp)), tsplus_module_10.failNow, () => tsplus_module_10.unit);
|
|
1081
|
+
return new Stream(tsplus_module_10.pipeTo(loop)(stream.channel));
|
|
1082
|
+
};
|
|
1006
1083
|
}
|
|
1007
1084
|
/**
|
|
1008
1085
|
* Finds the first element emitted by this stream that satisfies the provided effectful predicate.
|
|
1009
1086
|
*
|
|
1010
|
-
* @tsplus
|
|
1087
|
+
* @tsplus pipeable fncts.io.Stream findIO
|
|
1011
1088
|
*/
|
|
1012
1089
|
|
|
1013
|
-
export function
|
|
1014
|
-
|
|
1015
|
-
|
|
1090
|
+
export function findIO(f, __tsplusTrace) {
|
|
1091
|
+
return stream => {
|
|
1092
|
+
const loop = tsplus_module_10.readWith(inp => tsplus_module_10.unwrap(() => tsplus_module_1.map(maybeA => tsplus_module_17.match(() => loop, a => tsplus_module_10.writeNow(tsplus_module_16.single(a)))(maybeA), __tsplusTrace)(tsplus_module_46.findIO(f, __tsplusTrace)(inp))), tsplus_module_10.failNow, () => tsplus_module_10.unit);
|
|
1093
|
+
return new Stream(tsplus_module_10.pipeTo(loop)(stream.channel));
|
|
1094
|
+
};
|
|
1016
1095
|
}
|
|
1017
1096
|
/**
|
|
1018
1097
|
* Flattens this stream-of-streams into a stream made of the concatenation in
|
|
@@ -1022,7 +1101,7 @@ export function findIO_(stream, f, __tsplusTrace) {
|
|
|
1022
1101
|
*/
|
|
1023
1102
|
|
|
1024
1103
|
function flatten_1(self, __tsplusTrace) {
|
|
1025
|
-
return flatMap_1(
|
|
1104
|
+
return flatMap_1(identity, __tsplusTrace)(self);
|
|
1026
1105
|
}
|
|
1027
1106
|
/**
|
|
1028
1107
|
* Unwraps `Exit` values that also signify end-of-stream by failing with `None`.
|
|
@@ -1035,13 +1114,13 @@ function flatten_1(self, __tsplusTrace) {
|
|
|
1035
1114
|
|
|
1036
1115
|
function flattenExitOption_1(stream, __tsplusTrace) {
|
|
1037
1116
|
const processChunk = (chunk, cont) => {
|
|
1038
|
-
const [toEmit, rest] = tsplus_module_12.
|
|
1039
|
-
const next =
|
|
1040
|
-
return tsplus_module_11.
|
|
1117
|
+
const [toEmit, rest] = tsplus_module_12.splitWhere(_ => !tsplus_module_47.isSuccess(_))(chunk);
|
|
1118
|
+
const next = tsplus_module_17.match(() => cont, exit => tsplus_module_30.match(cause => tsplus_module_17.match(() => tsplus_module_11.endNow(undefined), tsplus_module_11.failCauseNow)(tsplus_module_22.flipCauseOption(cause)), () => tsplus_module_11.endNow(undefined))(exit))(tsplus_module_12.head(rest));
|
|
1119
|
+
return tsplus_module_11.apSecond(next)(tsplus_module_10.writeNow(tsplus_module_12.filterMap(exit => tsplus_module_30.match(() => tsplus_module_3.nothing(), tsplus_module_3.just)(exit))(toEmit)));
|
|
1041
1120
|
};
|
|
1042
1121
|
|
|
1043
1122
|
const process = tsplus_module_10.readWithCause(chunk => processChunk(chunk, process), tsplus_module_11.failCauseNow, _ => tsplus_module_11.endNow(undefined));
|
|
1044
|
-
return new Stream(tsplus_module_10.
|
|
1123
|
+
return new Stream(tsplus_module_10.pipeTo(process)(stream.channel));
|
|
1045
1124
|
}
|
|
1046
1125
|
/**
|
|
1047
1126
|
* Unwraps `Exit` values and flatten chunks that also signify end-of-stream by failing with `None`.
|
|
@@ -1051,7 +1130,7 @@ function flattenExitOption_1(stream, __tsplusTrace) {
|
|
|
1051
1130
|
|
|
1052
1131
|
|
|
1053
1132
|
function flattenTake_1(stream, __tsplusTrace) {
|
|
1054
|
-
return flattenChunks_1(flattenExitOption_1(map_1(
|
|
1133
|
+
return flattenChunks_1(flattenExitOption_1(map_1(take => take.exit, __tsplusTrace)(stream), __tsplusTrace), __tsplusTrace);
|
|
1055
1134
|
}
|
|
1056
1135
|
/**
|
|
1057
1136
|
* Submerges the chunks carried by this stream into the stream's structure, while
|
|
@@ -1062,7 +1141,7 @@ function flattenTake_1(stream, __tsplusTrace) {
|
|
|
1062
1141
|
|
|
1063
1142
|
|
|
1064
1143
|
function flattenChunks_1(stream, __tsplusTrace) {
|
|
1065
|
-
return new Stream(tsplus_module_10.
|
|
1144
|
+
return new Stream(tsplus_module_10.mapOut(c => tsplus_module_12.flatten(c))(stream.channel));
|
|
1066
1145
|
}
|
|
1067
1146
|
/**
|
|
1068
1147
|
* Repeats this stream forever.
|
|
@@ -1102,7 +1181,7 @@ function fromChunk_1(c, __tsplusTrace) {
|
|
|
1102
1181
|
|
|
1103
1182
|
|
|
1104
1183
|
function scoped_1(stream, __tsplusTrace) {
|
|
1105
|
-
return new Stream(tsplus_module_10.scoped(() => tsplus_module_1.
|
|
1184
|
+
return new Stream(tsplus_module_10.scoped(() => tsplus_module_1.map(tsplus_module_16.single, __tsplusTrace)(stream())));
|
|
1106
1185
|
}
|
|
1107
1186
|
/**
|
|
1108
1187
|
* Creates a stream from an effect producing a value of type `A`
|
|
@@ -1112,7 +1191,7 @@ function scoped_1(stream, __tsplusTrace) {
|
|
|
1112
1191
|
|
|
1113
1192
|
|
|
1114
1193
|
function fromIO_1(fa, __tsplusTrace) {
|
|
1115
|
-
return fromIOMaybe_1(tsplus_module_1.
|
|
1194
|
+
return fromIOMaybe_1(tsplus_module_1.mapError(tsplus_module_3.just, __tsplusTrace)(fa), __tsplusTrace);
|
|
1116
1195
|
}
|
|
1117
1196
|
/**
|
|
1118
1197
|
* Creates a stream from an effect producing a value of type `A` or an empty Stream
|
|
@@ -1122,12 +1201,12 @@ function fromIO_1(fa, __tsplusTrace) {
|
|
|
1122
1201
|
|
|
1123
1202
|
|
|
1124
1203
|
function fromIOMaybe_1(fa, __tsplusTrace) {
|
|
1125
|
-
return new Stream(tsplus_module_10.unwrap(() => tsplus_module_1.
|
|
1204
|
+
return new Stream(tsplus_module_10.unwrap(() => tsplus_module_1.match(maybeError => tsplus_module_17.match(() => tsplus_module_10.unit, tsplus_module_10.failNow)(maybeError), a => tsplus_module_10.writeNow(tsplus_module_16.single(a)), __tsplusTrace)(fa)));
|
|
1126
1205
|
}
|
|
1127
1206
|
|
|
1128
1207
|
function fromAsyncIterableLoop(iterator, __tsplusTrace) {
|
|
1129
1208
|
return tsplus_module_10.unwrap(() => tsplus_module_1.async(k => {
|
|
1130
|
-
iterator.next().then(result => result.done ? k(tsplus_module_1.succeedNow(tsplus_module_11.end(() => undefined), __tsplusTrace)) : k(tsplus_module_1.succeedNow(tsplus_module_11.
|
|
1209
|
+
iterator.next().then(result => result.done ? k(tsplus_module_1.succeedNow(tsplus_module_11.end(() => undefined), __tsplusTrace)) : k(tsplus_module_1.succeedNow(tsplus_module_11.apSecond(fromAsyncIterableLoop(iterator, __tsplusTrace))(tsplus_module_10.writeNow(tsplus_module_16.single(result.value))), __tsplusTrace)));
|
|
1131
1210
|
}));
|
|
1132
1211
|
}
|
|
1133
1212
|
/**
|
|
@@ -1152,7 +1231,7 @@ export function fromIterable(iterable, maxChunkSize = DEFAULT_CHUNK_SIZE, __tspl
|
|
|
1152
1231
|
}
|
|
1153
1232
|
|
|
1154
1233
|
if (maxChunkSize === 1) {
|
|
1155
|
-
return tsplus_module_11.
|
|
1234
|
+
return tsplus_module_11.apSecond(loop(iterator))(tsplus_module_10.writeNow(tsplus_module_16.single(result.value)));
|
|
1156
1235
|
} else {
|
|
1157
1236
|
const out = Array(maxChunkSize);
|
|
1158
1237
|
out[0] = result.value;
|
|
@@ -1163,7 +1242,7 @@ export function fromIterable(iterable, maxChunkSize = DEFAULT_CHUNK_SIZE, __tspl
|
|
|
1163
1242
|
count++;
|
|
1164
1243
|
}
|
|
1165
1244
|
|
|
1166
|
-
return tsplus_module_11.
|
|
1245
|
+
return tsplus_module_11.apSecond(loop(iterator))(tsplus_module_10.writeNow(tsplus_module_16.from(out)));
|
|
1167
1246
|
}
|
|
1168
1247
|
}, __tsplusTrace));
|
|
1169
1248
|
|
|
@@ -1175,7 +1254,7 @@ export function fromIterable(iterable, maxChunkSize = DEFAULT_CHUNK_SIZE, __tspl
|
|
|
1175
1254
|
*/
|
|
1176
1255
|
|
|
1177
1256
|
export function fromIterableSingle(iterable, __tsplusTrace) {
|
|
1178
|
-
return flatMap_1(
|
|
1257
|
+
return flatMap_1(iterator => repeatIOMaybe_1(tsplus_module_1.defer(() => {
|
|
1179
1258
|
const value = iterator.next();
|
|
1180
1259
|
|
|
1181
1260
|
if (value.done) {
|
|
@@ -1183,14 +1262,14 @@ export function fromIterableSingle(iterable, __tsplusTrace) {
|
|
|
1183
1262
|
} else {
|
|
1184
1263
|
return tsplus_module_1.succeedNow(value.value, __tsplusTrace);
|
|
1185
1264
|
}
|
|
1186
|
-
}, __tsplusTrace), __tsplusTrace), __tsplusTrace);
|
|
1265
|
+
}, __tsplusTrace), __tsplusTrace), __tsplusTrace)(fromIO_1(tsplus_module_1.succeed(() => iterable[Symbol.iterator](), __tsplusTrace), __tsplusTrace));
|
|
1187
1266
|
}
|
|
1188
1267
|
/**
|
|
1189
1268
|
* @tsplus static fncts.io.StreamOps fromPull
|
|
1190
1269
|
*/
|
|
1191
1270
|
|
|
1192
1271
|
function fromPull_1(scopedPull, __tsplusTrace) {
|
|
1193
|
-
return unwrapScoped_1(tsplus_module_1.
|
|
1272
|
+
return unwrapScoped_1(tsplus_module_1.map(pull => repeatIOChunkMaybe_1(pull, __tsplusTrace), __tsplusTrace)(scopedPull), __tsplusTrace);
|
|
1194
1273
|
}
|
|
1195
1274
|
/**
|
|
1196
1275
|
* Creates a stream from a `Queue` of values
|
|
@@ -1200,13 +1279,13 @@ function fromPull_1(scopedPull, __tsplusTrace) {
|
|
|
1200
1279
|
|
|
1201
1280
|
|
|
1202
1281
|
function fromQueue_1(queue, maxChunkSize = DEFAULT_CHUNK_SIZE, __tsplusTrace) {
|
|
1203
|
-
return repeatIOChunkMaybe_1(tsplus_module_1.
|
|
1204
|
-
if (down &&
|
|
1205
|
-
return
|
|
1282
|
+
return repeatIOChunkMaybe_1(tsplus_module_1.catchAllCause(c => tsplus_module_1.flatMap(down => {
|
|
1283
|
+
if (down && tsplus_module_22.interrupted(c)) {
|
|
1284
|
+
return tsplus_module_48.end;
|
|
1206
1285
|
} else {
|
|
1207
|
-
return
|
|
1286
|
+
return tsplus_module_48.failCause(c);
|
|
1208
1287
|
}
|
|
1209
|
-
}, __tsplusTrace), __tsplusTrace), __tsplusTrace);
|
|
1288
|
+
}, __tsplusTrace)(queue.isShutdown), __tsplusTrace)(tsplus_module_1.map(tsplus_module_16.from, __tsplusTrace)(queue.takeBetween(1, maxChunkSize, __tsplusTrace))), __tsplusTrace);
|
|
1210
1289
|
}
|
|
1211
1290
|
/**
|
|
1212
1291
|
* @tsplus static fncts.io.StreamOps fromQueueWithShutdown
|
|
@@ -1214,7 +1293,22 @@ function fromQueue_1(queue, maxChunkSize = DEFAULT_CHUNK_SIZE, __tsplusTrace) {
|
|
|
1214
1293
|
|
|
1215
1294
|
|
|
1216
1295
|
function fromQueueWithShutdown_1(queue, maxChunkSize = DEFAULT_CHUNK_SIZE, __tsplusTrace) {
|
|
1217
|
-
return ensuring_1(
|
|
1296
|
+
return ensuring_1(queue.shutdown, __tsplusTrace)(fromQueue_1(queue, maxChunkSize, __tsplusTrace));
|
|
1297
|
+
}
|
|
1298
|
+
/**
|
|
1299
|
+
* @tsplus static fncts.io.StreamOps fromHub
|
|
1300
|
+
*/
|
|
1301
|
+
|
|
1302
|
+
|
|
1303
|
+
export function fromHub(hub, maxChunkSize = DEFAULT_CHUNK_SIZE, __tsplusTrace) {
|
|
1304
|
+
return flatMap_1(queue => fromQueueWithShutdown_1(queue, maxChunkSize, __tsplusTrace), __tsplusTrace)(scoped_1(() => hub().subscribe, __tsplusTrace));
|
|
1305
|
+
}
|
|
1306
|
+
/**
|
|
1307
|
+
* @tsplus static fncts.io.StreamOps fromHubScoped
|
|
1308
|
+
*/
|
|
1309
|
+
|
|
1310
|
+
export function fromHubScoped(hub, maxChunkSize = DEFAULT_CHUNK_SIZE, __tsplusTrace) {
|
|
1311
|
+
return tsplus_module_1.defer(() => tsplus_module_1.map(queue => fromQueueWithShutdown_1(queue, maxChunkSize, __tsplusTrace), __tsplusTrace)(hub().subscribe), __tsplusTrace);
|
|
1218
1312
|
}
|
|
1219
1313
|
/**
|
|
1220
1314
|
* Halt a stream with the specified exception
|
|
@@ -1222,7 +1316,6 @@ function fromQueueWithShutdown_1(queue, maxChunkSize = DEFAULT_CHUNK_SIZE, __tsp
|
|
|
1222
1316
|
* @tsplus static fncts.io.StreamOps haltNow
|
|
1223
1317
|
*/
|
|
1224
1318
|
|
|
1225
|
-
|
|
1226
1319
|
export function haltNow(u, __tsplusTrace) {
|
|
1227
1320
|
return new Stream(tsplus_module_10.halt(() => u));
|
|
1228
1321
|
}
|
|
@@ -1237,7 +1330,7 @@ function halt_1(u, __tsplusTrace) {
|
|
|
1237
1330
|
}
|
|
1238
1331
|
|
|
1239
1332
|
function haltWhenWriter(fiber, __tsplusTrace) {
|
|
1240
|
-
return tsplus_module_10.unwrap(() => tsplus_module_1.
|
|
1333
|
+
return tsplus_module_10.unwrap(() => tsplus_module_1.map(maybeExit => tsplus_module_17.match(() => tsplus_module_10.readWith(i => tsplus_module_11.apSecond(haltWhenWriter(fiber, __tsplusTrace))(tsplus_module_10.writeNow(i)), tsplus_module_10.failNow, () => tsplus_module_10.unit), exit => tsplus_module_30.match(tsplus_module_11.failCauseNow, () => tsplus_module_10.unit)(exit))(maybeExit), __tsplusTrace)(tsplus_module_44.poll(fiber, __tsplusTrace)));
|
|
1241
1334
|
}
|
|
1242
1335
|
/**
|
|
1243
1336
|
* Halts the evaluation of this stream when the provided IO completes. The
|
|
@@ -1249,39 +1342,45 @@ function haltWhenWriter(fiber, __tsplusTrace) {
|
|
|
1249
1342
|
*
|
|
1250
1343
|
* If the IO completes with a failure, the stream will emit that failure.
|
|
1251
1344
|
*
|
|
1252
|
-
* @tsplus
|
|
1345
|
+
* @tsplus pipeable fncts.io.Stream haltWhen
|
|
1253
1346
|
*/
|
|
1254
1347
|
|
|
1255
1348
|
|
|
1256
|
-
export function
|
|
1257
|
-
return
|
|
1349
|
+
export function haltWhen(io, __tsplusTrace) {
|
|
1350
|
+
return fa => {
|
|
1351
|
+
return new Stream(tsplus_module_10.unwrapScoped(() => tsplus_module_1.map(fiber => tsplus_module_10.pipeTo(haltWhenWriter(fiber, __tsplusTrace))(fa.channel), __tsplusTrace)(tsplus_module_14.forkScoped(io, __tsplusTrace))));
|
|
1352
|
+
};
|
|
1258
1353
|
}
|
|
1259
1354
|
|
|
1260
1355
|
function haltWhenFutureWriter(future, __tsplusTrace) {
|
|
1261
|
-
return tsplus_module_10.unwrap(() => tsplus_module_1.
|
|
1356
|
+
return tsplus_module_10.unwrap(() => tsplus_module_1.map(maybeIO => tsplus_module_17.match(() => tsplus_module_10.readWith(i => tsplus_module_11.apSecond(haltWhenFutureWriter(future, __tsplusTrace))(tsplus_module_10.writeNow(i)), tsplus_module_10.failNow, () => tsplus_module_10.unit), io => tsplus_module_10.unwrap(() => tsplus_module_1.match(tsplus_module_10.failNow, () => tsplus_module_10.unit, __tsplusTrace)(io)))(maybeIO), __tsplusTrace)(tsplus_module_31.poll(future, __tsplusTrace)));
|
|
1262
1357
|
}
|
|
1263
1358
|
/**
|
|
1264
1359
|
* Halts the evaluation of this stream when the provided promise resolves.
|
|
1265
1360
|
*
|
|
1266
1361
|
* If the promise completes with a failure, the stream will emit that failure.
|
|
1267
1362
|
*
|
|
1268
|
-
* @tsplus
|
|
1363
|
+
* @tsplus pipeable fncts.io.Stream haltWhen
|
|
1269
1364
|
*/
|
|
1270
1365
|
|
|
1271
1366
|
|
|
1272
|
-
export function
|
|
1273
|
-
return
|
|
1367
|
+
export function haltWhenFuture(future, __tsplusTrace) {
|
|
1368
|
+
return fa => {
|
|
1369
|
+
return new Stream(tsplus_module_10.pipeTo(haltWhenFutureWriter(future, __tsplusTrace))(fa.channel));
|
|
1370
|
+
};
|
|
1274
1371
|
}
|
|
1275
1372
|
/**
|
|
1276
|
-
* @tsplus
|
|
1373
|
+
* @tsplus pipeable fncts.io.Stream interleave
|
|
1277
1374
|
*/
|
|
1278
1375
|
|
|
1279
|
-
export function
|
|
1280
|
-
return
|
|
1376
|
+
export function interleave(sb, __tsplusTrace) {
|
|
1377
|
+
return sa => {
|
|
1378
|
+
return interleaveWith_1(sb, forever_1(fromChunk_1(() => tsplus_module_16.make(true, false), __tsplusTrace), __tsplusTrace), __tsplusTrace)(sa);
|
|
1379
|
+
};
|
|
1281
1380
|
}
|
|
1282
1381
|
|
|
1283
1382
|
function interleaveWithProducer(handoff, __tsplusTrace) {
|
|
1284
|
-
return tsplus_module_10.readWithCause(value => tsplus_module_11.
|
|
1383
|
+
return tsplus_module_10.readWithCause(value => tsplus_module_11.apSecond(interleaveWithProducer(handoff, __tsplusTrace))(tsplus_module_10.fromIO(() => tsplus_module_5.offer(tsplus_module_23.single(value))(handoff))), cause => tsplus_module_10.fromIO(() => tsplus_module_5.offer(tsplus_module_23.failCause(cause))(handoff)), () => tsplus_module_10.fromIO(() => tsplus_module_5.offer(tsplus_module_23.end)(handoff)));
|
|
1285
1384
|
}
|
|
1286
1385
|
/**
|
|
1287
1386
|
* Combines this stream and the specified stream deterministically using the
|
|
@@ -1291,33 +1390,35 @@ function interleaveWithProducer(handoff, __tsplusTrace) {
|
|
|
1291
1390
|
* `b`. If either this stream or the specified stream are exhausted further
|
|
1292
1391
|
* requests for values from that stream will be ignored.
|
|
1293
1392
|
*
|
|
1294
|
-
* @tsplus
|
|
1393
|
+
* @tsplus pipeable fncts.io.Stream interleaveWith
|
|
1295
1394
|
*/
|
|
1296
1395
|
|
|
1297
1396
|
|
|
1298
|
-
function interleaveWith_1(
|
|
1299
|
-
return
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1397
|
+
function interleaveWith_1(sb, b, __tsplusTrace) {
|
|
1398
|
+
return sa => {
|
|
1399
|
+
return new Stream(tsplus_module_10.unwrapScoped(() => tsplus_module_1.map(([left, right]) => {
|
|
1400
|
+
const process = (leftDone, rightDone) => tsplus_module_10.readWithCause(b => {
|
|
1401
|
+
if (b && !leftDone) {
|
|
1402
|
+
return tsplus_module_11.flatMap(take => tsplus_module_23.match(rightDone ? tsplus_module_10.unit : process(true, rightDone), tsplus_module_11.failCauseNow, chunk => tsplus_module_11.apSecond(process(leftDone, rightDone))(tsplus_module_10.writeNow(chunk)))(take))(tsplus_module_10.fromIO(() => tsplus_module_5.take(left)));
|
|
1403
|
+
}
|
|
1304
1404
|
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1405
|
+
if (!b && !rightDone) {
|
|
1406
|
+
return tsplus_module_11.flatMap(take => tsplus_module_23.match(leftDone ? tsplus_module_10.unit : process(leftDone, true), tsplus_module_11.failCauseNow, chunk => tsplus_module_11.apSecond(process(leftDone, rightDone))(tsplus_module_10.writeNow(chunk)))(take))(tsplus_module_10.fromIO(() => tsplus_module_5.take(right)));
|
|
1407
|
+
}
|
|
1308
1408
|
|
|
1309
|
-
|
|
1310
|
-
|
|
1409
|
+
return process(leftDone, rightDone);
|
|
1410
|
+
}, tsplus_module_11.failCauseNow, () => tsplus_module_10.unit);
|
|
1311
1411
|
|
|
1312
|
-
|
|
1313
|
-
|
|
1412
|
+
return tsplus_module_10.pipeTo(process(false, false))(tsplus_module_10.concatMap(tsplus_module_10.writeChunk)(b.channel));
|
|
1413
|
+
}, __tsplusTrace)(tsplus_module_1.flatMap(left => tsplus_module_1.flatMap(right => tsplus_module_1.flatMap(() => tsplus_module_1.map(() => tuple(left, right), __tsplusTrace)(tsplus_module_1.fork(tsplus_module_13.runScoped(tsplus_module_10.pipeTo(interleaveWithProducer(right, __tsplusTrace))(tsplus_module_10.concatMap(tsplus_module_10.writeChunk)(sb.channel))), __tsplusTrace)), __tsplusTrace)(tsplus_module_1.fork(tsplus_module_13.runScoped(tsplus_module_10.pipeTo(interleaveWithProducer(left, __tsplusTrace))(tsplus_module_10.concatMap(tsplus_module_10.writeChunk)(sa.channel))), __tsplusTrace)), __tsplusTrace)(tsplus_module_5.make()), __tsplusTrace)(tsplus_module_5.make()))));
|
|
1414
|
+
};
|
|
1314
1415
|
}
|
|
1315
1416
|
|
|
1316
1417
|
function intersperseWriter(middle, isFirst, __tsplusTrace) {
|
|
1317
1418
|
return tsplus_module_10.readWith(inp => {
|
|
1318
1419
|
const builder = tsplus_module_12.builder();
|
|
1319
1420
|
let flagResult = isFirst;
|
|
1320
|
-
tsplus_module_12.
|
|
1421
|
+
tsplus_module_12.forEach(a => {
|
|
1321
1422
|
if (flagResult) {
|
|
1322
1423
|
flagResult = false;
|
|
1323
1424
|
builder.append(a);
|
|
@@ -1325,8 +1426,8 @@ function intersperseWriter(middle, isFirst, __tsplusTrace) {
|
|
|
1325
1426
|
builder.append(middle);
|
|
1326
1427
|
builder.append(a);
|
|
1327
1428
|
}
|
|
1328
|
-
});
|
|
1329
|
-
return tsplus_module_11.
|
|
1429
|
+
})(inp);
|
|
1430
|
+
return tsplus_module_11.apSecond(intersperseWriter(middle, flagResult, __tsplusTrace))(tsplus_module_10.writeNow(builder.result()));
|
|
1330
1431
|
}, tsplus_module_10.failNow, () => tsplus_module_10.unit);
|
|
1331
1432
|
}
|
|
1332
1433
|
/**
|
|
@@ -1334,8 +1435,8 @@ function intersperseWriter(middle, isFirst, __tsplusTrace) {
|
|
|
1334
1435
|
*/
|
|
1335
1436
|
|
|
1336
1437
|
|
|
1337
|
-
export function
|
|
1338
|
-
return new Stream(tsplus_module_10.
|
|
1438
|
+
export function intersperse(stream, middle, __tsplusTrace) {
|
|
1439
|
+
return new Stream(tsplus_module_10.pipeTo(intersperseWriter(middle, true, __tsplusTrace))(stream.channel));
|
|
1339
1440
|
}
|
|
1340
1441
|
/**
|
|
1341
1442
|
* Interrupts the evaluation of this stream when the provided IO completes. The given
|
|
@@ -1345,44 +1446,52 @@ export function intersperse_(stream, middle, __tsplusTrace) {
|
|
|
1345
1446
|
* If the IO completes with a failure before the stream completes, the returned stream
|
|
1346
1447
|
* will emit that failure.
|
|
1347
1448
|
*
|
|
1348
|
-
* @tsplus
|
|
1449
|
+
* @tsplus pipeable fncts.io.Stream interruptWhen
|
|
1349
1450
|
*/
|
|
1350
1451
|
|
|
1351
|
-
export function
|
|
1352
|
-
return
|
|
1452
|
+
export function interruptWhen(io, __tsplusTrace) {
|
|
1453
|
+
return stream => {
|
|
1454
|
+
return new Stream(tsplus_module_49.interruptWhen(io)(stream.channel));
|
|
1455
|
+
};
|
|
1353
1456
|
}
|
|
1354
1457
|
/**
|
|
1355
|
-
* @tsplus
|
|
1458
|
+
* @tsplus pipeable fncts.io.Stream interruptWhen
|
|
1356
1459
|
*/
|
|
1357
1460
|
|
|
1358
|
-
export function
|
|
1359
|
-
return
|
|
1461
|
+
export function interruptWhenFuture(future, __tsplusTrace) {
|
|
1462
|
+
return fa => {
|
|
1463
|
+
return new Stream(tsplus_module_49.interruptWhenFuture(future)(fa.channel));
|
|
1464
|
+
};
|
|
1360
1465
|
}
|
|
1361
1466
|
/**
|
|
1362
1467
|
* Transforms the elements of this stream using the supplied function.
|
|
1363
1468
|
*
|
|
1364
|
-
* @tsplus
|
|
1469
|
+
* @tsplus pipeable fncts.io.Stream map
|
|
1365
1470
|
*/
|
|
1366
1471
|
|
|
1367
|
-
function map_1(
|
|
1368
|
-
return
|
|
1472
|
+
function map_1(f, __tsplusTrace) {
|
|
1473
|
+
return stream => {
|
|
1474
|
+
return new Stream(tsplus_module_10.mapOut(as => tsplus_module_12.map(f)(as))(stream.channel));
|
|
1475
|
+
};
|
|
1369
1476
|
}
|
|
1370
1477
|
|
|
1371
1478
|
function mapAccumAccumulator(currS, f, __tsplusTrace) {
|
|
1372
1479
|
return tsplus_module_10.readWith(inp => {
|
|
1373
|
-
const [nextS, bs] = tsplus_module_12.
|
|
1374
|
-
return tsplus_module_11.
|
|
1480
|
+
const [nextS, bs] = tsplus_module_12.mapAccum(currS, f)(inp);
|
|
1481
|
+
return tsplus_module_11.apSecond(mapAccumAccumulator(nextS, f, __tsplusTrace))(tsplus_module_10.writeNow(bs));
|
|
1375
1482
|
}, tsplus_module_10.failNow, () => tsplus_module_10.unit);
|
|
1376
1483
|
}
|
|
1377
1484
|
/**
|
|
1378
1485
|
* Statefully maps over the elements of this stream to produce new elements.
|
|
1379
1486
|
*
|
|
1380
|
-
* @tsplus
|
|
1487
|
+
* @tsplus pipeable fncts.io.Stream mapAccum
|
|
1381
1488
|
*/
|
|
1382
1489
|
|
|
1383
1490
|
|
|
1384
|
-
function mapAccum_1(
|
|
1385
|
-
return
|
|
1491
|
+
function mapAccum_1(s, f, __tsplusTrace) {
|
|
1492
|
+
return stream => {
|
|
1493
|
+
return new Stream(tsplus_module_10.pipeTo(mapAccumAccumulator(s, f, __tsplusTrace))(stream.channel));
|
|
1494
|
+
};
|
|
1386
1495
|
}
|
|
1387
1496
|
|
|
1388
1497
|
function mapAccumIOAccumulator(s, f, __tsplusTrace) {
|
|
@@ -1393,111 +1502,131 @@ function mapAccumIOAccumulator(s, f, __tsplusTrace) {
|
|
|
1393
1502
|
outputChunk.append(b);
|
|
1394
1503
|
}, __tsplusTrace);
|
|
1395
1504
|
|
|
1396
|
-
return tsplus_module_1.
|
|
1505
|
+
return tsplus_module_1.match(e => {
|
|
1397
1506
|
const partialResult = outputChunk.result();
|
|
1398
|
-
return tsplus_module_12.isNonEmpty(partialResult) ? tsplus_module_11.
|
|
1399
|
-
}, s => tsplus_module_11.
|
|
1507
|
+
return tsplus_module_12.isNonEmpty(partialResult) ? tsplus_module_11.apSecond(tsplus_module_10.failNow(e))(tsplus_module_10.writeNow(partialResult)) : tsplus_module_10.failNow(e);
|
|
1508
|
+
}, s => tsplus_module_11.apSecond(mapAccumIOAccumulator(s, f, __tsplusTrace))(tsplus_module_10.writeNow(outputChunk.result())), __tsplusTrace)(tsplus_module_1.foldLeft(inp, s, (s1, a) => tsplus_module_1.flatMap(([b, s2]) => tsplus_module_1.as(() => s2, __tsplusTrace)(emit(b)), __tsplusTrace)(f(s1, a)), __tsplusTrace));
|
|
1400
1509
|
}, __tsplusTrace)), tsplus_module_10.failNow, () => tsplus_module_10.unit);
|
|
1401
1510
|
}
|
|
1402
1511
|
/**
|
|
1403
1512
|
* Statefully and effectfully maps over the elements of this stream to produce
|
|
1404
1513
|
* new elements.
|
|
1405
1514
|
*
|
|
1406
|
-
* @tsplus
|
|
1515
|
+
* @tsplus pipeable fncts.io.Stream mapAccumIO
|
|
1407
1516
|
*/
|
|
1408
1517
|
|
|
1409
1518
|
|
|
1410
|
-
function mapAccumIO_1(
|
|
1411
|
-
return
|
|
1519
|
+
function mapAccumIO_1(s, f, __tsplusTrace) {
|
|
1520
|
+
return stream => {
|
|
1521
|
+
return new Stream(tsplus_module_10.pipeTo(mapAccumIOAccumulator(s, f, __tsplusTrace))(stream.channel));
|
|
1522
|
+
};
|
|
1412
1523
|
}
|
|
1413
1524
|
/**
|
|
1414
1525
|
* Transforms the chunks emitted by this stream.
|
|
1415
1526
|
*
|
|
1416
|
-
* @tsplus
|
|
1527
|
+
* @tsplus pipeable fncts.io.Stream mapChunks
|
|
1417
1528
|
*/
|
|
1418
1529
|
|
|
1419
1530
|
|
|
1420
|
-
function mapChunks_1(
|
|
1421
|
-
return
|
|
1531
|
+
function mapChunks_1(f, __tsplusTrace) {
|
|
1532
|
+
return stream => {
|
|
1533
|
+
return new Stream(tsplus_module_10.mapOut(f)(stream.channel));
|
|
1534
|
+
};
|
|
1422
1535
|
}
|
|
1423
1536
|
/**
|
|
1424
1537
|
* Effectfully transforms the chunks emitted by this stream.
|
|
1425
1538
|
*
|
|
1426
|
-
* @tsplus
|
|
1539
|
+
* @tsplus pipeable fncts.io.Stream mapChunksIO
|
|
1427
1540
|
*/
|
|
1428
1541
|
|
|
1429
1542
|
|
|
1430
|
-
export function
|
|
1431
|
-
return
|
|
1543
|
+
export function mapChunksIO(f, __tsplusTrace) {
|
|
1544
|
+
return stream => {
|
|
1545
|
+
return new Stream(tsplus_module_10.mapOutIO_(f)(stream.channel));
|
|
1546
|
+
};
|
|
1432
1547
|
}
|
|
1433
1548
|
/**
|
|
1434
1549
|
* Maps each element to an iterable, and flattens the iterables into the
|
|
1435
1550
|
* output of this stream.
|
|
1436
1551
|
*
|
|
1437
|
-
* @tsplus
|
|
1552
|
+
* @tsplus pipeable fncts.io.Stream mapConcat
|
|
1438
1553
|
*/
|
|
1439
1554
|
|
|
1440
|
-
export function
|
|
1441
|
-
return
|
|
1555
|
+
export function mapConcat(f, __tsplusTrace) {
|
|
1556
|
+
return stream => {
|
|
1557
|
+
return mapConcatChunk_1(a => tsplus_module_16.from(f(a)), __tsplusTrace)(stream);
|
|
1558
|
+
};
|
|
1442
1559
|
}
|
|
1443
1560
|
/**
|
|
1444
1561
|
* Maps each element to a chunk, and flattens the chunks into the output of
|
|
1445
1562
|
* this stream.
|
|
1446
1563
|
*
|
|
1447
|
-
* @tsplus
|
|
1564
|
+
* @tsplus pipeable fncts.io.Stream mapConcatChunk
|
|
1448
1565
|
*/
|
|
1449
1566
|
|
|
1450
|
-
function mapConcatChunk_1(
|
|
1451
|
-
return
|
|
1567
|
+
function mapConcatChunk_1(f, __tsplusTrace) {
|
|
1568
|
+
return stream => {
|
|
1569
|
+
return mapChunks_1(c => tsplus_module_12.flatMap(f)(c), __tsplusTrace)(stream);
|
|
1570
|
+
};
|
|
1452
1571
|
}
|
|
1453
1572
|
/**
|
|
1454
1573
|
* Effectfully maps each element to a chunk, and flattens the chunks into
|
|
1455
1574
|
* the output of this stream.
|
|
1456
1575
|
*
|
|
1457
|
-
* @tsplus
|
|
1576
|
+
* @tsplus pipeable fncts.io.Stream mapConcatChunkIO
|
|
1458
1577
|
*/
|
|
1459
1578
|
|
|
1460
1579
|
|
|
1461
|
-
export function
|
|
1462
|
-
return
|
|
1580
|
+
export function mapConcatChunkIO(f, __tsplusTrace) {
|
|
1581
|
+
return stream => {
|
|
1582
|
+
return mapConcatChunk_1(identity, __tsplusTrace)(mapIO_1(f, __tsplusTrace)(stream));
|
|
1583
|
+
};
|
|
1463
1584
|
}
|
|
1464
1585
|
/**
|
|
1465
1586
|
* Effectfully maps each element to an iterable, and flattens the iterables into
|
|
1466
1587
|
* the output of this stream.
|
|
1467
1588
|
*
|
|
1468
|
-
* @tsplus
|
|
1589
|
+
* @tsplus pipeable fncts.io.Stream mapConcatIO
|
|
1469
1590
|
*/
|
|
1470
1591
|
|
|
1471
|
-
export function
|
|
1472
|
-
return
|
|
1592
|
+
export function mapConcatIO(f, __tsplusTrace) {
|
|
1593
|
+
return stream => {
|
|
1594
|
+
return mapConcatChunk_1(identity, __tsplusTrace)(mapIO_1(a => tsplus_module_1.map(tsplus_module_16.from, __tsplusTrace)(f(a)), __tsplusTrace)(stream));
|
|
1595
|
+
};
|
|
1473
1596
|
}
|
|
1474
1597
|
/**
|
|
1475
1598
|
* Transforms the errors emitted by this stream using `f`.
|
|
1476
1599
|
*
|
|
1477
|
-
* @tsplus
|
|
1600
|
+
* @tsplus pipeable fncts.io.Stream mapError
|
|
1478
1601
|
*/
|
|
1479
1602
|
|
|
1480
|
-
function mapError_1(
|
|
1481
|
-
return
|
|
1603
|
+
function mapError_1(f, __tsplusTrace) {
|
|
1604
|
+
return stream => {
|
|
1605
|
+
return new Stream(tsplus_module_10.mapError(f)(stream.channel));
|
|
1606
|
+
};
|
|
1482
1607
|
}
|
|
1483
1608
|
/**
|
|
1484
1609
|
* Transforms the full causes of failures emitted by this stream.
|
|
1485
1610
|
*
|
|
1486
|
-
* @tsplus
|
|
1611
|
+
* @tsplus pipeable fncts.io.Stream mapErrorCause
|
|
1487
1612
|
*/
|
|
1488
1613
|
|
|
1489
1614
|
|
|
1490
|
-
export function
|
|
1491
|
-
return
|
|
1615
|
+
export function mapErrorCause(f, __tsplusTrace) {
|
|
1616
|
+
return fa => {
|
|
1617
|
+
return new Stream(tsplus_module_10.mapErrorCause(f)(fa.channel));
|
|
1618
|
+
};
|
|
1492
1619
|
}
|
|
1493
1620
|
/**
|
|
1494
1621
|
* Maps over elements of the stream with the specified effectful function.
|
|
1495
1622
|
*
|
|
1496
|
-
* @tsplus
|
|
1623
|
+
* @tsplus pipeable fncts.io.Stream mapIO
|
|
1497
1624
|
*/
|
|
1498
1625
|
|
|
1499
|
-
function mapIO_1(
|
|
1500
|
-
return
|
|
1626
|
+
function mapIO_1(f, __tsplusTrace) {
|
|
1627
|
+
return stream => {
|
|
1628
|
+
return new Stream(tsplus_module_10.pipeTo(mapIOLoop(tsplus_module_34.empty()[Symbol.iterator](), f, __tsplusTrace))(stream.channel));
|
|
1629
|
+
};
|
|
1501
1630
|
}
|
|
1502
1631
|
|
|
1503
1632
|
function mapIOLoop(iterator, f, __tsplusTrace) {
|
|
@@ -1506,7 +1635,7 @@ function mapIOLoop(iterator, f, __tsplusTrace) {
|
|
|
1506
1635
|
if (next.done) {
|
|
1507
1636
|
return tsplus_module_10.readWithCause(elem => mapIOLoop(elem[Symbol.iterator](), f, __tsplusTrace), tsplus_module_11.failCauseNow, tsplus_module_11.succeedNow);
|
|
1508
1637
|
} else {
|
|
1509
|
-
return tsplus_module_10.unwrap(() => tsplus_module_1.
|
|
1638
|
+
return tsplus_module_10.unwrap(() => tsplus_module_1.map(b => tsplus_module_11.apSecond(mapIOLoop(iterator, f, __tsplusTrace))(tsplus_module_10.writeNow(tsplus_module_16.single(b))), __tsplusTrace)(f(next.value)));
|
|
1510
1639
|
}
|
|
1511
1640
|
}
|
|
1512
1641
|
/**
|
|
@@ -1516,12 +1645,14 @@ function mapIOLoop(iterator, f, __tsplusTrace) {
|
|
|
1516
1645
|
*
|
|
1517
1646
|
* @note This combinator destroys the chunking structure. It's recommended to use chunkN afterwards.
|
|
1518
1647
|
*
|
|
1519
|
-
* @tsplus
|
|
1648
|
+
* @tsplus pipeable fncts.io.Stream mapIOC
|
|
1520
1649
|
*/
|
|
1521
1650
|
|
|
1522
1651
|
|
|
1523
|
-
export function
|
|
1524
|
-
return
|
|
1652
|
+
export function mapIOC(n, f, __tsplusTrace) {
|
|
1653
|
+
return stream => {
|
|
1654
|
+
return new Stream(tsplus_module_10.mapOut(tsplus_module_16.single)(tsplus_module_50.mapOutIOC(n, f)(tsplus_module_10.concatMap(tsplus_module_10.writeChunk)(stream.channel))));
|
|
1655
|
+
};
|
|
1525
1656
|
}
|
|
1526
1657
|
/**
|
|
1527
1658
|
* Maps each element of this stream to another stream and returns the
|
|
@@ -1529,87 +1660,103 @@ export function mapIOC_(stream, n, f, __tsplusTrace) {
|
|
|
1529
1660
|
* concurrently. Up to `bufferSize` elements of the produced streams may be
|
|
1530
1661
|
* buffered in memory by this operator.
|
|
1531
1662
|
*
|
|
1532
|
-
* @tsplus
|
|
1663
|
+
* @tsplus pipeable fncts.io.Stream mergeMap
|
|
1533
1664
|
*/
|
|
1534
1665
|
|
|
1535
|
-
function mergeMap_1(
|
|
1536
|
-
return
|
|
1666
|
+
function mergeMap_1(f, n, bufferSize = 16, __tsplusTrace) {
|
|
1667
|
+
return ma => {
|
|
1668
|
+
return new Stream(tsplus_module_51.mergeMap(a => f(a).channel, n, bufferSize)(tsplus_module_10.concatMap(tsplus_module_10.writeChunk)(ma.channel)));
|
|
1669
|
+
};
|
|
1537
1670
|
}
|
|
1538
1671
|
/**
|
|
1539
1672
|
* Maps over elements of the stream with the specified effectful function,
|
|
1540
1673
|
* executing up to `n` invocations of `f` concurrently. The element order
|
|
1541
1674
|
* is not enforced by this combinator, and elements may be reordered.
|
|
1542
1675
|
*
|
|
1543
|
-
* @tsplus
|
|
1676
|
+
* @tsplus pipeable fncts.io.Stream mergeMapIO
|
|
1544
1677
|
*/
|
|
1545
1678
|
|
|
1546
1679
|
|
|
1547
|
-
export function
|
|
1548
|
-
return
|
|
1680
|
+
export function mergeMapIO(f, n, bufferSize = 16, __tsplusTrace) {
|
|
1681
|
+
return stream => {
|
|
1682
|
+
return mergeMap_1(a => fromIO_1(f(a), __tsplusTrace), n, bufferSize, __tsplusTrace)(stream);
|
|
1683
|
+
};
|
|
1549
1684
|
}
|
|
1550
1685
|
/**
|
|
1551
|
-
* @tsplus
|
|
1686
|
+
* @tsplus pipeable fncts.io.Stream mergeEither
|
|
1552
1687
|
*/
|
|
1553
1688
|
|
|
1554
|
-
function mergeEither_1(
|
|
1555
|
-
return
|
|
1689
|
+
function mergeEither_1(fb, __tsplusTrace) {
|
|
1690
|
+
return fa => {
|
|
1691
|
+
return mergeWith_1(fb, tsplus_module_15.left, tsplus_module_15.right)(fa);
|
|
1692
|
+
};
|
|
1556
1693
|
}
|
|
1557
1694
|
|
|
1558
1695
|
export function mergeWithHandler(terminate, __tsplusTrace) {
|
|
1559
|
-
return exit => terminate || !
|
|
1696
|
+
return exit => terminate || !tsplus_module_47.isSuccess(exit) ? tsplus_module_52.done(tsplus_module_1.fromExitNow(exit, __tsplusTrace)) : tsplus_module_52.wait(tsplus_module_1.fromExitNow);
|
|
1560
1697
|
}
|
|
1561
1698
|
/**
|
|
1562
|
-
* @tsplus
|
|
1699
|
+
* @tsplus pipeable fncts.io.Stream mergeWith
|
|
1563
1700
|
*/
|
|
1564
1701
|
|
|
1565
|
-
function mergeWith_1(
|
|
1566
|
-
return
|
|
1702
|
+
function mergeWith_1(sb, l, r, strategy = "Both", __tsplusTrace) {
|
|
1703
|
+
return sa => {
|
|
1704
|
+
return new Stream(tsplus_module_53.mergeWith(map_1(r, __tsplusTrace)(sb).channel, mergeWithHandler(strategy === "Either" || strategy === "Left", __tsplusTrace), mergeWithHandler(strategy === "Either" || strategy === "Right", __tsplusTrace))(map_1(l, __tsplusTrace)(sa).channel));
|
|
1705
|
+
};
|
|
1567
1706
|
}
|
|
1568
1707
|
/**
|
|
1569
1708
|
* Runs the specified effect if this stream fails, providing the error to the effect if it exists.
|
|
1570
1709
|
*
|
|
1571
1710
|
* Note: Unlike `IO.onError`, there is no guarantee that the provided effect will not be interrupted.
|
|
1572
1711
|
*
|
|
1573
|
-
* @tsplus
|
|
1712
|
+
* @tsplus pipeable fncts.io.Stream onError
|
|
1574
1713
|
*/
|
|
1575
1714
|
|
|
1576
1715
|
|
|
1577
|
-
export function
|
|
1578
|
-
return
|
|
1716
|
+
export function onError(cleanup, __tsplusTrace) {
|
|
1717
|
+
return stream => {
|
|
1718
|
+
return catchAllCause_1(cause => fromIO_1(tsplus_module_1.apSecond(tsplus_module_1.failCauseNow(cause, __tsplusTrace), __tsplusTrace)(cleanup(cause)), __tsplusTrace), __tsplusTrace)(stream);
|
|
1719
|
+
};
|
|
1579
1720
|
}
|
|
1580
1721
|
/**
|
|
1581
1722
|
* Switches to the provided stream in case this one fails with a typed error.
|
|
1582
1723
|
*
|
|
1583
1724
|
* See also Stream#catchAll
|
|
1584
1725
|
*
|
|
1585
|
-
* @tsplus
|
|
1726
|
+
* @tsplus pipeable fncts.io.Stream orElse
|
|
1586
1727
|
*/
|
|
1587
1728
|
|
|
1588
|
-
function orElse_1(
|
|
1589
|
-
return
|
|
1729
|
+
function orElse_1(that, __tsplusTrace) {
|
|
1730
|
+
return stream => {
|
|
1731
|
+
return new Stream(tsplus_module_10.orElse(that().channel)(stream.channel));
|
|
1732
|
+
};
|
|
1590
1733
|
}
|
|
1591
1734
|
/**
|
|
1592
1735
|
* Switches to the provided stream in case this one fails with a typed error.
|
|
1593
1736
|
*
|
|
1594
1737
|
* See also ZStream#catchAll
|
|
1595
1738
|
*
|
|
1596
|
-
* @tsplus
|
|
1739
|
+
* @tsplus pipeable fncts.io.Stream orElseEither
|
|
1597
1740
|
*/
|
|
1598
1741
|
|
|
1599
1742
|
|
|
1600
|
-
export function
|
|
1601
|
-
return
|
|
1743
|
+
export function orElseEither(that, __tsplusTrace) {
|
|
1744
|
+
return stream => {
|
|
1745
|
+
return orElse_1(() => map_1(tsplus_module_15.right, __tsplusTrace)(that()), __tsplusTrace)(map_1(tsplus_module_15.left, __tsplusTrace)(stream));
|
|
1746
|
+
};
|
|
1602
1747
|
}
|
|
1603
1748
|
/**
|
|
1604
1749
|
* Fails with given error in case this one fails with a typed error.
|
|
1605
1750
|
*
|
|
1606
1751
|
* See also Stream#catchAll
|
|
1607
1752
|
*
|
|
1608
|
-
* @tsplus
|
|
1753
|
+
* @tsplus pipeable fncts.io.Stream orElseFail
|
|
1609
1754
|
*/
|
|
1610
1755
|
|
|
1611
|
-
export function
|
|
1612
|
-
return
|
|
1756
|
+
export function orElseFail(e, __tsplusTrace) {
|
|
1757
|
+
return stream => {
|
|
1758
|
+
return orElse_1(() => failNow_1(e(), __tsplusTrace), __tsplusTrace)(stream);
|
|
1759
|
+
};
|
|
1613
1760
|
}
|
|
1614
1761
|
/**
|
|
1615
1762
|
* Switches to the provided stream in case this one fails with the `None` value.
|
|
@@ -1617,52 +1764,62 @@ export function orElseFail_(stream, e, __tsplusTrace) {
|
|
|
1617
1764
|
* See also Stream#catchAll.
|
|
1618
1765
|
*/
|
|
1619
1766
|
|
|
1620
|
-
export function
|
|
1621
|
-
return catchAll_1(
|
|
1767
|
+
export function orElseOptional(stream, that, __tsplusTrace) {
|
|
1768
|
+
return catchAll_1(maybeError => tsplus_module_17.match(() => that(), e => failNow_1(tsplus_module_3.just(e), __tsplusTrace))(maybeError), __tsplusTrace)(stream);
|
|
1622
1769
|
}
|
|
1623
1770
|
/**
|
|
1624
1771
|
* Succeeds with the specified value if this one fails with a typed error.
|
|
1625
1772
|
*
|
|
1626
|
-
* @tsplus
|
|
1773
|
+
* @tsplus pipeable fncts.io.Stream orElseSucceed
|
|
1627
1774
|
*/
|
|
1628
1775
|
|
|
1629
|
-
export function
|
|
1630
|
-
return
|
|
1776
|
+
export function orElseSucceed(a, __tsplusTrace) {
|
|
1777
|
+
return stream => {
|
|
1778
|
+
return orElse_1(() => succeedNow_1(a(), __tsplusTrace), __tsplusTrace)(stream);
|
|
1779
|
+
};
|
|
1631
1780
|
}
|
|
1632
1781
|
/**
|
|
1633
|
-
* @tsplus
|
|
1782
|
+
* @tsplus pipeable fncts.io.Stream pipeThrough
|
|
1634
1783
|
*/
|
|
1635
1784
|
|
|
1636
|
-
function pipeThrough_1(
|
|
1637
|
-
return
|
|
1785
|
+
function pipeThrough_1(sa, __tsplusTrace) {
|
|
1786
|
+
return ma => {
|
|
1787
|
+
return new Stream(tsplus_module_10.pipeToOrFail(sa.channel)(ma.channel));
|
|
1788
|
+
};
|
|
1638
1789
|
}
|
|
1639
1790
|
/**
|
|
1640
1791
|
* Provides the stream with its required environment, which eliminates
|
|
1641
1792
|
* its dependency on `R`.
|
|
1642
1793
|
*
|
|
1643
|
-
* @tsplus
|
|
1794
|
+
* @tsplus pipeable fncts.io.Stream provideEnvironment
|
|
1644
1795
|
*/
|
|
1645
1796
|
|
|
1646
1797
|
|
|
1647
|
-
function provideEnvironment_1(
|
|
1648
|
-
return
|
|
1798
|
+
function provideEnvironment_1(r, __tsplusTrace) {
|
|
1799
|
+
return ra => {
|
|
1800
|
+
return new Stream(tsplus_module_10.provideEnvironment(() => r)(ra.channel));
|
|
1801
|
+
};
|
|
1649
1802
|
}
|
|
1650
1803
|
/**
|
|
1651
|
-
* @tsplus
|
|
1804
|
+
* @tsplus pipeable fncts.io.Stream provideLayer
|
|
1652
1805
|
*/
|
|
1653
1806
|
|
|
1654
1807
|
|
|
1655
|
-
function provideLayer_1(
|
|
1656
|
-
return
|
|
1808
|
+
function provideLayer_1(layer, __tsplusTrace) {
|
|
1809
|
+
return self => {
|
|
1810
|
+
return new Stream(tsplus_module_10.unwrapScoped(() => tsplus_module_1.map(r => tsplus_module_10.provideEnvironment(() => r)(self.channel), __tsplusTrace)(tsplus_module_54.build(layer, __tsplusTrace))));
|
|
1811
|
+
};
|
|
1657
1812
|
}
|
|
1658
1813
|
/**
|
|
1659
|
-
* @tsplus
|
|
1814
|
+
* @tsplus pipeable fncts.io.Stream provideSomeLayer
|
|
1660
1815
|
*/
|
|
1661
1816
|
|
|
1662
1817
|
|
|
1663
|
-
export function
|
|
1664
|
-
|
|
1665
|
-
|
|
1818
|
+
export function provideSomeLayer(layer, __tsplusTrace) {
|
|
1819
|
+
return self => {
|
|
1820
|
+
// @ts-expect-error
|
|
1821
|
+
return provideLayer_1(tsplus_module_55.and(layer, __tsplusTrace)(tsplus_module_55.environment(__tsplusTrace)), __tsplusTrace)(self);
|
|
1822
|
+
};
|
|
1666
1823
|
}
|
|
1667
1824
|
|
|
1668
1825
|
class Rechunker {
|
|
@@ -1680,7 +1837,7 @@ class Rechunker {
|
|
|
1680
1837
|
const result = this.builder;
|
|
1681
1838
|
this.builder = [];
|
|
1682
1839
|
this.pos = 0;
|
|
1683
|
-
return
|
|
1840
|
+
return tsplus_module_16.from(result);
|
|
1684
1841
|
}
|
|
1685
1842
|
|
|
1686
1843
|
return null;
|
|
@@ -1688,7 +1845,7 @@ class Rechunker {
|
|
|
1688
1845
|
|
|
1689
1846
|
emitOfNotEmpty() {
|
|
1690
1847
|
if (this.pos !== 0) {
|
|
1691
|
-
return tsplus_module_10.writeNow(
|
|
1848
|
+
return tsplus_module_10.writeNow(tsplus_module_16.from(this.builder));
|
|
1692
1849
|
} else {
|
|
1693
1850
|
return tsplus_module_10.unit;
|
|
1694
1851
|
}
|
|
@@ -1703,7 +1860,7 @@ class Rechunker {
|
|
|
1703
1860
|
function rechunkProcess(rechunker, target, __tsplusTrace) {
|
|
1704
1861
|
return tsplus_module_10.readWithCause(chunk => {
|
|
1705
1862
|
if (chunk.length === target && rechunker.isEmpty) {
|
|
1706
|
-
return tsplus_module_11.
|
|
1863
|
+
return tsplus_module_11.apSecond(rechunkProcess(rechunker, target, __tsplusTrace))(tsplus_module_10.writeNow(chunk));
|
|
1707
1864
|
} else if (chunk.length > 0) {
|
|
1708
1865
|
const chunks = [];
|
|
1709
1866
|
let result = null;
|
|
@@ -1711,7 +1868,7 @@ function rechunkProcess(rechunker, target, __tsplusTrace) {
|
|
|
1711
1868
|
|
|
1712
1869
|
while (i < chunk.length) {
|
|
1713
1870
|
while (i < chunk.length && result === null) {
|
|
1714
|
-
result = rechunker.write(tsplus_module_12.
|
|
1871
|
+
result = rechunker.write(tsplus_module_12.unsafeGet(i)(chunk));
|
|
1715
1872
|
i += 1;
|
|
1716
1873
|
}
|
|
1717
1874
|
|
|
@@ -1721,23 +1878,25 @@ function rechunkProcess(rechunker, target, __tsplusTrace) {
|
|
|
1721
1878
|
}
|
|
1722
1879
|
}
|
|
1723
1880
|
|
|
1724
|
-
return tsplus_module_11.
|
|
1881
|
+
return tsplus_module_11.apSecond(rechunkProcess(rechunker, target, __tsplusTrace))(tsplus_module_10.writeAll(chunks));
|
|
1725
1882
|
} else {
|
|
1726
1883
|
return rechunkProcess(rechunker, target, __tsplusTrace);
|
|
1727
1884
|
}
|
|
1728
|
-
}, cause => tsplus_module_11.
|
|
1885
|
+
}, cause => tsplus_module_11.apSecond(tsplus_module_11.failCauseNow(cause))(rechunker.emitOfNotEmpty()), () => rechunker.emitOfNotEmpty());
|
|
1729
1886
|
}
|
|
1730
1887
|
/**
|
|
1731
1888
|
* Re-chunks the elements of the stream into chunks of
|
|
1732
1889
|
* `n` elements each.
|
|
1733
1890
|
* The last chunk might contain less than `n` elements
|
|
1734
1891
|
*
|
|
1735
|
-
* @tsplus
|
|
1892
|
+
* @tsplus pipeable fncts.io.Stream rechunk
|
|
1736
1893
|
*/
|
|
1737
1894
|
|
|
1738
1895
|
|
|
1739
|
-
export function
|
|
1740
|
-
return
|
|
1896
|
+
export function rechunk(n, __tsplusTrace) {
|
|
1897
|
+
return stream => {
|
|
1898
|
+
return new Stream(tsplus_module_10.pipeTo(rechunkProcess(new Rechunker(n), n, __tsplusTrace))(stream.channel));
|
|
1899
|
+
};
|
|
1741
1900
|
}
|
|
1742
1901
|
/**
|
|
1743
1902
|
* Repeats the provided value infinitely.
|
|
@@ -1746,7 +1905,7 @@ export function rechunk_(stream, n, __tsplusTrace) {
|
|
|
1746
1905
|
*/
|
|
1747
1906
|
|
|
1748
1907
|
export function repeatValue(a, __tsplusTrace) {
|
|
1749
|
-
return new Stream(tsplus_module_10.repeated(tsplus_module_10.writeNow(
|
|
1908
|
+
return new Stream(tsplus_module_10.repeated(tsplus_module_10.writeNow(tsplus_module_16.single(a))));
|
|
1750
1909
|
}
|
|
1751
1910
|
/**
|
|
1752
1911
|
* Creates a stream from an effect producing a value of type `A` which repeats forever.
|
|
@@ -1755,7 +1914,7 @@ export function repeatValue(a, __tsplusTrace) {
|
|
|
1755
1914
|
*/
|
|
1756
1915
|
|
|
1757
1916
|
export function repeatIO(fa, __tsplusTrace) {
|
|
1758
|
-
return repeatIOMaybe_1(tsplus_module_1.
|
|
1917
|
+
return repeatIOMaybe_1(tsplus_module_1.mapError(tsplus_module_3.just, __tsplusTrace)(fa), __tsplusTrace);
|
|
1759
1918
|
}
|
|
1760
1919
|
/**
|
|
1761
1920
|
* Creates a stream from an effect producing values of type `A` until it fails with None.
|
|
@@ -1764,7 +1923,7 @@ export function repeatIO(fa, __tsplusTrace) {
|
|
|
1764
1923
|
*/
|
|
1765
1924
|
|
|
1766
1925
|
function repeatIOMaybe_1(fa, __tsplusTrace) {
|
|
1767
|
-
return repeatIOChunkMaybe_1(tsplus_module_1.
|
|
1926
|
+
return repeatIOChunkMaybe_1(tsplus_module_1.map(tsplus_module_16.single, __tsplusTrace)(fa), __tsplusTrace);
|
|
1768
1927
|
}
|
|
1769
1928
|
/**
|
|
1770
1929
|
* Creates a stream from an effect producing chunks of `A` values which repeats forever.
|
|
@@ -1774,7 +1933,7 @@ function repeatIOMaybe_1(fa, __tsplusTrace) {
|
|
|
1774
1933
|
|
|
1775
1934
|
|
|
1776
1935
|
export function repeatIOChunk(fa, __tsplusTrace) {
|
|
1777
|
-
return repeatIOChunkMaybe_1(tsplus_module_1.
|
|
1936
|
+
return repeatIOChunkMaybe_1(tsplus_module_1.mapError(tsplus_module_3.just, __tsplusTrace)(fa), __tsplusTrace);
|
|
1778
1937
|
}
|
|
1779
1938
|
/**
|
|
1780
1939
|
* Creates a stream from an effect producing chunks of `A` values until it fails with None.
|
|
@@ -1783,17 +1942,19 @@ export function repeatIOChunk(fa, __tsplusTrace) {
|
|
|
1783
1942
|
*/
|
|
1784
1943
|
|
|
1785
1944
|
function repeatIOChunkMaybe_1(fa, __tsplusTrace) {
|
|
1786
|
-
return unfoldChunkIO_1(undefined, _ => tsplus_module_1.
|
|
1945
|
+
return unfoldChunkIO_1(undefined, _ => tsplus_module_1.catchAll(maybeError => tsplus_module_17.match(() => tsplus_module_1.succeedNow(tsplus_module_3.nothing(), __tsplusTrace), tsplus_module_1.failNow)(maybeError), __tsplusTrace)(tsplus_module_1.map(chunk => tsplus_module_3.just(tuple(chunk, undefined)), __tsplusTrace)(fa)), __tsplusTrace);
|
|
1787
1946
|
}
|
|
1788
1947
|
/**
|
|
1789
1948
|
* Runs the sink on the stream to produce either the sink's result or an error.
|
|
1790
1949
|
*
|
|
1791
|
-
* @tsplus
|
|
1950
|
+
* @tsplus pipeable fncts.io.Stream run
|
|
1792
1951
|
*/
|
|
1793
1952
|
|
|
1794
1953
|
|
|
1795
|
-
function run_1(
|
|
1796
|
-
return
|
|
1954
|
+
function run_1(sink, __tsplusTrace) {
|
|
1955
|
+
return stream => {
|
|
1956
|
+
return tsplus_module_56.runDrain(tsplus_module_10.pipeToOrFail(sink.channel)(stream.channel));
|
|
1957
|
+
};
|
|
1797
1958
|
}
|
|
1798
1959
|
/**
|
|
1799
1960
|
* Runs the stream and collects all of its elements to a chunk.
|
|
@@ -1803,7 +1964,7 @@ function run_1(stream, sink, __tsplusTrace) {
|
|
|
1803
1964
|
|
|
1804
1965
|
|
|
1805
1966
|
export function runCollect(stream, __tsplusTrace) {
|
|
1806
|
-
return run_1(
|
|
1967
|
+
return run_1(tsplus_module_42.makeCollectAll(__tsplusTrace), __tsplusTrace)(stream);
|
|
1807
1968
|
}
|
|
1808
1969
|
/**
|
|
1809
1970
|
* Runs the stream and collects ignore its elements.
|
|
@@ -1812,101 +1973,119 @@ export function runCollect(stream, __tsplusTrace) {
|
|
|
1812
1973
|
*/
|
|
1813
1974
|
|
|
1814
1975
|
export function runDrain(stream, __tsplusTrace) {
|
|
1815
|
-
return run_1(
|
|
1976
|
+
return run_1(tsplus_module_42.drain, __tsplusTrace)(stream);
|
|
1816
1977
|
}
|
|
1817
1978
|
/**
|
|
1818
|
-
* @tsplus
|
|
1979
|
+
* @tsplus pipeable fncts.io.Stream runForeachScoped
|
|
1819
1980
|
*/
|
|
1820
1981
|
|
|
1821
|
-
function runForeachScoped_1(
|
|
1822
|
-
return
|
|
1982
|
+
function runForeachScoped_1(f, __tsplusTrace) {
|
|
1983
|
+
return self => {
|
|
1984
|
+
return runScoped_1(tsplus_module_42.makeForeach(f, __tsplusTrace), __tsplusTrace)(self);
|
|
1985
|
+
};
|
|
1823
1986
|
}
|
|
1824
1987
|
/**
|
|
1825
1988
|
* Like `into`, but provides the result as a `Managed` to allow for scope
|
|
1826
1989
|
* composition.
|
|
1827
1990
|
*
|
|
1828
|
-
* @tsplus
|
|
1991
|
+
* @tsplus pipeable fncts.io.Stream runIntoElementsScoped
|
|
1829
1992
|
*/
|
|
1830
1993
|
|
|
1831
1994
|
|
|
1832
|
-
function runIntoElementsScoped_1(
|
|
1833
|
-
|
|
1834
|
-
|
|
1995
|
+
function runIntoElementsScoped_1(queue, __tsplusTrace) {
|
|
1996
|
+
return stream => {
|
|
1997
|
+
const writer = tsplus_module_10.readWith(inp => tsplus_module_11.apSecond(writer)(tsplus_module_12.foldLeft(tsplus_module_10.unit, (channel, a) => tsplus_module_11.apSecond(tsplus_module_10.writeNow(tsplus_module_35.succeed(a)))(channel))(inp)), err => tsplus_module_10.writeNow(tsplus_module_35.fail(tsplus_module_3.just(err))), () => tsplus_module_10.writeNow(tsplus_module_35.fail(tsplus_module_3.nothing())));
|
|
1998
|
+
return tsplus_module_1.asUnit(tsplus_module_13.runScoped(tsplus_module_10.drain(tsplus_module_10.mapOutIO_(exit => queue.offer(exit, __tsplusTrace))(tsplus_module_10.pipeTo(writer)(stream.channel)))), __tsplusTrace);
|
|
1999
|
+
};
|
|
1835
2000
|
}
|
|
1836
2001
|
/**
|
|
1837
2002
|
* Like `Stream#into`, but provides the result as a `Managed` to allow for scope
|
|
1838
2003
|
* composition.
|
|
1839
2004
|
*
|
|
1840
|
-
* @tsplus
|
|
2005
|
+
* @tsplus pipeable fncts.io.Stream runIntoQueueScoped
|
|
1841
2006
|
*/
|
|
1842
2007
|
|
|
1843
2008
|
|
|
1844
|
-
function runIntoQueueScoped_1(
|
|
1845
|
-
|
|
1846
|
-
|
|
2009
|
+
function runIntoQueueScoped_1(queue, __tsplusTrace) {
|
|
2010
|
+
return stream => {
|
|
2011
|
+
const writer = tsplus_module_10.readWithCause(inp => tsplus_module_11.apSecond(writer)(tsplus_module_10.writeNow(tsplus_module_23.chunk(inp))), cause => tsplus_module_10.writeNow(tsplus_module_23.failCause(cause)), _ => tsplus_module_10.writeNow(tsplus_module_23.end));
|
|
2012
|
+
return tsplus_module_1.asUnit(tsplus_module_13.runScoped(tsplus_module_10.drain(tsplus_module_10.mapOutIO_(take => queue.offer(take, __tsplusTrace))(tsplus_module_10.pipeTo(writer)(stream.channel)))), __tsplusTrace);
|
|
2013
|
+
};
|
|
1847
2014
|
}
|
|
1848
2015
|
/**
|
|
1849
2016
|
* Like `Stream#runIntoHub`, but provides the result as a `Managed` to allow for scope
|
|
1850
2017
|
* composition.
|
|
1851
2018
|
*
|
|
1852
|
-
* @tsplus
|
|
2019
|
+
* @tsplus pipeable fncts.io.Stream runIntoHubScoped
|
|
1853
2020
|
*/
|
|
1854
2021
|
|
|
1855
2022
|
|
|
1856
|
-
function runIntoHubScoped_1(
|
|
1857
|
-
return
|
|
2023
|
+
function runIntoHubScoped_1(hub, __tsplusTrace) {
|
|
2024
|
+
return stream => {
|
|
2025
|
+
return runIntoQueueScoped_1(hub, __tsplusTrace)(stream);
|
|
2026
|
+
};
|
|
1858
2027
|
}
|
|
1859
2028
|
/**
|
|
1860
2029
|
* Runs the sink on the stream to produce either the sink's result or an error.
|
|
1861
2030
|
*
|
|
1862
|
-
* @tsplus
|
|
2031
|
+
* @tsplus pipeable fncts.io.Stream runScoped
|
|
1863
2032
|
*/
|
|
1864
2033
|
|
|
1865
2034
|
|
|
1866
|
-
function runScoped_1(
|
|
1867
|
-
return
|
|
2035
|
+
function runScoped_1(sink, __tsplusTrace) {
|
|
2036
|
+
return stream => {
|
|
2037
|
+
return tsplus_module_13.runScoped(tsplus_module_10.drain(tsplus_module_10.pipeToOrFail(sink.channel)(stream.channel)));
|
|
2038
|
+
};
|
|
1868
2039
|
}
|
|
1869
2040
|
/**
|
|
1870
2041
|
* Statefully maps over the elements of this stream to produce all intermediate results
|
|
1871
2042
|
* of type `B` given an initial B.
|
|
1872
2043
|
*
|
|
1873
|
-
* @tsplus
|
|
2044
|
+
* @tsplus pipeable fncts.io.Stream scan
|
|
1874
2045
|
*/
|
|
1875
2046
|
|
|
1876
2047
|
|
|
1877
|
-
export function
|
|
1878
|
-
return
|
|
2048
|
+
export function scan(b, f, __tsplusTrace) {
|
|
2049
|
+
return sa => {
|
|
2050
|
+
return scanIO_1(b, (b, a) => tsplus_module_1.succeedNow(f(b, a), __tsplusTrace), __tsplusTrace)(sa);
|
|
2051
|
+
};
|
|
1879
2052
|
}
|
|
1880
2053
|
/**
|
|
1881
2054
|
* Statefully and effectfully maps over the elements of this stream to produce all
|
|
1882
2055
|
* intermediate results of type `B` given an initial B.
|
|
1883
2056
|
*
|
|
1884
|
-
* @tsplus
|
|
2057
|
+
* @tsplus pipeable fncts.io.Stream scanIO
|
|
1885
2058
|
*/
|
|
1886
2059
|
|
|
1887
|
-
function scanIO_1(
|
|
1888
|
-
return
|
|
2060
|
+
function scanIO_1(b, f, __tsplusTrace) {
|
|
2061
|
+
return sa => {
|
|
2062
|
+
return concat_1(mapAccumIO_1(b, (b, a) => tsplus_module_1.map(b => [b, b], __tsplusTrace)(f(b, a)), __tsplusTrace)(sa), __tsplusTrace)(succeedNow_1(b, __tsplusTrace));
|
|
2063
|
+
};
|
|
1889
2064
|
}
|
|
1890
2065
|
/**
|
|
1891
2066
|
* Statefully maps over the elements of this stream to produce all
|
|
1892
2067
|
* intermediate results.
|
|
1893
2068
|
*
|
|
1894
|
-
* @tsplus
|
|
2069
|
+
* @tsplus pipeable fncts.io.Stream scanReduce
|
|
1895
2070
|
*/
|
|
1896
2071
|
|
|
1897
2072
|
|
|
1898
|
-
export function
|
|
1899
|
-
return
|
|
2073
|
+
export function scanReduce(f, __tsplusTrace) {
|
|
2074
|
+
return fa => {
|
|
2075
|
+
return scanReduceIO_1((b, a) => tsplus_module_1.succeedNow(f(b, a), __tsplusTrace), __tsplusTrace)(fa);
|
|
2076
|
+
};
|
|
1900
2077
|
}
|
|
1901
2078
|
/**
|
|
1902
2079
|
* Statefully and effectfully maps over the elements of this stream to produce
|
|
1903
2080
|
* all intermediate results.
|
|
1904
2081
|
*
|
|
1905
|
-
* @tsplus
|
|
2082
|
+
* @tsplus pipeable fncts.io.Stream scanReduceIO
|
|
1906
2083
|
*/
|
|
1907
2084
|
|
|
1908
|
-
function scanReduceIO_1(
|
|
1909
|
-
return
|
|
2085
|
+
function scanReduceIO_1(f, __tsplusTrace) {
|
|
2086
|
+
return fa => {
|
|
2087
|
+
return mapAccumIO_1(tsplus_module_3.nothing(), (s, a) => tsplus_module_17.match(() => tsplus_module_1.succeedNow([a, tsplus_module_3.just(a)], __tsplusTrace), b => tsplus_module_1.map(b => [b, tsplus_module_3.just(b)], __tsplusTrace)(f(b, a)))(s), __tsplusTrace)(fa);
|
|
2088
|
+
};
|
|
1910
2089
|
}
|
|
1911
2090
|
/**
|
|
1912
2091
|
* Creates a single-valued pure stream
|
|
@@ -1916,7 +2095,7 @@ function scanReduceIO_1(fa, f, __tsplusTrace) {
|
|
|
1916
2095
|
|
|
1917
2096
|
|
|
1918
2097
|
function succeedNow_1(o, __tsplusTrace) {
|
|
1919
|
-
return fromChunkNow_1(
|
|
2098
|
+
return fromChunkNow_1(tsplus_module_16.single(o), __tsplusTrace);
|
|
1920
2099
|
}
|
|
1921
2100
|
/**
|
|
1922
2101
|
* Creates a single-valued pure stream
|
|
@@ -1926,16 +2105,16 @@ function succeedNow_1(o, __tsplusTrace) {
|
|
|
1926
2105
|
|
|
1927
2106
|
|
|
1928
2107
|
export function succeed(a, __tsplusTrace) {
|
|
1929
|
-
return fromChunk_1(() =>
|
|
2108
|
+
return fromChunk_1(() => tsplus_module_16.single(a()), __tsplusTrace);
|
|
1930
2109
|
}
|
|
1931
2110
|
|
|
1932
2111
|
function takeLoop(n, __tsplusTrace) {
|
|
1933
2112
|
return tsplus_module_10.readWithCause(inp => {
|
|
1934
|
-
const taken = tsplus_module_12.
|
|
2113
|
+
const taken = tsplus_module_12.take(n)(inp);
|
|
1935
2114
|
const left = Math.max(n - taken.length, 0);
|
|
1936
2115
|
|
|
1937
2116
|
if (left > 0) {
|
|
1938
|
-
return tsplus_module_11.
|
|
2117
|
+
return tsplus_module_11.apSecond(takeLoop(left, __tsplusTrace))(tsplus_module_10.writeNow(taken));
|
|
1939
2118
|
} else {
|
|
1940
2119
|
return tsplus_module_10.writeNow(taken);
|
|
1941
2120
|
}
|
|
@@ -1944,27 +2123,31 @@ function takeLoop(n, __tsplusTrace) {
|
|
|
1944
2123
|
/**
|
|
1945
2124
|
* Takes the specified number of elements from this stream.
|
|
1946
2125
|
*
|
|
1947
|
-
* @tsplus
|
|
2126
|
+
* @tsplus pipeable fncts.io.Stream take
|
|
1948
2127
|
*/
|
|
1949
2128
|
|
|
1950
2129
|
|
|
1951
|
-
export function
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
2130
|
+
export function take(n, __tsplusTrace) {
|
|
2131
|
+
return stream => {
|
|
2132
|
+
if (n <= 0) {
|
|
2133
|
+
return empty_1;
|
|
2134
|
+
}
|
|
1955
2135
|
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
2136
|
+
if (!Number.isInteger(n)) {
|
|
2137
|
+
return halt_1(() => new tsplus_module_57.IllegalArgumentError(`${n} should be an integer`, "Stream.take"), __tsplusTrace);
|
|
2138
|
+
}
|
|
1959
2139
|
|
|
1960
|
-
|
|
2140
|
+
return new Stream(tsplus_module_10.pipeTo(takeLoop(n, __tsplusTrace))(stream.channel));
|
|
2141
|
+
};
|
|
1961
2142
|
}
|
|
1962
2143
|
/**
|
|
1963
|
-
* @tsplus
|
|
2144
|
+
* @tsplus pipeable fncts.io.Stream takeUntilIO
|
|
1964
2145
|
*/
|
|
1965
2146
|
|
|
1966
|
-
export function
|
|
1967
|
-
return
|
|
2147
|
+
export function takeUntilIO(f, __tsplusTrace) {
|
|
2148
|
+
return ma => {
|
|
2149
|
+
return new Stream(tsplus_module_10.pipeTo(takeUntilIOLoop(tsplus_module_34.empty()[Symbol.iterator](), f, __tsplusTrace))(ma.channel));
|
|
2150
|
+
};
|
|
1968
2151
|
}
|
|
1969
2152
|
|
|
1970
2153
|
function takeUntilIOLoop(iterator, f, __tsplusTrace) {
|
|
@@ -1973,19 +2156,19 @@ function takeUntilIOLoop(iterator, f, __tsplusTrace) {
|
|
|
1973
2156
|
if (next.done) {
|
|
1974
2157
|
return tsplus_module_10.readWithCause(elem => takeUntilIOLoop(elem[Symbol.iterator](), f, __tsplusTrace), tsplus_module_11.failCauseNow, tsplus_module_11.succeedNow);
|
|
1975
2158
|
} else {
|
|
1976
|
-
return tsplus_module_10.unwrap(() => tsplus_module_1.
|
|
2159
|
+
return tsplus_module_10.unwrap(() => tsplus_module_1.map(b => b ? tsplus_module_10.writeNow(tsplus_module_16.single(next.value)) : tsplus_module_11.apSecond(takeUntilIOLoop(iterator, f, __tsplusTrace))(tsplus_module_10.writeNow(tsplus_module_16.single(next.value))), __tsplusTrace)(f(next.value)));
|
|
1977
2160
|
}
|
|
1978
2161
|
}
|
|
1979
2162
|
|
|
1980
2163
|
function takeUntilLoop(p, __tsplusTrace) {
|
|
1981
2164
|
return tsplus_module_10.readWith(chunk => {
|
|
1982
|
-
const taken = tsplus_module_12.
|
|
1983
|
-
const last = tsplus_module_12.
|
|
2165
|
+
const taken = tsplus_module_12.takeWhile(tsplus_module_43.invert(p))(chunk);
|
|
2166
|
+
const last = tsplus_module_12.take(1)(tsplus_module_12.drop(taken.length)(chunk));
|
|
1984
2167
|
|
|
1985
2168
|
if (tsplus_module_12.isEmpty(last)) {
|
|
1986
|
-
return tsplus_module_11.
|
|
2169
|
+
return tsplus_module_11.apSecond(takeUntilLoop(p, __tsplusTrace))(tsplus_module_10.writeNow(taken));
|
|
1987
2170
|
} else {
|
|
1988
|
-
return tsplus_module_10.writeNow(tsplus_module_12.
|
|
2171
|
+
return tsplus_module_10.writeNow(tsplus_module_12.concat(last)(taken));
|
|
1989
2172
|
}
|
|
1990
2173
|
}, tsplus_module_10.failNow, tsplus_module_11.succeedNow);
|
|
1991
2174
|
}
|
|
@@ -1993,19 +2176,23 @@ function takeUntilLoop(p, __tsplusTrace) {
|
|
|
1993
2176
|
* Takes all elements of the stream until the specified predicate evaluates
|
|
1994
2177
|
* to `true`.
|
|
1995
2178
|
*
|
|
1996
|
-
* @tsplus
|
|
2179
|
+
* @tsplus pipeable fncts.io.Stream takeUntil
|
|
1997
2180
|
*/
|
|
1998
2181
|
|
|
1999
2182
|
|
|
2000
|
-
export function
|
|
2001
|
-
return
|
|
2183
|
+
export function takeUntil(p, __tsplusTrace) {
|
|
2184
|
+
return fa => {
|
|
2185
|
+
return new Stream(tsplus_module_10.pipeTo(takeUntilLoop(p, __tsplusTrace))(fa.channel));
|
|
2186
|
+
};
|
|
2002
2187
|
}
|
|
2003
2188
|
/**
|
|
2004
|
-
* @tsplus
|
|
2189
|
+
* @tsplus pipeable fncts.io.Stream tap
|
|
2005
2190
|
*/
|
|
2006
2191
|
|
|
2007
|
-
export function
|
|
2008
|
-
return
|
|
2192
|
+
export function tap(f, __tsplusTrace) {
|
|
2193
|
+
return ma => {
|
|
2194
|
+
return mapIO_1(a => tsplus_module_1.as(() => a, __tsplusTrace)(f(a)), __tsplusTrace)(ma);
|
|
2195
|
+
};
|
|
2009
2196
|
}
|
|
2010
2197
|
/**
|
|
2011
2198
|
* Throttles the chunks of this stream according to the given bandwidth parameters using the token bucket
|
|
@@ -2013,15 +2200,17 @@ export function tap_(ma, f, __tsplusTrace) {
|
|
|
2013
2200
|
* tokens up to a `units + burst` threshold. Chunks that do not meet the bandwidth constraints are dropped.
|
|
2014
2201
|
* The weight of each chunk is determined by the `costFn` function.
|
|
2015
2202
|
*
|
|
2016
|
-
* @tsplus
|
|
2203
|
+
* @tsplus pipeable fncts.io.Stream throttleEnforce
|
|
2017
2204
|
*/
|
|
2018
2205
|
|
|
2019
|
-
export function
|
|
2020
|
-
return
|
|
2206
|
+
export function throttleEnforce(costFn, units, duration, burst = 0, __tsplusTrace) {
|
|
2207
|
+
return sa => {
|
|
2208
|
+
return throttleEnforceIO_1(chunk => tsplus_module_1.succeedNow(costFn(chunk), __tsplusTrace), units, duration, burst, __tsplusTrace)(sa);
|
|
2209
|
+
};
|
|
2021
2210
|
}
|
|
2022
2211
|
|
|
2023
2212
|
function throttleEnforceIOLoop(costFn, units, duration, burst, tokens, timestamp, __tsplusTrace) {
|
|
2024
|
-
return tsplus_module_10.readWith(inp => tsplus_module_10.unwrap(() => tsplus_module_1.
|
|
2213
|
+
return tsplus_module_10.readWith(inp => tsplus_module_10.unwrap(() => tsplus_module_1.zipWith(tsplus_module_37.currentTime, (weight, current) => {
|
|
2025
2214
|
const elapsed = current - timestamp;
|
|
2026
2215
|
const cycles = elapsed / duration;
|
|
2027
2216
|
|
|
@@ -2031,8 +2220,8 @@ function throttleEnforceIOLoop(costFn, units, duration, burst, tokens, timestamp
|
|
|
2031
2220
|
return sum < 0 ? max : Math.min(sum, max);
|
|
2032
2221
|
})();
|
|
2033
2222
|
|
|
2034
|
-
return weight <= available ? tsplus_module_11.
|
|
2035
|
-
}, __tsplusTrace)), tsplus_module_10.failNow, () => tsplus_module_10.unit);
|
|
2223
|
+
return weight <= available ? tsplus_module_11.apSecond(throttleEnforceIOLoop(costFn, units, duration, burst, available - weight, current, __tsplusTrace))(tsplus_module_10.writeNow(inp)) : throttleEnforceIOLoop(costFn, units, duration, burst, available - weight, current, __tsplusTrace);
|
|
2224
|
+
}, __tsplusTrace)(costFn(inp))), tsplus_module_10.failNow, () => tsplus_module_10.unit);
|
|
2036
2225
|
}
|
|
2037
2226
|
/**
|
|
2038
2227
|
* Throttles the chunks of this stream according to the given bandwidth parameters using the token bucket
|
|
@@ -2040,23 +2229,27 @@ function throttleEnforceIOLoop(costFn, units, duration, burst, tokens, timestamp
|
|
|
2040
2229
|
* tokens up to a `units + burst` threshold. Chunks that do not meet the bandwidth constraints are dropped.
|
|
2041
2230
|
* The weight of each chunk is determined by the `costFn` effectful function.
|
|
2042
2231
|
*
|
|
2043
|
-
* @tsplus
|
|
2232
|
+
* @tsplus pipeable fncts.io.Stream throttleEnforceIO
|
|
2044
2233
|
*/
|
|
2045
2234
|
|
|
2046
2235
|
|
|
2047
|
-
function throttleEnforceIO_1(
|
|
2048
|
-
return
|
|
2236
|
+
function throttleEnforceIO_1(costFn, units, duration, burst = 0, __tsplusTrace) {
|
|
2237
|
+
return sa => {
|
|
2238
|
+
return new Stream(tsplus_module_11.flatMap(current => tsplus_module_10.pipeTo(throttleEnforceIOLoop(costFn, units, duration, burst, units, current, __tsplusTrace))(sa.channel))(tsplus_module_10.fromIO(() => tsplus_module_37.currentTime)));
|
|
2239
|
+
};
|
|
2049
2240
|
}
|
|
2050
2241
|
/**
|
|
2051
2242
|
* Converts the stream to a managed hub of chunks. After the managed hub is used,
|
|
2052
2243
|
* the hub will never again produce values and should be discarded.
|
|
2053
2244
|
*
|
|
2054
|
-
* @tsplus
|
|
2245
|
+
* @tsplus pipeable fncts.io.Stream toHub
|
|
2055
2246
|
*/
|
|
2056
2247
|
|
|
2057
2248
|
|
|
2058
|
-
function toHub_1(
|
|
2059
|
-
return
|
|
2249
|
+
function toHub_1(capacity, __tsplusTrace) {
|
|
2250
|
+
return stream => {
|
|
2251
|
+
return tsplus_module_1.flatMap(hub => tsplus_module_1.map(() => hub, __tsplusTrace)(tsplus_module_1.fork(runIntoHubScoped_1(hub, __tsplusTrace)(stream), __tsplusTrace)), __tsplusTrace)(tsplus_module_26.acquireRelease(() => tsplus_module_29.makeBounded(capacity, __tsplusTrace), _ => _.shutdown, __tsplusTrace));
|
|
2252
|
+
};
|
|
2060
2253
|
}
|
|
2061
2254
|
/**
|
|
2062
2255
|
* Interpret the stream as a managed pull
|
|
@@ -2066,41 +2259,49 @@ function toHub_1(stream, capacity, __tsplusTrace) {
|
|
|
2066
2259
|
|
|
2067
2260
|
|
|
2068
2261
|
function toPull_1(stream, __tsplusTrace) {
|
|
2069
|
-
return tsplus_module_1.
|
|
2262
|
+
return tsplus_module_1.map(io => tsplus_module_1.flatMap(r => tsplus_module_4.match(() => tsplus_module_1.failNow(tsplus_module_3.nothing(), __tsplusTrace), tsplus_module_1.succeedNow)(r), __tsplusTrace)(tsplus_module_1.mapError(tsplus_module_3.just, __tsplusTrace)(io)), __tsplusTrace)(tsplus_module_58.toPull(stream.channel));
|
|
2070
2263
|
}
|
|
2071
2264
|
/**
|
|
2072
2265
|
* Converts the stream to a managed queue of chunks. After the managed queue is used,
|
|
2073
2266
|
* the queue will never again produce values and should be discarded.
|
|
2074
2267
|
*
|
|
2075
|
-
* @tsplus
|
|
2268
|
+
* @tsplus pipeable fncts.io.Stream toQueue
|
|
2076
2269
|
*/
|
|
2077
2270
|
|
|
2078
2271
|
|
|
2079
|
-
function toQueue_1(
|
|
2080
|
-
return
|
|
2272
|
+
function toQueue_1(capacity = 2, __tsplusTrace) {
|
|
2273
|
+
return stream => {
|
|
2274
|
+
return tsplus_module_1.flatMap(queue => tsplus_module_1.map(() => queue, __tsplusTrace)(tsplus_module_1.fork(runIntoQueueScoped_1(queue, __tsplusTrace)(stream), __tsplusTrace)), __tsplusTrace)(tsplus_module_26.acquireRelease(() => tsplus_module_25.makeBounded(capacity, __tsplusTrace), _ => _.shutdown, __tsplusTrace));
|
|
2275
|
+
};
|
|
2081
2276
|
}
|
|
2082
2277
|
/**
|
|
2083
|
-
* @tsplus
|
|
2278
|
+
* @tsplus pipeable fncts.io.Stream toQueueDropping
|
|
2084
2279
|
*/
|
|
2085
2280
|
|
|
2086
2281
|
|
|
2087
|
-
export function
|
|
2088
|
-
return
|
|
2282
|
+
export function toQueueDropping(capacity = 2, __tsplusTrace) {
|
|
2283
|
+
return stream => {
|
|
2284
|
+
return tsplus_module_1.flatMap(queue => tsplus_module_1.map(() => queue, __tsplusTrace)(tsplus_module_1.fork(runIntoQueueScoped_1(queue, __tsplusTrace)(stream), __tsplusTrace)), __tsplusTrace)(tsplus_module_26.acquireRelease(() => tsplus_module_25.makeDropping(capacity, __tsplusTrace), _ => _.shutdown, __tsplusTrace));
|
|
2285
|
+
};
|
|
2089
2286
|
}
|
|
2090
2287
|
/**
|
|
2091
|
-
* @tsplus
|
|
2288
|
+
* @tsplus pipeable fncts.io.Stream toQueueOfElements
|
|
2092
2289
|
*/
|
|
2093
2290
|
|
|
2094
|
-
function toQueueOfElements_1(
|
|
2095
|
-
return
|
|
2291
|
+
function toQueueOfElements_1(capacity = 2, __tsplusTrace) {
|
|
2292
|
+
return stream => {
|
|
2293
|
+
return tsplus_module_1.flatMap(queue => tsplus_module_1.map(() => queue, __tsplusTrace)(tsplus_module_1.fork(runIntoElementsScoped_1(queue, __tsplusTrace)(stream), __tsplusTrace)), __tsplusTrace)(tsplus_module_26.acquireRelease(() => tsplus_module_25.makeBounded(capacity, __tsplusTrace), _ => _.shutdown, __tsplusTrace));
|
|
2294
|
+
};
|
|
2096
2295
|
}
|
|
2097
2296
|
/**
|
|
2098
|
-
* @tsplus
|
|
2297
|
+
* @tsplus pipeable fncts.io.Stream toQueueSliding
|
|
2099
2298
|
*/
|
|
2100
2299
|
|
|
2101
2300
|
|
|
2102
|
-
export function
|
|
2103
|
-
return
|
|
2301
|
+
export function toQueueSliding(capacity = 2, __tsplusTrace) {
|
|
2302
|
+
return stream => {
|
|
2303
|
+
return tsplus_module_1.flatMap(queue => tsplus_module_1.map(() => queue, __tsplusTrace)(tsplus_module_1.fork(runIntoQueueScoped_1(queue, __tsplusTrace)(stream), __tsplusTrace)), __tsplusTrace)(tsplus_module_26.acquireRelease(() => tsplus_module_25.makeSliding(capacity, __tsplusTrace), _ => _.shutdown, __tsplusTrace));
|
|
2304
|
+
};
|
|
2104
2305
|
}
|
|
2105
2306
|
/**
|
|
2106
2307
|
* Converts the stream into an unbounded managed queue. After the managed queue
|
|
@@ -2110,11 +2311,11 @@ export function toQueueSliding_(stream, capacity = 2, __tsplusTrace) {
|
|
|
2110
2311
|
*/
|
|
2111
2312
|
|
|
2112
2313
|
function toQueueUnbounded_1(stream, __tsplusTrace) {
|
|
2113
|
-
return tsplus_module_1.
|
|
2314
|
+
return tsplus_module_1.flatMap(queue => tsplus_module_1.map(() => queue, __tsplusTrace)(tsplus_module_1.fork(runIntoQueueScoped_1(queue, __tsplusTrace)(stream), __tsplusTrace)), __tsplusTrace)(tsplus_module_26.acquireRelease(() => tsplus_module_25.makeUnbounded(__tsplusTrace), _ => _.shutdown, __tsplusTrace));
|
|
2114
2315
|
}
|
|
2115
2316
|
|
|
2116
2317
|
function unfoldChunkIOLoop(s, f, __tsplusTrace) {
|
|
2117
|
-
return tsplus_module_10.unwrap(() => tsplus_module_1.
|
|
2318
|
+
return tsplus_module_10.unwrap(() => tsplus_module_1.map(m => tsplus_module_17.match(() => tsplus_module_10.unit, ([as, s]) => tsplus_module_11.flatMap(() => unfoldChunkIOLoop(s, f, __tsplusTrace))(tsplus_module_10.writeNow(as)))(m), __tsplusTrace)(f(s)));
|
|
2118
2319
|
}
|
|
2119
2320
|
/**
|
|
2120
2321
|
* Creates a stream by effectfully peeling off the "layers" of a value of type `S`
|
|
@@ -2134,11 +2335,11 @@ function unfoldChunkIO_1(s, f, __tsplusTrace) {
|
|
|
2134
2335
|
|
|
2135
2336
|
|
|
2136
2337
|
function unfoldIO_1(s, f, __tsplusTrace) {
|
|
2137
|
-
return unfoldChunkIO_1(s, _ => tsplus_module_1.
|
|
2338
|
+
return unfoldChunkIO_1(s, _ => tsplus_module_1.map(m => tsplus_module_33.map(([a, s]) => tuple(tsplus_module_16.single(a), s))(m), __tsplusTrace)(f(_)), __tsplusTrace);
|
|
2138
2339
|
}
|
|
2139
2340
|
|
|
2140
2341
|
function unfoldChunkLoop(s, f, __tsplusTrace) {
|
|
2141
|
-
return
|
|
2342
|
+
return tsplus_module_17.match(() => tsplus_module_10.unit, ([as, s]) => tsplus_module_11.flatMap(() => unfoldChunkLoop(s, f, __tsplusTrace))(tsplus_module_10.writeNow(as)))(f(s));
|
|
2142
2343
|
}
|
|
2143
2344
|
/**
|
|
2144
2345
|
* @tsplus static fncts.io.StreamOps unfoldChunk
|
|
@@ -2154,7 +2355,7 @@ function unfoldChunk_1(s, f, __tsplusTrace) {
|
|
|
2154
2355
|
|
|
2155
2356
|
|
|
2156
2357
|
export function unfold(s, f, __tsplusTrace) {
|
|
2157
|
-
return unfoldChunk_1(s, s =>
|
|
2358
|
+
return unfoldChunk_1(s, s => tsplus_module_33.map(([a, s]) => tuple(tsplus_module_16.single(a), s))(f(s)), __tsplusTrace);
|
|
2158
2359
|
}
|
|
2159
2360
|
/**
|
|
2160
2361
|
* Creates a stream produced from an IO
|
|
@@ -2173,7 +2374,7 @@ function unwrap_1(stream, __tsplusTrace) {
|
|
|
2173
2374
|
|
|
2174
2375
|
|
|
2175
2376
|
function unwrapScoped_1(stream, __tsplusTrace) {
|
|
2176
|
-
return flatten_1(scoped_1(stream, __tsplusTrace), __tsplusTrace);
|
|
2377
|
+
return flatten_1(scoped_1(() => stream, __tsplusTrace), __tsplusTrace);
|
|
2177
2378
|
}
|
|
2178
2379
|
/**
|
|
2179
2380
|
* @tsplus getter fncts.io.Stream zipWithIndex
|
|
@@ -2181,7 +2382,7 @@ function unwrapScoped_1(stream, __tsplusTrace) {
|
|
|
2181
2382
|
|
|
2182
2383
|
|
|
2183
2384
|
export function zipWithIndex_(self, __tsplusTrace) {
|
|
2184
|
-
return mapAccum_1(
|
|
2385
|
+
return mapAccum_1(0, (index, a) => [index + 1, [a, index]], __tsplusTrace)(self);
|
|
2185
2386
|
}
|
|
2186
2387
|
/**
|
|
2187
2388
|
* Zips the two streams so that when a value is emitted by either of the two
|
|
@@ -2192,14 +2393,16 @@ export function zipWithIndex_(self, __tsplusTrace) {
|
|
|
2192
2393
|
* that emitted elements that are not the last value in chunks will never be
|
|
2193
2394
|
* used for zipping.
|
|
2194
2395
|
*
|
|
2195
|
-
* @tsplus
|
|
2396
|
+
* @tsplus pipeable fncts.io.Stream zipWithLatest
|
|
2196
2397
|
*/
|
|
2197
2398
|
|
|
2198
|
-
export function
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2399
|
+
export function zipWithLatest(fb, f, __tsplusTrace) {
|
|
2400
|
+
return fa => {
|
|
2401
|
+
function pullNonEmpty(pull, __tsplusTrace) {
|
|
2402
|
+
return tsplus_module_1.flatMap(chunk => tsplus_module_12.isNonEmpty(chunk) ? pullNonEmpty(pull, __tsplusTrace) : tsplus_module_1.succeedNow(chunk, __tsplusTrace), __tsplusTrace)(pull);
|
|
2403
|
+
}
|
|
2202
2404
|
|
|
2203
|
-
|
|
2405
|
+
return fromPull_1(tsplus_module_1.flatMap(left => tsplus_module_1.flatMap(right => toPull_1(flatMap_1(([l, r, leftFirst]) => flatMap_1(latest => concat_1(flatMap_1(fromChunkNow_1, __tsplusTrace)(mapIO_1(ab => tsplus_module_4.match(leftChunk => latest.modify(([_, rightLatest]) => tuple(tsplus_module_12.map(a => f(a, rightLatest))(leftChunk), tuple(tsplus_module_12.unsafeGet(leftChunk.length - 1)(leftChunk), rightLatest)), __tsplusTrace), rightChunk => latest.modify(([leftLatest, _]) => tuple(tsplus_module_12.map(b => f(leftLatest, b))(rightChunk), tuple(leftLatest, tsplus_module_12.unsafeGet(rightChunk.length - 1)(rightChunk))), __tsplusTrace))(ab), __tsplusTrace)(mergeEither_1(repeatIOMaybe_1(right, __tsplusTrace), __tsplusTrace)(repeatIOMaybe_1(left, __tsplusTrace)))), __tsplusTrace)(fromChunk_1(() => leftFirst ? tsplus_module_12.map(b => f(tsplus_module_12.unsafeGet(l.length - 1)(l), b))(r) : tsplus_module_12.map(a => f(a, tsplus_module_12.unsafeGet(r.length - 1)(r)))(l), __tsplusTrace)), __tsplusTrace)(fromIO_1(tsplus_module_6.make(() => tuple(tsplus_module_12.unsafeGet(l.length - 1)(l), tsplus_module_12.unsafeGet(r.length - 1)(r)), __tsplusTrace), __tsplusTrace)), __tsplusTrace)(fromIOMaybe_1(tsplus_module_21.raceWith(() => right, (leftDone, rightFiber) => tsplus_module_1.zipWith(tsplus_module_19.join(rightFiber, __tsplusTrace), (l, r) => tuple(l, r, true), __tsplusTrace)(tsplus_module_1.fromExitNow(leftDone, __tsplusTrace)), (rightDone, leftFiber) => tsplus_module_1.zipWith(tsplus_module_19.join(leftFiber, __tsplusTrace), (r, l) => tuple(l, r, false), __tsplusTrace)(tsplus_module_1.fromExitNow(rightDone, __tsplusTrace)), __tsplusTrace)(left), __tsplusTrace)), __tsplusTrace), __tsplusTrace)(tsplus_module_1.map(pullNonEmpty, __tsplusTrace)(toPull_1(fb, __tsplusTrace))), __tsplusTrace)(tsplus_module_1.map(pullNonEmpty, __tsplusTrace)(toPull_1(fa, __tsplusTrace))), __tsplusTrace);
|
|
2406
|
+
};
|
|
2204
2407
|
}
|
|
2205
2408
|
//# sourceMappingURL=api.mjs.map
|