@fncts/io 0.0.10 → 0.0.13
Sign up to get free protection for your applications and to get access to all the features.
- package/Cached/api.d.ts +2 -3
- package/Channel/api/interruptWhen.d.ts +1 -1
- package/Channel/api/mapOutIOC.d.ts +1 -1
- package/Channel/api/mergeAll.d.ts +1 -1
- package/Channel/api/mergeAllUnboundedWith.d.ts +1 -1
- package/Channel/api/mergeAllWith.d.ts +1 -1
- package/Channel/api/mergeMap.d.ts +1 -1
- package/Channel/api/mergeWith.d.ts +1 -1
- package/Channel/api/runScoped.d.ts +1 -2
- package/Channel/api/toPull.d.ts +1 -2
- package/Channel/api/zipC.d.ts +3 -3
- package/Channel/api.d.ts +48 -49
- package/Channel/core-api.d.ts +10 -10
- package/Channel/definition.d.ts +12 -12
- package/Channel/internal/MergeDecision.d.ts +1 -1
- package/Channel/internal/SingleProducerAsyncInput.d.ts +1 -1
- package/Clock/api.d.ts +1 -1
- package/Fiber/FiberContext.d.ts +3 -3
- package/Fiber/api/awaitAll.d.ts +1 -1
- package/Fiber/api/evalOnIO.d.ts +1 -1
- package/Fiber/api/joinAll.d.ts +1 -1
- package/Fiber/definition.d.ts +1 -1
- package/FiberRef/api/locallyScoped.d.ts +1 -2
- package/FiberRef/api/locallyScopedWith.d.ts +1 -2
- package/FiberRef/constructors.d.ts +1 -2
- package/FiberRef/unsafe.d.ts +6 -0
- package/Future/api.d.ts +1 -1
- package/Future/constructors.d.ts +1 -1
- package/Hub/api.d.ts +6 -7
- package/Hub/definition.d.ts +6 -7
- package/Hub/internal.d.ts +0 -1
- package/IO/api/acquireRelease.d.ts +1 -2
- package/IO/api/acquireReleaseExit.d.ts +1 -2
- package/IO/api/acquireReleaseInterruptible.d.ts +1 -2
- package/IO/api/acquireReleaseInterruptibleExit.d.ts +1 -2
- package/IO/api/addFinalizer.d.ts +1 -2
- package/IO/api/addFinalizerExit.d.ts +1 -2
- package/IO/api/bracket.d.ts +1 -1
- package/IO/api/bracketExit.d.ts +1 -1
- package/IO/api/clockWith.d.ts +1 -1
- package/IO/api/concurrentFinalizers.d.ts +1 -2
- package/IO/api/consoleWith.d.ts +1 -1
- package/IO/api/core-scope.d.ts +1 -1
- package/IO/api/ensuringChildren.d.ts +1 -1
- package/IO/api/environment.d.ts +8 -10
- package/IO/api/forkScoped.d.ts +1 -2
- package/IO/api/interrupt.d.ts +3 -3
- package/IO/api/onExit.d.ts +1 -1
- package/IO/api/onTermination.d.ts +1 -1
- package/IO/api/provideSomeLayer.d.ts +1 -1
- package/IO/api/race.d.ts +1 -1
- package/IO/api/raceFirst.d.ts +1 -1
- package/IO/api/randomWith.d.ts +1 -1
- package/IO/api/repeat.d.ts +3 -3
- package/IO/api/retry.d.ts +3 -3
- package/IO/api/schedule.d.ts +2 -2
- package/IO/api/scope.d.ts +1 -2
- package/IO/api/scopeWith.d.ts +1 -2
- package/IO/api/scoped.d.ts +2 -3
- package/IO/api/sequenceT.d.ts +3 -3
- package/IO/api/stateful.d.ts +1 -2
- package/IO/api/withEarlyRelease.d.ts +1 -2
- package/IO/api/withFinalizer.d.ts +1 -2
- package/IO/api/withFinalizerExit.d.ts +1 -2
- package/IO/api/zipC.d.ts +2 -2
- package/IO/api.d.ts +50 -50
- package/IO/definition.d.ts +28 -24
- package/IO/runtime.d.ts +23 -10
- package/IOEnv/definition.d.ts +2 -3
- package/IOEnv/live.d.ts +1 -1
- package/IOSpec.d.ts +1 -2
- package/Layer/MemoMap.d.ts +2 -3
- package/Layer/api.d.ts +30 -32
- package/Layer/definition.d.ts +7 -8
- package/Queue/api/dimapIO.d.ts +3 -3
- package/Queue/api/filterInputIO.d.ts +4 -4
- package/Queue/api/filterOutputIO.d.ts +6 -6
- package/Queue/api/zipWithIO.d.ts +9 -9
- package/Queue/definition.d.ts +7 -7
- package/Queue/internal.d.ts +1 -1
- package/Random/api.d.ts +4 -4
- package/Random/live.d.ts +1 -1
- package/Ref/Atomic/Atomic.d.ts +3 -3
- package/Ref/Derived.d.ts +3 -3
- package/Ref/DerivedAll.d.ts +3 -3
- package/Ref/Synchronized/api.d.ts +15 -15
- package/Ref/Synchronized/definition.d.ts +2 -2
- package/Ref/api/get.d.ts +1 -1
- package/Ref/api/modify.d.ts +9 -9
- package/Ref/api/set.d.ts +1 -1
- package/Ref/definition.d.ts +13 -13
- package/STM/api/core-api.d.ts +4 -4
- package/STM/api/core-constructors.d.ts +7 -7
- package/STM/api.d.ts +27 -39
- package/STM/definition.d.ts +9 -8
- package/STM/driver.d.ts +1 -1
- package/STM/internal/Journal.d.ts +4 -3
- package/Schedule/Decision.d.ts +10 -4
- package/Schedule/Driver.d.ts +3 -3
- package/Schedule/api.d.ts +55 -43
- package/Schedule/definition.d.ts +1 -1
- package/Scope/Finalizer/definition.d.ts +2 -2
- package/Scope/ReleaseMap/api.d.ts +1 -1
- package/Scope/ReleaseMap/definition.d.ts +1 -1
- package/Scope/api.d.ts +3 -4
- package/ScopedRef/api.d.ts +1 -2
- package/ScopedRef/definition.d.ts +1 -2
- package/Sink/api.d.ts +255 -75
- package/State/api.d.ts +1 -2
- package/Stream/api/zipAllWith.d.ts +1 -1
- package/Stream/api/zipWith.d.ts +1 -1
- package/Stream/api/zipWithChunks.d.ts +1 -1
- package/Stream/api.d.ts +91 -93
- package/Stream/definition.d.ts +3 -3
- package/Stream/internal/Take.d.ts +1 -1
- package/Supervisor/constructors.d.ts +2 -2
- package/TFuture/api.d.ts +1 -1
- package/TFuture/definition.d.ts +1 -1
- package/TReentrantLock/api.d.ts +2 -3
- package/TRef/api.d.ts +11 -11
- package/TRef/constructors.d.ts +2 -2
- package/TSemaphore/api.d.ts +2 -2
- package/TSemaphore/definition.d.ts +1 -1
- package/_cjs/Cached/api.cjs.map +1 -1
- package/_cjs/Channel/api/mapOutIOC.cjs +1 -1
- package/_cjs/Channel/api/mapOutIOC.cjs.map +1 -1
- package/_cjs/Channel/api/mergeAllWith.cjs +3 -3
- package/_cjs/Channel/api/mergeAllWith.cjs.map +1 -1
- package/_cjs/Channel/api.cjs.map +1 -1
- package/_cjs/Channel/definition.cjs.map +1 -1
- package/_cjs/Clock/live.cjs.map +1 -1
- package/_cjs/Fiber/FiberContext.cjs +5 -7
- package/_cjs/Fiber/FiberContext.cjs.map +1 -1
- package/_cjs/FiberRef/unsafe.cjs +9 -1
- package/_cjs/FiberRef/unsafe.cjs.map +1 -1
- package/_cjs/Future/api.cjs.map +1 -1
- package/_cjs/Hub/api.cjs +1 -1
- package/_cjs/Hub/api.cjs.map +1 -1
- package/_cjs/Hub/internal.cjs +4 -12
- package/_cjs/Hub/internal.cjs.map +1 -1
- package/_cjs/IO/api/addFinalizerExit.cjs +4 -8
- package/_cjs/IO/api/addFinalizerExit.cjs.map +1 -1
- package/_cjs/IO/api/ensuringChildren.cjs +1 -1
- package/_cjs/IO/api/ensuringChildren.cjs.map +1 -1
- package/_cjs/IO/api/environment.cjs +2 -3
- package/_cjs/IO/api/environment.cjs.map +1 -1
- package/_cjs/IO/api/interrupt.cjs +1 -1
- package/_cjs/IO/api/interrupt.cjs.map +1 -1
- package/_cjs/IO/api/memoize.cjs +4 -8
- package/_cjs/IO/api/memoize.cjs.map +1 -1
- package/_cjs/IO/api/provideSomeLayer.cjs +1 -2
- package/_cjs/IO/api/provideSomeLayer.cjs.map +1 -1
- package/_cjs/IO/api/scope.cjs +1 -1
- package/_cjs/IO/api/scope.cjs.map +1 -1
- package/_cjs/IO/api/scoped.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.cjs +1 -1
- package/_cjs/IO/api.cjs.map +1 -1
- package/_cjs/IO/definition.cjs +5 -8
- package/_cjs/IO/definition.cjs.map +1 -1
- package/_cjs/IO/runtime.cjs +69 -21
- package/_cjs/IO/runtime.cjs.map +1 -1
- package/_cjs/Layer/MemoMap.cjs +22 -38
- package/_cjs/Layer/MemoMap.cjs.map +1 -1
- package/_cjs/Layer/api.cjs +6 -4
- package/_cjs/Layer/api.cjs.map +1 -1
- package/_cjs/Layer/definition.cjs.map +1 -1
- package/_cjs/Queue/internal.cjs +2 -2
- package/_cjs/Queue/internal.cjs.map +1 -1
- package/_cjs/Queue/strategy.cjs +1 -5
- package/_cjs/Queue/strategy.cjs.map +1 -1
- package/_cjs/Ref/Atomic/Atomic.cjs.map +1 -1
- package/_cjs/Ref/Derived.cjs.map +1 -1
- package/_cjs/Ref/DerivedAll.cjs.map +1 -1
- package/_cjs/Ref/Synchronized/constructors.cjs +7 -11
- package/_cjs/Ref/Synchronized/constructors.cjs.map +1 -1
- package/_cjs/STM/api/core-constructors.cjs.map +1 -1
- package/_cjs/STM/api.cjs +59 -78
- package/_cjs/STM/api.cjs.map +1 -1
- package/_cjs/STM/definition.cjs.map +1 -1
- package/_cjs/STM/driver.cjs +7 -5
- package/_cjs/STM/driver.cjs.map +1 -1
- package/_cjs/STM/internal/Journal.cjs +20 -22
- package/_cjs/STM/internal/Journal.cjs.map +1 -1
- package/_cjs/Schedule/Decision.cjs +17 -0
- package/_cjs/Schedule/Decision.cjs.map +1 -1
- package/_cjs/Schedule/api/driver.cjs +22 -21
- package/_cjs/Schedule/api/driver.cjs.map +1 -1
- package/_cjs/Schedule/api.cjs +91 -66
- package/_cjs/Schedule/api.cjs.map +1 -1
- package/_cjs/Scope/Finalizer/definition.cjs +4 -6
- package/_cjs/Scope/Finalizer/definition.cjs.map +1 -1
- package/_cjs/Scope/ReleaseMap/definition.cjs +2 -4
- package/_cjs/Scope/ReleaseMap/definition.cjs.map +1 -1
- package/_cjs/Scope/api.cjs +2 -12
- package/_cjs/Scope/api.cjs.map +1 -1
- package/_cjs/ScopedRef/api.cjs +14 -22
- package/_cjs/ScopedRef/api.cjs.map +1 -1
- package/_cjs/Sink/api.cjs +424 -131
- package/_cjs/Sink/api.cjs.map +1 -1
- package/_cjs/Stream/api.cjs +94 -94
- package/_cjs/Stream/api.cjs.map +1 -1
- package/_cjs/Supervisor/constructors.cjs +14 -8
- package/_cjs/Supervisor/constructors.cjs.map +1 -1
- package/_cjs/TFuture/definition.cjs +2 -4
- package/_cjs/TFuture/definition.cjs.map +1 -1
- package/_cjs/TSemaphore/api.cjs +7 -7
- package/_cjs/TSemaphore/api.cjs.map +1 -1
- package/_cjs/TSemaphore/definition.cjs +2 -4
- package/_cjs/TSemaphore/definition.cjs.map +1 -1
- package/_cjs/collection/immutable/Conc/dropUntilIO.cjs +38 -0
- package/_cjs/collection/immutable/Conc/dropUntilIO.cjs.map +1 -0
- package/_cjs/collection/immutable/Conc/dropWhileIO.cjs +38 -0
- package/_cjs/collection/immutable/Conc/dropWhileIO.cjs.map +1 -0
- package/_cjs/internal/Scheduler.cjs +64 -14
- package/_cjs/internal/Scheduler.cjs.map +1 -1
- package/_mjs/Cached/api.mjs.map +1 -1
- package/_mjs/Channel/api/mapOutIOC.mjs +1 -1
- package/_mjs/Channel/api/mapOutIOC.mjs.map +1 -1
- package/_mjs/Channel/api/mergeAllWith.mjs +3 -3
- package/_mjs/Channel/api/mergeAllWith.mjs.map +1 -1
- package/_mjs/Channel/api.mjs.map +1 -1
- package/_mjs/Channel/definition.mjs.map +1 -1
- package/_mjs/Clock/live.mjs.map +1 -1
- package/_mjs/Fiber/FiberContext.mjs +5 -6
- package/_mjs/Fiber/FiberContext.mjs.map +1 -1
- package/_mjs/FiberRef/unsafe.mjs +6 -0
- package/_mjs/FiberRef/unsafe.mjs.map +1 -1
- package/_mjs/Future/api.mjs.map +1 -1
- package/_mjs/Hub/api.mjs +1 -1
- package/_mjs/Hub/api.mjs.map +1 -1
- package/_mjs/Hub/internal.mjs +4 -12
- package/_mjs/Hub/internal.mjs.map +1 -1
- package/_mjs/IO/api/addFinalizerExit.mjs +4 -8
- package/_mjs/IO/api/addFinalizerExit.mjs.map +1 -1
- package/_mjs/IO/api/ensuringChildren.mjs +1 -1
- package/_mjs/IO/api/ensuringChildren.mjs.map +1 -1
- package/_mjs/IO/api/environment.mjs +2 -3
- package/_mjs/IO/api/environment.mjs.map +1 -1
- package/_mjs/IO/api/interrupt.mjs +1 -1
- package/_mjs/IO/api/interrupt.mjs.map +1 -1
- package/_mjs/IO/api/memoize.mjs +4 -8
- package/_mjs/IO/api/memoize.mjs.map +1 -1
- package/_mjs/IO/api/provideSomeLayer.mjs +1 -2
- package/_mjs/IO/api/provideSomeLayer.mjs.map +1 -1
- package/_mjs/IO/api/scope.mjs +1 -1
- package/_mjs/IO/api/scope.mjs.map +1 -1
- package/_mjs/IO/api/scoped.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.mjs +1 -1
- package/_mjs/IO/api.mjs.map +1 -1
- package/_mjs/IO/definition.mjs +3 -5
- package/_mjs/IO/definition.mjs.map +1 -1
- package/_mjs/IO/runtime.mjs +61 -18
- package/_mjs/IO/runtime.mjs.map +1 -1
- package/_mjs/Layer/MemoMap.mjs +22 -38
- package/_mjs/Layer/MemoMap.mjs.map +1 -1
- package/_mjs/Layer/api.mjs +5 -4
- package/_mjs/Layer/api.mjs.map +1 -1
- package/_mjs/Layer/definition.mjs.map +1 -1
- package/_mjs/Queue/internal.mjs +2 -2
- package/_mjs/Queue/internal.mjs.map +1 -1
- package/_mjs/Queue/strategy.mjs +1 -5
- package/_mjs/Queue/strategy.mjs.map +1 -1
- package/_mjs/Ref/Atomic/Atomic.mjs.map +1 -1
- package/_mjs/Ref/Derived.mjs.map +1 -1
- package/_mjs/Ref/DerivedAll.mjs.map +1 -1
- package/_mjs/Ref/Synchronized/constructors.mjs +7 -11
- package/_mjs/Ref/Synchronized/constructors.mjs.map +1 -1
- package/_mjs/STM/api/core-constructors.mjs.map +1 -1
- package/_mjs/STM/api.mjs +52 -72
- package/_mjs/STM/api.mjs.map +1 -1
- package/_mjs/STM/definition.mjs.map +1 -1
- package/_mjs/STM/driver.mjs +6 -5
- package/_mjs/STM/driver.mjs.map +1 -1
- package/_mjs/STM/internal/Journal.mjs +20 -21
- package/_mjs/STM/internal/Journal.mjs.map +1 -1
- package/_mjs/Schedule/Decision.mjs +9 -0
- package/_mjs/Schedule/Decision.mjs.map +1 -1
- package/_mjs/Schedule/api/driver.mjs +20 -20
- package/_mjs/Schedule/api/driver.mjs.map +1 -1
- package/_mjs/Schedule/api.mjs +84 -63
- package/_mjs/Schedule/api.mjs.map +1 -1
- package/_mjs/Scope/Finalizer/definition.mjs +4 -5
- package/_mjs/Scope/Finalizer/definition.mjs.map +1 -1
- package/_mjs/Scope/ReleaseMap/definition.mjs +2 -3
- package/_mjs/Scope/ReleaseMap/definition.mjs.map +1 -1
- package/_mjs/Scope/api.mjs +2 -12
- package/_mjs/Scope/api.mjs.map +1 -1
- package/_mjs/ScopedRef/api.mjs +14 -22
- package/_mjs/ScopedRef/api.mjs.map +1 -1
- package/_mjs/Sink/api.mjs +414 -129
- package/_mjs/Sink/api.mjs.map +1 -1
- package/_mjs/Stream/api.mjs +94 -94
- package/_mjs/Stream/api.mjs.map +1 -1
- package/_mjs/Supervisor/constructors.mjs +9 -6
- package/_mjs/Supervisor/constructors.mjs.map +1 -1
- package/_mjs/TFuture/definition.mjs +2 -3
- package/_mjs/TFuture/definition.mjs.map +1 -1
- package/_mjs/TSemaphore/api.mjs +4 -4
- package/_mjs/TSemaphore/api.mjs.map +1 -1
- package/_mjs/TSemaphore/definition.mjs +2 -3
- package/_mjs/TSemaphore/definition.mjs.map +1 -1
- package/_mjs/collection/immutable/Conc/dropUntilIO.mjs +26 -0
- package/_mjs/collection/immutable/Conc/dropUntilIO.mjs.map +1 -0
- package/_mjs/collection/immutable/Conc/dropWhileIO.mjs +26 -0
- package/_mjs/collection/immutable/Conc/dropWhileIO.mjs.map +1 -0
- package/_mjs/internal/Scheduler.mjs +62 -15
- package/_mjs/internal/Scheduler.mjs.map +1 -1
- package/_src/Cached/api.ts +3 -3
- package/_src/Channel/api/interruptWhen.ts +1 -1
- package/_src/Channel/api/mapOutIOC.ts +2 -2
- package/_src/Channel/api/mergeAll.ts +1 -1
- package/_src/Channel/api/mergeAllUnboundedWith.ts +1 -1
- package/_src/Channel/api/mergeAllWith.ts +3 -3
- package/_src/Channel/api/mergeMap.ts +1 -1
- package/_src/Channel/api/mergeWith.ts +9 -9
- package/_src/Channel/api/runScoped.ts +1 -1
- package/_src/Channel/api/toPull.ts +1 -1
- package/_src/Channel/api/zipC.ts +3 -3
- package/_src/Channel/api.ts +69 -69
- package/_src/Channel/core-api.ts +11 -11
- package/_src/Channel/definition.ts +12 -12
- package/_src/Channel/internal/MergeDecision.ts +1 -1
- package/_src/Clock/live.ts +1 -1
- package/_src/Fiber/FiberContext.ts +10 -8
- package/_src/Fiber/api/awaitAll.ts +1 -1
- package/_src/Fiber/api/evalOnIO.ts +1 -1
- package/_src/Fiber/api/joinAll.ts +1 -1
- package/_src/Fiber/definition.ts +1 -1
- package/_src/FiberRef/api/locallyScoped.ts +1 -1
- package/_src/FiberRef/api/locallyScopedWith.ts +1 -1
- package/_src/FiberRef/constructors.ts +2 -2
- package/_src/FiberRef/unsafe.ts +7 -0
- package/_src/Future/api.ts +3 -3
- package/_src/Future/constructors.ts +1 -1
- package/_src/Hub/api.ts +11 -11
- package/_src/Hub/definition.ts +6 -6
- package/_src/Hub/internal.ts +15 -15
- package/_src/IO/api/acquireRelease.ts +1 -1
- package/_src/IO/api/acquireReleaseExit.ts +1 -1
- package/_src/IO/api/acquireReleaseInterruptible.ts +1 -1
- package/_src/IO/api/acquireReleaseInterruptibleExit.ts +1 -1
- package/_src/IO/api/addFinalizer.ts +1 -1
- package/_src/IO/api/addFinalizerExit.ts +5 -7
- package/_src/IO/api/bracket.ts +1 -1
- package/_src/IO/api/bracketExit.ts +1 -1
- package/_src/IO/api/concurrentFinalizers.ts +1 -1
- package/_src/IO/api/core-scope.ts +1 -1
- package/_src/IO/api/ensuringChildren.ts +2 -2
- package/_src/IO/api/environment.ts +9 -11
- package/_src/IO/api/forkScoped.ts +1 -1
- package/_src/IO/api/interrupt.ts +3 -3
- package/_src/IO/api/memoize.ts +3 -3
- package/_src/IO/api/onExit.ts +1 -1
- package/_src/IO/api/onTermination.ts +1 -1
- package/_src/IO/api/provideSomeLayer.ts +1 -2
- package/_src/IO/api/race.ts +1 -1
- package/_src/IO/api/raceFirst.ts +1 -1
- package/_src/IO/api/repeat.ts +4 -4
- package/_src/IO/api/retry.ts +4 -4
- package/_src/IO/api/schedule.ts +3 -3
- package/_src/IO/api/scope.ts +1 -1
- package/_src/IO/api/scopeWith.ts +1 -1
- package/_src/IO/api/scoped.ts +2 -2
- package/_src/IO/api/sequenceT.ts +1 -1
- package/_src/IO/api/stateful.ts +1 -1
- package/_src/IO/api/withChildren.ts +1 -1
- package/_src/IO/api/withEarlyRelease.ts +1 -1
- package/_src/IO/api/withFinalizer.ts +1 -1
- package/_src/IO/api/withFinalizerExit.ts +1 -1
- package/_src/IO/api/zipC.ts +2 -2
- package/_src/IO/api.ts +48 -48
- package/_src/IO/definition.ts +29 -24
- package/_src/IO/runtime.ts +66 -12
- package/_src/IOEnv/definition.ts +1 -1
- package/_src/Layer/MemoMap.ts +19 -19
- package/_src/Layer/api.ts +38 -38
- package/_src/Layer/definition.ts +5 -5
- package/_src/Queue/api/dimapIO.ts +10 -10
- package/_src/Queue/api/filterInputIO.ts +4 -4
- package/_src/Queue/api/filterOutputIO.ts +6 -6
- package/_src/Queue/api/zipWithIO.ts +10 -10
- package/_src/Queue/definition.ts +7 -7
- package/_src/Queue/internal.ts +7 -7
- package/_src/Queue/strategy.ts +4 -4
- package/_src/Random/api.ts +1 -1
- package/_src/Ref/Atomic/Atomic.ts +3 -3
- package/_src/Ref/Derived.ts +3 -3
- package/_src/Ref/DerivedAll.ts +3 -3
- package/_src/Ref/Synchronized/api.ts +15 -15
- package/_src/Ref/Synchronized/constructors.ts +4 -4
- package/_src/Ref/Synchronized/definition.ts +2 -2
- package/_src/Ref/api/get.ts +2 -2
- package/_src/Ref/api/modify.ts +9 -9
- package/_src/Ref/api/set.ts +1 -1
- package/_src/Ref/definition.ts +13 -13
- package/_src/STM/api/core-api.ts +6 -6
- package/_src/STM/api/core-constructors.ts +7 -7
- package/_src/STM/api.ts +58 -89
- package/_src/STM/definition.ts +6 -6
- package/_src/STM/driver.ts +3 -3
- package/_src/STM/internal/Journal.ts +25 -16
- package/_src/Schedule/Decision.ts +10 -3
- package/_src/Schedule/Driver.ts +2 -2
- package/_src/Schedule/api/driver.ts +6 -6
- package/_src/Schedule/api.ts +97 -77
- package/_src/Schedule/definition.ts +1 -1
- package/_src/Scope/Finalizer/definition.ts +2 -2
- package/_src/Scope/ReleaseMap/api.ts +1 -1
- package/_src/Scope/ReleaseMap/definition.ts +1 -1
- package/_src/Scope/api.ts +11 -11
- package/_src/ScopedRef/api.ts +12 -17
- package/_src/ScopedRef/definition.ts +1 -1
- package/_src/Sink/api.ts +441 -86
- package/_src/State/api.ts +1 -1
- package/_src/Stream/api/zipAllWith.ts +2 -2
- package/_src/Stream/api/zipWith.ts +1 -1
- package/_src/Stream/api/zipWithChunks.ts +2 -2
- package/_src/Stream/api.ts +150 -149
- package/_src/Stream/definition.ts +3 -3
- package/_src/Stream/internal/Take.ts +1 -1
- package/_src/Supervisor/constructors.ts +7 -3
- package/_src/TFuture/api.ts +1 -1
- package/_src/TFuture/definition.ts +1 -1
- package/_src/TReentrantLock/api.ts +2 -2
- package/_src/TRef/api.ts +11 -11
- package/_src/TRef/constructors.ts +2 -2
- package/_src/TSemaphore/api.ts +2 -2
- package/_src/TSemaphore/definition.ts +1 -1
- package/_src/collection/immutable/Conc/dropUntilIO.ts +24 -0
- package/_src/collection/immutable/Conc/dropWhileIO.ts +26 -0
- package/_src/internal/Scheduler.ts +59 -15
- package/collection/immutable/Conc/dropUntilIO.d.ts +7 -0
- package/collection/immutable/Conc/dropWhileIO.d.ts +7 -0
- package/internal/Scheduler.d.ts +18 -1
- package/package.json +3 -3
package/_src/Stream/api.ts
CHANGED
@@ -42,7 +42,7 @@ export function absolve<R, E, E2, A>(self: Stream<R, E, Either<E2, A>>): Stream<
|
|
42
42
|
export function aggregateAsync_<R, E, A extends A1, R1, E1, A1, B>(
|
43
43
|
stream: Stream<R, E, A>,
|
44
44
|
sink: Sink<R1, E1, A1, A1, B>,
|
45
|
-
): Stream<R
|
45
|
+
): Stream<R | R1, E | E1, B> {
|
46
46
|
return stream.aggregateAsyncWithin(sink, Schedule.forever);
|
47
47
|
}
|
48
48
|
|
@@ -55,7 +55,7 @@ export function aggregateAsyncWithin_<R, E, A extends A1, R1, E1, A1, B, R2, C>(
|
|
55
55
|
stream: Stream<R, E, A>,
|
56
56
|
sink: Sink<R1, E1, A1, A1, B>,
|
57
57
|
schedule: Schedule<R2, Maybe<B>, C>,
|
58
|
-
): Stream<R
|
58
|
+
): Stream<R | R1 | R2, E | E1, B> {
|
59
59
|
return stream.aggregateAsyncWithinEither(sink, schedule).filterMap((cb) => cb.match(() => Nothing(), Maybe.just));
|
60
60
|
}
|
61
61
|
|
@@ -77,7 +77,7 @@ export function aggregateAsyncWithinEither_<R, E, A extends A1, R1, E1, A1, B, R
|
|
77
77
|
stream: Stream<R, E, A>,
|
78
78
|
sink: Sink<R1, E1, A1, A1, B>,
|
79
79
|
schedule: Schedule<R2, Maybe<B>, C>,
|
80
|
-
): Stream<R
|
80
|
+
): Stream<R | R1 | R2, E | E1, Either<C, B>> {
|
81
81
|
type LocalHandoffSignal = HandoffSignal<E | E1, A1>;
|
82
82
|
|
83
83
|
const deps = IO.sequenceT(
|
@@ -89,13 +89,13 @@ export function aggregateAsyncWithinEither_<R, E, A extends A1, R1, E1, A1, B, R
|
|
89
89
|
);
|
90
90
|
|
91
91
|
return Stream.fromIO(deps).flatMap(([handoff, sinkEndReason, sinkLeftovers, scheduleDriver, consumed]) => {
|
92
|
-
const handoffProducer: Channel<
|
92
|
+
const handoffProducer: Channel<never, E | E1, Conc<A1>, unknown, never, never, any> = Channel.readWithCause(
|
93
93
|
(_in: Conc<A1>) => Channel.fromIO(handoff.offer(HandoffSignal.Emit(_in))).apSecond(handoffProducer),
|
94
94
|
(cause: Cause<E | E1>) => Channel.fromIO(handoff.offer(HandoffSignal.Halt(cause))),
|
95
95
|
(_: any) => Channel.fromIO(handoff.offer(HandoffSignal.End(new UpstreamEnd()))),
|
96
96
|
);
|
97
97
|
|
98
|
-
const handoffConsumer: Channel<
|
98
|
+
const handoffConsumer: Channel<never, unknown, unknown, unknown, E | E1, Conc<A1>, void> = Channel.unwrap(
|
99
99
|
sinkLeftovers.getAndSet(Conc.empty<A>()).flatMap((leftovers) => {
|
100
100
|
if (leftovers.isNonEmpty) {
|
101
101
|
return consumed.set(true) > IO.succeedNow(Channel.writeNow(leftovers) > handoffConsumer);
|
@@ -130,7 +130,7 @@ export function aggregateAsyncWithinEither_<R, E, A extends A1, R1, E1, A1, B, R
|
|
130
130
|
const scheduledAggregator = (
|
131
131
|
sinkFiber: Fiber.Runtime<E | E1, readonly [Conc<Conc<A1>>, B]>,
|
132
132
|
scheduleFiber: Fiber.Runtime<Nothing, C>,
|
133
|
-
): Channel<R1
|
133
|
+
): Channel<R1 | R2, unknown, unknown, unknown, E | E1, Conc<Either<C, B>>, any> => {
|
134
134
|
const forkSink =
|
135
135
|
consumed.set(false) > handoffConsumer.pipeToOrFail(sink.channel).doneCollect.runScoped.forkScoped;
|
136
136
|
|
@@ -207,7 +207,7 @@ export function aggregateAsyncWithinEither_<R, E, A extends A1, R1, E1, A1, B, R
|
|
207
207
|
export function apFirst_<R, R1, E, E1, A, A1>(
|
208
208
|
stream: Stream<R, E, A>,
|
209
209
|
that: Stream<R1, E1, A1>,
|
210
|
-
): Stream<R
|
210
|
+
): Stream<R | R1, E | E1, A> {
|
211
211
|
return stream.crossWith(that, (a, _) => a);
|
212
212
|
}
|
213
213
|
|
@@ -221,7 +221,7 @@ export function apFirst_<R, R1, E, E1, A, A1>(
|
|
221
221
|
export function apSecond_<R, R1, E, E1, A, A1>(
|
222
222
|
stream: Stream<R, E, A>,
|
223
223
|
that: Stream<R1, E1, A1>,
|
224
|
-
): Stream<R
|
224
|
+
): Stream<R | R1, E | E1, A1> {
|
225
225
|
return stream.crossWith(that, (_, b) => b);
|
226
226
|
}
|
227
227
|
|
@@ -257,7 +257,7 @@ export function asyncInterrupt<R, E, A>(
|
|
257
257
|
);
|
258
258
|
return eitherStream.match(
|
259
259
|
(canceler) => {
|
260
|
-
const loop: Channel<
|
260
|
+
const loop: Channel<never, unknown, unknown, unknown, E, Conc<A>, void> = Channel.unwrap(
|
261
261
|
output.take
|
262
262
|
.flatMap((take) => take.done)
|
263
263
|
.match(
|
@@ -311,7 +311,7 @@ export function asyncIO<R, E, A, R1 = R, E1 = E>(
|
|
311
311
|
resolve: (next: IO<R, Maybe<E>, Conc<A>>, offerCb?: (e: Exit<never, boolean>) => void) => void,
|
312
312
|
) => IO<R1, E1, unknown>,
|
313
313
|
outputBuffer = 16,
|
314
|
-
): Stream<R
|
314
|
+
): Stream<R | R1, E | E1, A> {
|
315
315
|
return new Stream(
|
316
316
|
Channel.unwrapScoped(
|
317
317
|
Do((Δ) => {
|
@@ -325,7 +325,7 @@ export function asyncIO<R, E, A, R1 = R, E1 = E>(
|
|
325
325
|
),
|
326
326
|
),
|
327
327
|
);
|
328
|
-
const loop: Channel<
|
328
|
+
const loop: Channel<never, unknown, unknown, unknown, E, Conc<A>, void> = Channel.unwrap(
|
329
329
|
output.take
|
330
330
|
.flatMap((take) => take.done)
|
331
331
|
.matchCauseIO(
|
@@ -362,7 +362,7 @@ export function bimap_<R, E, E1, A, A1>(stream: Stream<R, E, A>, f: (e: E) => E1
|
|
362
362
|
export function acquireRelease_<R, E, A, R1>(
|
363
363
|
acquire: IO<R, E, A>,
|
364
364
|
release: (a: A) => IO<R1, never, unknown>,
|
365
|
-
): Stream<R
|
365
|
+
): Stream<R | R1, E, A> {
|
366
366
|
return Stream.scoped(IO.acquireRelease(acquire, release));
|
367
367
|
}
|
368
368
|
|
@@ -375,7 +375,7 @@ export function acquireRelease_<R, E, A, R1>(
|
|
375
375
|
export function acquireReleaseExit_<R, E, A, R1>(
|
376
376
|
acquire: IO<R, E, A>,
|
377
377
|
release: (a: A, exit: Exit<any, any>) => IO<R1, never, unknown>,
|
378
|
-
): Stream<R
|
378
|
+
): Stream<R | R1, E, A> {
|
379
379
|
return Stream.scoped(IO.acquireReleaseExit(acquire, release));
|
380
380
|
}
|
381
381
|
|
@@ -390,7 +390,7 @@ export function broadcast_<R, E, A>(
|
|
390
390
|
stream: Stream<R, E, A>,
|
391
391
|
n: number,
|
392
392
|
maximumLag: number,
|
393
|
-
): IO<R
|
393
|
+
): IO<R | Scope, never, Conc<Stream<unknown, E, A>>> {
|
394
394
|
return stream
|
395
395
|
.broadcastedQueues(n, maximumLag)
|
396
396
|
.map((c) => c.map((hub) => Stream.fromQueueWithShutdown(hub).flattenTake));
|
@@ -406,7 +406,7 @@ export function broadcast_<R, E, A>(
|
|
406
406
|
export function broadcastDynamic_<R, E, A>(
|
407
407
|
stream: Stream<R, E, A>,
|
408
408
|
maximumLag: number,
|
409
|
-
): IO<R
|
409
|
+
): IO<R | Scope, never, Stream<unknown, E, A>> {
|
410
410
|
return stream
|
411
411
|
.broadcastedQueuesDynamic(maximumLag)
|
412
412
|
.map((scoped) => Stream.scoped(scoped).flatMap(Stream.fromQueue).flattenTake);
|
@@ -424,7 +424,7 @@ export function broadcastedQueues_<R, E, A>(
|
|
424
424
|
stream: Stream<R, E, A>,
|
425
425
|
n: number,
|
426
426
|
maximumLag: number,
|
427
|
-
): IO<R
|
427
|
+
): IO<R | Scope, never, Conc<Hub.Dequeue<unknown, never, Take<E, A>>>> {
|
428
428
|
return Do((Δ) => {
|
429
429
|
const hub = Δ(Hub.makeBounded<Take<E, A>>(maximumLag));
|
430
430
|
const queues = Δ(IO.sequenceIterable(Conc.replicate(n, hub.subscribe)));
|
@@ -444,7 +444,7 @@ export function broadcastedQueues_<R, E, A>(
|
|
444
444
|
export function broadcastedQueuesDynamic_<R, E, A>(
|
445
445
|
stream: Stream<R, E, A>,
|
446
446
|
maximumLag: number,
|
447
|
-
): IO<R
|
447
|
+
): IO<R | Scope, never, IO<Scope, never, Hub.Dequeue<never, never, Take<E, A>>>> {
|
448
448
|
return stream.toHub(maximumLag).map((hub) => hub.subscribe);
|
449
449
|
}
|
450
450
|
|
@@ -459,13 +459,12 @@ export function buffer_<R, E, A>(stream: Stream<R, E, A>, capacity: number): Str
|
|
459
459
|
return new Stream(
|
460
460
|
Channel.unwrapScoped(
|
461
461
|
queue.map((queue) => {
|
462
|
-
const process: Channel<
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
),
|
462
|
+
const process: Channel<never, unknown, unknown, unknown, E, Conc<A>, void> = Channel.fromIO(queue.take).flatMap(
|
463
|
+
(exit: Exit<Maybe<E>, A>) =>
|
464
|
+
exit.match(
|
465
|
+
(cause) => cause.flipCauseMaybe.match(() => Channel.endNow(undefined), Channel.failCauseNow),
|
466
|
+
(value) => Channel.writeNow(Conc.single(value)).apSecond(process),
|
467
|
+
),
|
469
468
|
);
|
470
469
|
return process;
|
471
470
|
}),
|
@@ -481,12 +480,11 @@ export function bufferChunks_<R, E, A>(stream: Stream<R, E, A>, capacity: number
|
|
481
480
|
return new Stream(
|
482
481
|
Channel.unwrapScoped(
|
483
482
|
queue.map((queue) => {
|
484
|
-
const process: Channel<
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
),
|
483
|
+
const process: Channel<never, unknown, unknown, unknown, E, Conc<A>, void> = Channel.fromIO(queue.take).flatMap(
|
484
|
+
(take: Take<E, A>) =>
|
485
|
+
take.match(Channel.endNow(undefined), Channel.failCauseNow, (value) =>
|
486
|
+
Channel.writeNow(value).apSecond(process),
|
487
|
+
),
|
490
488
|
);
|
491
489
|
return process;
|
492
490
|
}),
|
@@ -506,12 +504,11 @@ export function bufferUnbounded<R, E, A>(stream: Stream<R, E, A>): Stream<R, E,
|
|
506
504
|
return new Stream(
|
507
505
|
Channel.unwrapScoped(
|
508
506
|
queue.map((queue) => {
|
509
|
-
const process: Channel<
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
),
|
507
|
+
const process: Channel<never, unknown, unknown, unknown, E, Conc<A>, void> = Channel.fromIO(queue.take).flatMap(
|
508
|
+
(take) =>
|
509
|
+
take.match(Channel.endNow(undefined), Channel.failCauseNow, (value) =>
|
510
|
+
Channel.writeNow(value).apSecond(process),
|
511
|
+
),
|
515
512
|
);
|
516
513
|
|
517
514
|
return process;
|
@@ -520,11 +517,11 @@ export function bufferUnbounded<R, E, A>(stream: Stream<R, E, A>): Stream<R, E,
|
|
520
517
|
);
|
521
518
|
}
|
522
519
|
|
523
|
-
function bufferSignalProducer<
|
520
|
+
function bufferSignalProducer<E, A>(
|
524
521
|
queue: Queue<readonly [Take<E, A>, Future<never, void>]>,
|
525
522
|
ref: Ref<Future<never, void>>,
|
526
|
-
): Channel<
|
527
|
-
const terminate = (take: Take<E, A>): Channel<
|
523
|
+
): Channel<never, E, Conc<A>, unknown, never, never, unknown> {
|
524
|
+
const terminate = (take: Take<E, A>): Channel<never, E, Conc<A>, unknown, never, never, unknown> =>
|
528
525
|
Channel.fromIO(
|
529
526
|
Do((Δ) => {
|
530
527
|
const latch = Δ(ref.get);
|
@@ -552,7 +549,7 @@ function bufferSignalProducer<R, E, A>(
|
|
552
549
|
function bufferSignalConsumer<R, E, A>(
|
553
550
|
queue: Queue<readonly [Take<E, A>, Future<never, void>]>,
|
554
551
|
): Channel<R, unknown, unknown, unknown, E, Conc<A>, void> {
|
555
|
-
const process: Channel<
|
552
|
+
const process: Channel<never, unknown, unknown, unknown, E, Conc<A>, void> = Channel.fromIO(queue.take).flatMap(
|
556
553
|
([take, promise]) =>
|
557
554
|
Channel.fromIO(promise.succeed(undefined)).apSecond(
|
558
555
|
take.match(Channel.endNow(undefined), Channel.failCauseNow, (value) =>
|
@@ -572,7 +569,7 @@ function bufferSignalConsumer<R, E, A>(
|
|
572
569
|
export function catchAll_<R, R1, E, E1, A, A1>(
|
573
570
|
stream: Stream<R, E, A>,
|
574
571
|
f: (e: E) => Stream<R1, E1, A1>,
|
575
|
-
): Stream<R
|
572
|
+
): Stream<R | R1, E1, A | A1> {
|
576
573
|
return stream.catchAllCause((cause) => cause.failureOrCause.match(f, Stream.failCauseNow));
|
577
574
|
}
|
578
575
|
|
@@ -586,8 +583,8 @@ export function catchAll_<R, R1, E, E1, A, A1>(
|
|
586
583
|
export function catchAllCause_<R, R1, E, E1, A, A1>(
|
587
584
|
stream: Stream<R, E, A>,
|
588
585
|
f: (cause: Cause<E>) => Stream<R1, E1, A1>,
|
589
|
-
): Stream<R
|
590
|
-
const channel: Channel<R
|
586
|
+
): Stream<R | R1, E1, A | A1> {
|
587
|
+
const channel: Channel<R | R1, unknown, unknown, unknown, E1, Conc<A | A1>, unknown> = stream.channel.catchAllCause(
|
591
588
|
(cause) => f(cause).channel,
|
592
589
|
);
|
593
590
|
return new Stream(channel);
|
@@ -602,7 +599,7 @@ export function catchAllCause_<R, R1, E, E1, A, A1>(
|
|
602
599
|
export function catchJust_<R, R1, E, E1, A, A1>(
|
603
600
|
stream: Stream<R, E, A>,
|
604
601
|
pf: (e: E) => Maybe<Stream<R1, E1, A1>>,
|
605
|
-
): Stream<R
|
602
|
+
): Stream<R | R1, E | E1, A | A1> {
|
606
603
|
return stream.catchAll((e) => pf(e).getOrElse(Stream.failNow(e)));
|
607
604
|
}
|
608
605
|
|
@@ -616,7 +613,7 @@ export function catchJust_<R, R1, E, E1, A, A1>(
|
|
616
613
|
export function catchJustCause_<R, R1, E, E1, A, A1>(
|
617
614
|
stream: Stream<R, E, A>,
|
618
615
|
pf: (e: Cause<E>) => Maybe<Stream<R1, E1, A1>>,
|
619
|
-
): Stream<R
|
616
|
+
): Stream<R | R1, E | E1, A | A1> {
|
620
617
|
return stream.catchAllCause((cause) => pf(cause).getOrElse(Stream.failCauseNow(cause)));
|
621
618
|
}
|
622
619
|
|
@@ -629,7 +626,7 @@ export function catchJustCause_<R, R1, E, E1, A, A1>(
|
|
629
626
|
export function flatMap_<R, E, A, R1, E1, B>(
|
630
627
|
stream: Stream<R, E, A>,
|
631
628
|
f: (a: A) => Stream<R1, E1, B>,
|
632
|
-
): Stream<R
|
629
|
+
): Stream<R | R1, E | E1, B> {
|
633
630
|
return new Stream(
|
634
631
|
stream.channel.concatMap((as) =>
|
635
632
|
as
|
@@ -709,14 +706,14 @@ export function collectWhile_<R, E, A, A1>(stream: Stream<R, E, A>, pf: (a: A) =
|
|
709
706
|
export function collectWhileIO_<R, E, A, R1, E1, B>(
|
710
707
|
stream: Stream<R, E, A>,
|
711
708
|
pf: (a: A) => Maybe<IO<R1, E1, B>>,
|
712
|
-
): Stream<R
|
709
|
+
): Stream<R | R1, E | E1, B> {
|
713
710
|
return new Stream(stream.channel.pipeTo(collectWhileIOLoop(Iterable.empty<A>()[Symbol.iterator](), pf)));
|
714
711
|
}
|
715
712
|
|
716
713
|
function collectWhileIOLoop<R, E, A, R1, E1, B>(
|
717
714
|
iterator: Iterator<A>,
|
718
715
|
pf: (a: A) => Maybe<IO<R1, E1, B>>,
|
719
|
-
): Channel<R
|
716
|
+
): Channel<R | R1, E, Conc<A>, unknown, E | E1, Conc<B>, unknown> {
|
720
717
|
const next = iterator.next();
|
721
718
|
if (next.done) {
|
722
719
|
return Channel.readWithCause(
|
@@ -737,7 +734,7 @@ function collectWhileIOLoop<R, E, A, R1, E1, B>(
|
|
737
734
|
function combineProducer<Err, Elem>(
|
738
735
|
handoff: Handoff<Exit<Maybe<Err>, Elem>>,
|
739
736
|
latch: Handoff<void>,
|
740
|
-
): Channel<
|
737
|
+
): Channel<never, Err, Elem, unknown, never, never, any> {
|
741
738
|
return Channel.fromIO(latch.take).apSecond(
|
742
739
|
Channel.readWithCause(
|
743
740
|
(value) => Channel.fromIO(handoff.offer(Exit.succeed(value))).apSecond(combineProducer(handoff, latch)),
|
@@ -766,7 +763,7 @@ export function combine_<R, E, A, R1, E1, A1, S, R2, A2>(
|
|
766
763
|
eff1: IO<R, Maybe<E>, A>,
|
767
764
|
eff2: IO<R1, Maybe<E1>, A1>,
|
768
765
|
) => IO<R2, never, Exit<Maybe<E | E1>, readonly [A2, S]>>,
|
769
|
-
): Stream<R
|
766
|
+
): Stream<R | R1 | R2, E | E1, A2> {
|
770
767
|
return new Stream(
|
771
768
|
Channel.unwrapScoped(
|
772
769
|
Do((Δ) => {
|
@@ -790,7 +787,7 @@ export function combine_<R, E, A, R1, E1, A1, S, R2, A2>(
|
|
790
787
|
function combineChunksProducer<Err, Elem>(
|
791
788
|
handoff: Handoff<Take<Err, Elem>>,
|
792
789
|
latch: Handoff<void>,
|
793
|
-
): Channel<
|
790
|
+
): Channel<never, Err, Conc<Elem>, unknown, never, never, any> {
|
794
791
|
return Channel.fromIO(latch.take).apSecond(
|
795
792
|
Channel.readWithCause(
|
796
793
|
(chunk) => Channel.fromIO(handoff.offer(Take.chunk(chunk))).apSecond(combineChunksProducer(handoff, latch)),
|
@@ -817,7 +814,7 @@ export function combineChunks_<R, E, A, R1, E1, A1, S, R2, A2>(
|
|
817
814
|
l: IO<R, Maybe<E>, Conc<A>>,
|
818
815
|
r: IO<R1, Maybe<E1>, Conc<A1>>,
|
819
816
|
) => IO<R2, never, Exit<Maybe<E | E1>, readonly [Conc<A2>, S]>>,
|
820
|
-
): Stream<R1
|
817
|
+
): Stream<R1 | R | R2, E | E1, A2> {
|
821
818
|
return new Stream(
|
822
819
|
Channel.unwrapScoped(
|
823
820
|
Do((Δ) => {
|
@@ -853,8 +850,8 @@ export function combineChunks_<R, E, A, R1, E1, A1, S, R2, A2>(
|
|
853
850
|
export function concat_<R, R1, E, E1, A, A1>(
|
854
851
|
stream: Stream<R, E, A>,
|
855
852
|
that: Stream<R1, E1, A1>,
|
856
|
-
): Stream<R
|
857
|
-
return new Stream<R
|
853
|
+
): Stream<R | R1, E | E1, A | A1> {
|
854
|
+
return new Stream<R | R1, E | E1, A | A1>(stream.channel.apSecond(that.channel));
|
858
855
|
}
|
859
856
|
|
860
857
|
/**
|
@@ -866,7 +863,7 @@ export function concat_<R, R1, E, E1, A, A1>(
|
|
866
863
|
export function cross_<R, E, A, R1, E1, B>(
|
867
864
|
stream: Stream<R, E, A>,
|
868
865
|
that: Stream<R1, E1, B>,
|
869
|
-
): Stream<R
|
866
|
+
): Stream<R | R1, E | E1, readonly [A, B]> {
|
870
867
|
return new Stream(
|
871
868
|
stream.channel.concatMap((as) => that.channel.mapOut((bs) => as.flatMap((a) => bs.map((b) => tuple(a, b))))),
|
872
869
|
);
|
@@ -883,7 +880,7 @@ export function crossWith_<R, E, A, R1, E1, B, C>(
|
|
883
880
|
fa: Stream<R, E, A>,
|
884
881
|
fb: Stream<R1, E1, B>,
|
885
882
|
f: (a: A, b: B) => C,
|
886
|
-
): Stream<R
|
883
|
+
): Stream<R | R1, E | E1, C> {
|
887
884
|
return fa.flatMap((a) => fb.map((b) => f(a, b)));
|
888
885
|
}
|
889
886
|
|
@@ -973,7 +970,7 @@ export function debounce_<R, E, A>(stream: Stream<R, E, A>, duration: Lazy<Durat
|
|
973
970
|
|
974
971
|
function defaultIfEmptyWriter<R, E, A, R1, E1, B>(
|
975
972
|
fb: Stream<R1, E1, B>,
|
976
|
-
): Channel<R
|
973
|
+
): Channel<R | R1, E, Conc<A>, unknown, E | E1, Conc<A | B>, unknown> {
|
977
974
|
return Channel.readWith(
|
978
975
|
(i: Conc<A>) =>
|
979
976
|
i.isEmpty ? defaultIfEmptyWriter(fb) : Channel.writeNow(i).apSecond(Channel.id<E, Conc<A>, unknown>()),
|
@@ -990,7 +987,7 @@ function defaultIfEmptyWriter<R, E, A, R1, E1, B>(
|
|
990
987
|
export function defaultIfEmpty_<R, E, A, R1, E1, B>(
|
991
988
|
fa: Stream<R, E, A>,
|
992
989
|
fb: Stream<R1, E1, B>,
|
993
|
-
): Stream<R
|
990
|
+
): Stream<R | R1, E | E1, A | B> {
|
994
991
|
return new Stream(fa.channel.pipeTo(defaultIfEmptyWriter(fb)));
|
995
992
|
}
|
996
993
|
|
@@ -1006,7 +1003,7 @@ export function distributedWith_<R, E, A>(
|
|
1006
1003
|
n: number,
|
1007
1004
|
maximumLag: number,
|
1008
1005
|
decide: (_: A) => UIO<(_: number) => boolean>,
|
1009
|
-
): IO<R
|
1006
|
+
): IO<R | Scope, never, Conc<Queue.Dequeue<Exit<Maybe<E>, A>>>> {
|
1010
1007
|
return Future.make<never, (a: A) => UIO<(_: symbol) => boolean>>().flatMap((p) =>
|
1011
1008
|
self
|
1012
1009
|
.distributedWithDynamic(
|
@@ -1043,7 +1040,7 @@ export function distributedWithDynamic_<R, E, A>(
|
|
1043
1040
|
maximumLag: number,
|
1044
1041
|
decide: (a: A) => UIO<(_: symbol) => boolean>,
|
1045
1042
|
done: (exit: Exit<Maybe<E>, never>) => UIO<any> = () => IO.unit,
|
1046
|
-
): IO<R
|
1043
|
+
): IO<R | Scope, never, UIO<readonly [symbol, Queue.Dequeue<Exit<Maybe<E>, A>>]>> {
|
1047
1044
|
const offer = (queuesRef: Ref<HashMap<symbol, Queue<Exit<Maybe<E>, A>>>>) => (a: A) =>
|
1048
1045
|
Do((Δ) => {
|
1049
1046
|
const shouldProcess = Δ(decide(a));
|
@@ -1192,11 +1189,11 @@ export function either<R, E, A>(stream: Stream<R, E, A>): Stream<R, never, Eithe
|
|
1192
1189
|
/**
|
1193
1190
|
* @tsplus static fncts.io.StreamOps empty
|
1194
1191
|
*/
|
1195
|
-
export const empty: Stream<
|
1192
|
+
export const empty: Stream<never, never, never> = Stream.fromChunkNow(Conc.empty<never>());
|
1196
1193
|
|
1197
1194
|
function endWhenWriter<E, A, E1>(
|
1198
1195
|
fiber: Fiber<E1, any>,
|
1199
|
-
): Channel<
|
1196
|
+
): Channel<never, E | E1, Conc<A>, unknown, E | E1, Conc<A>, void> {
|
1200
1197
|
return Channel.unwrap(
|
1201
1198
|
fiber.poll.map((maybeExit) =>
|
1202
1199
|
maybeExit.match(
|
@@ -1223,14 +1220,14 @@ function endWhenWriter<E, A, E1>(
|
|
1223
1220
|
*
|
1224
1221
|
* @tsplus fluent fncts.io.Stream endWhen
|
1225
1222
|
*/
|
1226
|
-
export function endWhen_<R, E, A, R1, E1>(stream: Stream<R, E, A>, io: IO<R1, E1, any>): Stream<R
|
1223
|
+
export function endWhen_<R, E, A, R1, E1>(stream: Stream<R, E, A>, io: IO<R1, E1, any>): Stream<R | R1, E | E1, A> {
|
1227
1224
|
return new Stream(Channel.unwrapScoped(io.forkScoped.map((fiber) => stream.channel.pipeTo(endWhenWriter(fiber)))));
|
1228
1225
|
}
|
1229
1226
|
|
1230
1227
|
/**
|
1231
1228
|
* @tsplus fluent fncts.io.Stream ensuring
|
1232
1229
|
*/
|
1233
|
-
export function ensuring_<R, E, A, R1>(self: Stream<R, E, A>, finalizer: IO<R1, never, any>): Stream<R
|
1230
|
+
export function ensuring_<R, E, A, R1>(self: Stream<R, E, A>, finalizer: IO<R1, never, any>): Stream<R | R1, E, A> {
|
1234
1231
|
return new Stream(self.channel.ensuring(finalizer));
|
1235
1232
|
}
|
1236
1233
|
|
@@ -1255,7 +1252,7 @@ export function environmentWith<R, A>(f: (r: Environment<R>) => A): Stream<R, ne
|
|
1255
1252
|
*
|
1256
1253
|
* @tsplus static fncts.io.StreamOps environmentWithIO
|
1257
1254
|
*/
|
1258
|
-
export function environmentWithIO<R0, R, E, A>(f: (r0: Environment<R0>) => IO<R, E, A>): Stream<R0
|
1255
|
+
export function environmentWithIO<R0, R, E, A>(f: (r0: Environment<R0>) => IO<R, E, A>): Stream<R0 | R, E, A> {
|
1259
1256
|
return Stream.environment<R0>().mapIO(f);
|
1260
1257
|
}
|
1261
1258
|
|
@@ -1264,7 +1261,7 @@ export function environmentWithIO<R0, R, E, A>(f: (r0: Environment<R0>) => IO<R,
|
|
1264
1261
|
*
|
1265
1262
|
* @tsplus static fncts.io.StreamOps environmentWithStream
|
1266
1263
|
*/
|
1267
|
-
export function environmentWithStream<R0, R, E, A>(f: (r0: Environment<R0>) => Stream<R, E, A>): Stream<R0
|
1264
|
+
export function environmentWithStream<R0, R, E, A>(f: (r0: Environment<R0>) => Stream<R, E, A>): Stream<R0 | R, E, A> {
|
1268
1265
|
return Stream.environment<R0>().flatMap(f);
|
1269
1266
|
}
|
1270
1267
|
|
@@ -1273,7 +1270,7 @@ export function environmentWithStream<R0, R, E, A>(f: (r0: Environment<R0>) => S
|
|
1273
1270
|
*
|
1274
1271
|
* @tsplus static fncts.io.StreamOps failNow
|
1275
1272
|
*/
|
1276
|
-
export function failNow<E>(error: E): Stream<
|
1273
|
+
export function failNow<E>(error: E): Stream<never, E, never> {
|
1277
1274
|
return new Stream(Channel.failNow(error));
|
1278
1275
|
}
|
1279
1276
|
|
@@ -1282,7 +1279,7 @@ export function failNow<E>(error: E): Stream<unknown, E, never> {
|
|
1282
1279
|
*
|
1283
1280
|
* @tsplus static fncts.io.StreamOps fail
|
1284
1281
|
*/
|
1285
|
-
export function fail<E>(error: Lazy<E>): Stream<
|
1282
|
+
export function fail<E>(error: Lazy<E>): Stream<never, E, never> {
|
1286
1283
|
return new Stream(Channel.fail(error));
|
1287
1284
|
}
|
1288
1285
|
|
@@ -1291,7 +1288,7 @@ export function fail<E>(error: Lazy<E>): Stream<unknown, E, never> {
|
|
1291
1288
|
*
|
1292
1289
|
* @tsplus static fncts.io.StreamOps failCauseNow
|
1293
1290
|
*/
|
1294
|
-
export function failCauseNow<E>(cause: Cause<E>): Stream<
|
1291
|
+
export function failCauseNow<E>(cause: Cause<E>): Stream<never, E, never> {
|
1295
1292
|
return Stream.fromIO(IO.failCauseNow(cause));
|
1296
1293
|
}
|
1297
1294
|
|
@@ -1300,7 +1297,7 @@ export function failCauseNow<E>(cause: Cause<E>): Stream<unknown, E, never> {
|
|
1300
1297
|
*
|
1301
1298
|
* @tsplus static fncts.io.StreamOps failCause
|
1302
1299
|
*/
|
1303
|
-
export function failCause<E>(cause: Lazy<Cause<E>>): Stream<
|
1300
|
+
export function failCause<E>(cause: Lazy<Cause<E>>): Stream<never, E, never> {
|
1304
1301
|
return Stream.fromIO(IO.failCause(cause));
|
1305
1302
|
}
|
1306
1303
|
|
@@ -1319,14 +1316,14 @@ export function filter_<R, E, A>(fa: Stream<R, E, A>, predicate: Predicate<A>):
|
|
1319
1316
|
export function filterIO_<R, E, A, R1, E1>(
|
1320
1317
|
fa: Stream<R, E, A>,
|
1321
1318
|
f: (a: A) => IO<R1, E1, boolean>,
|
1322
|
-
): Stream<R
|
1319
|
+
): Stream<R | R1, E | E1, A> {
|
1323
1320
|
return new Stream(fa.channel.pipeTo(filterIOLoop(Iterable.empty<A>()[Symbol.iterator](), f)));
|
1324
1321
|
}
|
1325
1322
|
|
1326
1323
|
function filterIOLoop<R, E, A, R1, E1>(
|
1327
1324
|
iterator: Iterator<A>,
|
1328
1325
|
f: (a: A) => IO<R1, E1, boolean>,
|
1329
|
-
): Channel<R
|
1326
|
+
): Channel<R | R1, E, Conc<A>, unknown, E | E1, Conc<A>, unknown> {
|
1330
1327
|
const next = iterator.next();
|
1331
1328
|
if (next.done) {
|
1332
1329
|
return Channel.readWithCause(
|
@@ -1358,14 +1355,14 @@ export function filterMap_<R, E, A, B>(fa: Stream<R, E, A>, f: (a: A) => Maybe<B
|
|
1358
1355
|
export function filterMapIO_<R, E, A, R1, E1, B>(
|
1359
1356
|
fa: Stream<R, E, A>,
|
1360
1357
|
f: (a: A) => IO<R1, E1, Maybe<B>>,
|
1361
|
-
): Stream<R
|
1358
|
+
): Stream<R | R1, E | E1, B> {
|
1362
1359
|
return new Stream(fa.channel.pipeTo(filterMapIOLoop<R, E, A, R1, E1, B>(Iterable.empty<A>()[Symbol.iterator](), f)));
|
1363
1360
|
}
|
1364
1361
|
|
1365
1362
|
function filterMapIOLoop<R, E, A, R1, E1, B>(
|
1366
1363
|
iterator: Iterator<A>,
|
1367
1364
|
f: (a: A) => IO<R1, E1, Maybe<B>>,
|
1368
|
-
): Channel<R
|
1365
|
+
): Channel<R | R1, E, Conc<A>, unknown, E | E1, Conc<B>, unknown> {
|
1369
1366
|
const next = iterator.next();
|
1370
1367
|
if (next.done) {
|
1371
1368
|
return Channel.readWithCause(
|
@@ -1411,8 +1408,8 @@ export function find_<R, E, A>(stream: Stream<R, E, A>, p: Predicate<A>): Stream
|
|
1411
1408
|
export function findIO_<R, E, A, R1, E1>(
|
1412
1409
|
stream: Stream<R, E, A>,
|
1413
1410
|
f: (a: A) => IO<R1, E1, boolean>,
|
1414
|
-
): Stream<R
|
1415
|
-
const loop: Channel<R
|
1411
|
+
): Stream<R | R1, E | E1, A> {
|
1412
|
+
const loop: Channel<R | R1, E, Conc<A>, unknown, E | E1, Conc<A>, unknown> = Channel.readWith(
|
1416
1413
|
(inp: Conc<A>) =>
|
1417
1414
|
Channel.unwrap(
|
1418
1415
|
inp.findIO(f).map((maybeA) =>
|
@@ -1434,7 +1431,7 @@ export function findIO_<R, E, A, R1, E1>(
|
|
1434
1431
|
*
|
1435
1432
|
* @tsplus getter fncts.io.Stream flatten
|
1436
1433
|
*/
|
1437
|
-
export function flatten<R, E, R1, E1, A>(self: Stream<R, E, Stream<R1, E1, A>>): Stream<R
|
1434
|
+
export function flatten<R, E, R1, E1, A>(self: Stream<R, E, Stream<R1, E1, A>>): Stream<R | R1, E | E1, A> {
|
1438
1435
|
return self.flatMap(identity);
|
1439
1436
|
}
|
1440
1437
|
|
@@ -1505,7 +1502,7 @@ export function forever<R, E, A>(stream: Stream<R, E, A>): Stream<R, E, A> {
|
|
1505
1502
|
*
|
1506
1503
|
* @tsplus static fncts.io.StreamOps fromChunkNow
|
1507
1504
|
*/
|
1508
|
-
export function fromChunkNow<O>(c: Conc<O>): Stream<
|
1505
|
+
export function fromChunkNow<O>(c: Conc<O>): Stream<never, never, O> {
|
1509
1506
|
return new Stream(Channel.defer(() => (c.isEmpty ? Channel.unit : Channel.writeNow(c))));
|
1510
1507
|
}
|
1511
1508
|
|
@@ -1514,7 +1511,7 @@ export function fromChunkNow<O>(c: Conc<O>): Stream<unknown, never, O> {
|
|
1514
1511
|
*
|
1515
1512
|
* @tsplus static fncts.io.StreamOps fromChunk
|
1516
1513
|
*/
|
1517
|
-
export function fromChunk<O>(c: Lazy<Conc<O>>): Stream<
|
1514
|
+
export function fromChunk<O>(c: Lazy<Conc<O>>): Stream<never, never, O> {
|
1518
1515
|
return new Stream(Channel.unwrap(IO.succeedNow(Channel.write(c))));
|
1519
1516
|
}
|
1520
1517
|
|
@@ -1523,7 +1520,7 @@ export function fromChunk<O>(c: Lazy<Conc<O>>): Stream<unknown, never, O> {
|
|
1523
1520
|
*
|
1524
1521
|
* @tsplus static fncts.io.StreamOps scoped
|
1525
1522
|
*/
|
1526
|
-
export function scoped<R, E, A>(stream: IO<R
|
1523
|
+
export function scoped<R, E, A>(stream: IO<R, E, A>): Stream<Exclude<R, Scope>, E, A> {
|
1527
1524
|
return new Stream(Channel.scoped(stream.map(Conc.single)));
|
1528
1525
|
}
|
1529
1526
|
|
@@ -1628,8 +1625,12 @@ export function fromIterableSingle<A>(iterable: Iterable<A>): Stream<unknown, ne
|
|
1628
1625
|
/**
|
1629
1626
|
* @tsplus static fncts.io.StreamOps fromPull
|
1630
1627
|
*/
|
1631
|
-
export function fromPull<R, E, A>(scopedPull: IO<R
|
1632
|
-
return Stream.unwrapScoped(scopedPull.map((pull) => Stream.repeatIOChunkMaybe(pull)))
|
1628
|
+
export function fromPull<R, E, A>(scopedPull: IO<R, never, IO<R, Maybe<E>, Conc<A>>>): Stream<Exclude<R, Scope>, E, A> {
|
1629
|
+
return Stream.unwrapScoped(scopedPull.map((pull) => Stream.repeatIOChunkMaybe(pull))) as Stream<
|
1630
|
+
Exclude<R, Scope>,
|
1631
|
+
E,
|
1632
|
+
A
|
1633
|
+
>;
|
1633
1634
|
}
|
1634
1635
|
|
1635
1636
|
/**
|
@@ -1672,7 +1673,7 @@ export function fromQueueWithShutdown<R, E, A>(
|
|
1672
1673
|
*
|
1673
1674
|
* @tsplus static fncts.io.StreamOps haltNow
|
1674
1675
|
*/
|
1675
|
-
export function haltNow(u: unknown): Stream<
|
1676
|
+
export function haltNow(u: unknown): Stream<never, never, never> {
|
1676
1677
|
return new Stream(Channel.halt(u));
|
1677
1678
|
}
|
1678
1679
|
|
@@ -1681,19 +1682,19 @@ export function haltNow(u: unknown): Stream<unknown, never, never> {
|
|
1681
1682
|
*
|
1682
1683
|
* @tsplus static fncts.io.StreamOps halt
|
1683
1684
|
*/
|
1684
|
-
export function halt(u: Lazy<unknown>): Stream<
|
1685
|
+
export function halt(u: Lazy<unknown>): Stream<never, never, never> {
|
1685
1686
|
return new Stream(Channel.halt(u));
|
1686
1687
|
}
|
1687
1688
|
|
1688
|
-
function haltWhenWriter<
|
1689
|
+
function haltWhenWriter<E, A, E1>(
|
1689
1690
|
fiber: Fiber<E1, any>,
|
1690
|
-
): Channel<
|
1691
|
+
): Channel<never, E | E1, Conc<A>, unknown, E | E1, Conc<A>, void> {
|
1691
1692
|
return Channel.unwrap(
|
1692
1693
|
fiber.poll.map((maybeExit) =>
|
1693
1694
|
maybeExit.match(
|
1694
1695
|
() =>
|
1695
1696
|
Channel.readWith(
|
1696
|
-
(i: Conc<A>) => Channel.writeNow(i).apSecond(haltWhenWriter<
|
1697
|
+
(i: Conc<A>) => Channel.writeNow(i).apSecond(haltWhenWriter<E, A, E1>(fiber)),
|
1697
1698
|
Channel.failNow,
|
1698
1699
|
() => Channel.unit,
|
1699
1700
|
),
|
@@ -1715,7 +1716,7 @@ function haltWhenWriter<R, E, A, R1, E1>(
|
|
1715
1716
|
*
|
1716
1717
|
* @tsplus fluent fncts.io.Stream haltWhen
|
1717
1718
|
*/
|
1718
|
-
export function haltWhen_<R, E, A, R1, E1>(fa: Stream<R, E, A>, io: IO<R1, E1, any>): Stream<R
|
1719
|
+
export function haltWhen_<R, E, A, R1, E1>(fa: Stream<R, E, A>, io: IO<R1, E1, any>): Stream<R | R1, E | E1, A> {
|
1719
1720
|
return new Stream(Channel.unwrapScoped(io.forkScoped.map((fiber) => fa.channel.pipeTo(haltWhenWriter(fiber)))));
|
1720
1721
|
}
|
1721
1722
|
|
@@ -1754,11 +1755,11 @@ export function haltWhenFuture_<R, E, A, E1>(fa: Stream<R, E, A>, future: Future
|
|
1754
1755
|
export function interleave_<R, E, A, R1, E1, B>(
|
1755
1756
|
sa: Stream<R, E, A>,
|
1756
1757
|
sb: Stream<R1, E1, B>,
|
1757
|
-
): Stream<R
|
1758
|
+
): Stream<R | R1, E | E1, A | B> {
|
1758
1759
|
return sa.interleaveWith(sb, Stream.fromChunk(Conc(true, false)).forever);
|
1759
1760
|
}
|
1760
1761
|
|
1761
|
-
function interleaveWithProducer<
|
1762
|
+
function interleaveWithProducer<E, A>(handoff: Handoff<Take<E, A>>): Channel<never, E, A, unknown, never, never, void> {
|
1762
1763
|
return Channel.readWithCause(
|
1763
1764
|
(value: A) => Channel.fromIO(handoff.offer(Take.single(value))).apSecond(interleaveWithProducer(handoff)),
|
1764
1765
|
(cause) => Channel.fromIO(handoff.offer(Take.failCause(cause))),
|
@@ -1780,7 +1781,7 @@ export function interleaveWith_<R, E, A, R1, E1, B, R2, E2>(
|
|
1780
1781
|
sa: Stream<R, E, A>,
|
1781
1782
|
sb: Stream<R1, E1, B>,
|
1782
1783
|
b: Stream<R2, E2, boolean>,
|
1783
|
-
): Stream<R
|
1784
|
+
): Stream<R | R1 | R2, E | E1 | E2, A | B> {
|
1784
1785
|
return new Stream(
|
1785
1786
|
Channel.unwrapScoped(
|
1786
1787
|
Do((Δ) => {
|
@@ -1793,7 +1794,7 @@ export function interleaveWith_<R, E, A, R1, E1, B, R2, E2>(
|
|
1793
1794
|
const process = (
|
1794
1795
|
leftDone: boolean,
|
1795
1796
|
rightDone: boolean,
|
1796
|
-
): Channel<R
|
1797
|
+
): Channel<R | R1 | R2, E | E1 | E2, boolean, unknown, E | E1 | E2, Conc<A | B>, void> =>
|
1797
1798
|
Channel.readWithCause(
|
1798
1799
|
(b: boolean) => {
|
1799
1800
|
if (b && !leftDone) {
|
@@ -1865,7 +1866,7 @@ export function intersperse_<R, E, A, A1>(stream: Stream<R, E, A>, middle: A1):
|
|
1865
1866
|
export function interruptWhen_<R, E, A, R1, E1>(
|
1866
1867
|
stream: Stream<R, E, A>,
|
1867
1868
|
io: IO<R1, E1, any>,
|
1868
|
-
): Stream<R
|
1869
|
+
): Stream<R | R1, E | E1, A> {
|
1869
1870
|
return new Stream(stream.channel.interruptWhen(io));
|
1870
1871
|
}
|
1871
1872
|
|
@@ -1891,7 +1892,7 @@ export function map_<R, E, A, B>(stream: Stream<R, E, A>, f: (o: A) => B): Strea
|
|
1891
1892
|
function mapAccumAccumulator<S, E = never, A = never, B = never>(
|
1892
1893
|
currS: S,
|
1893
1894
|
f: (s: S, a: A) => readonly [S, B],
|
1894
|
-
): Channel<
|
1895
|
+
): Channel<never, E, Conc<A>, unknown, E, Conc<B>, void> {
|
1895
1896
|
return Channel.readWith(
|
1896
1897
|
(inp: Conc<A>) => {
|
1897
1898
|
const [nextS, bs] = inp.mapAccum(currS, f);
|
@@ -1918,7 +1919,7 @@ export function mapAccum_<R, E, A, S, B>(
|
|
1918
1919
|
function mapAccumIOAccumulator<R, E, A, R1, E1, S, B>(
|
1919
1920
|
s: S,
|
1920
1921
|
f: (s: S, a: A) => IO<R1, E1, readonly [B, S]>,
|
1921
|
-
): Channel<R
|
1922
|
+
): Channel<R | R1, E, Conc<A>, unknown, E | E1, Conc<B>, void> {
|
1922
1923
|
return Channel.readWith(
|
1923
1924
|
(inp: Conc<A>) =>
|
1924
1925
|
Channel.unwrap(
|
@@ -1954,7 +1955,7 @@ export function mapAccumIO_<R, E, A, R1, E1, S, B>(
|
|
1954
1955
|
stream: Stream<R, E, A>,
|
1955
1956
|
s: S,
|
1956
1957
|
f: (s: S, a: A) => IO<R1, E1, readonly [B, S]>,
|
1957
|
-
): Stream<R
|
1958
|
+
): Stream<R | R1, E | E1, B> {
|
1958
1959
|
return new Stream(stream.channel.pipeTo(mapAccumIOAccumulator(s, f)));
|
1959
1960
|
}
|
1960
1961
|
|
@@ -1975,7 +1976,7 @@ export function mapChunks_<R, E, A, A1>(stream: Stream<R, E, A>, f: (chunk: Conc
|
|
1975
1976
|
export function mapChunksIO_<R, E, A, R1, E1, B>(
|
1976
1977
|
stream: Stream<R, E, A>,
|
1977
1978
|
f: (chunk: Conc<A>) => IO<R1, E1, Conc<B>>,
|
1978
|
-
): Stream<R
|
1979
|
+
): Stream<R | R1, E | E1, B> {
|
1979
1980
|
return new Stream(stream.channel.mapOutIO(f));
|
1980
1981
|
}
|
1981
1982
|
|
@@ -2008,7 +2009,7 @@ export function mapConcatChunk_<R, E, A, B>(stream: Stream<R, E, A>, f: (a: A) =
|
|
2008
2009
|
export function mapConcatChunkIO_<R, E, A, R1, E1, B>(
|
2009
2010
|
stream: Stream<R, E, A>,
|
2010
2011
|
f: (a: A) => IO<R1, E1, Conc<B>>,
|
2011
|
-
): Stream<R
|
2012
|
+
): Stream<R | R1, E | E1, B> {
|
2012
2013
|
return stream.mapIO(f).mapConcatChunk(identity);
|
2013
2014
|
}
|
2014
2015
|
|
@@ -2021,7 +2022,7 @@ export function mapConcatChunkIO_<R, E, A, R1, E1, B>(
|
|
2021
2022
|
export function mapConcatIO_<R, E, A, R1, E1, B>(
|
2022
2023
|
stream: Stream<R, E, A>,
|
2023
2024
|
f: (a: A) => IO<R1, E1, Iterable<B>>,
|
2024
|
-
): Stream<R
|
2025
|
+
): Stream<R | R1, E | E1, B> {
|
2025
2026
|
return stream.mapIO((a) => f(a).map(Conc.from)).mapConcatChunk(identity);
|
2026
2027
|
}
|
2027
2028
|
|
@@ -2051,14 +2052,14 @@ export function mapErrorCause_<R, E, A, E1>(fa: Stream<R, E, A>, f: (e: Cause<E>
|
|
2051
2052
|
export function mapIO_<R, E, A, R1, E1, B>(
|
2052
2053
|
stream: Stream<R, E, A>,
|
2053
2054
|
f: (a: A) => IO<R1, E1, B>,
|
2054
|
-
): Stream<R
|
2055
|
+
): Stream<R | R1, E | E1, B> {
|
2055
2056
|
return new Stream(stream.channel.pipeTo(mapIOLoop(Iterable.empty<A>()[Symbol.iterator](), f)));
|
2056
2057
|
}
|
2057
2058
|
|
2058
2059
|
function mapIOLoop<R, E, A, R1, E1, B>(
|
2059
2060
|
iterator: Iterator<A>,
|
2060
2061
|
f: (a: A) => IO<R1, E1, B>,
|
2061
|
-
): Channel<R
|
2062
|
+
): Channel<R | R1, E, Conc<A>, unknown, E | E1, Conc<B>, unknown> {
|
2062
2063
|
const next = iterator.next();
|
2063
2064
|
if (next.done) {
|
2064
2065
|
return Channel.readWithCause(
|
@@ -2086,7 +2087,7 @@ export function mapIOC_<R, E, A, R1, E1, B>(
|
|
2086
2087
|
stream: Stream<R, E, A>,
|
2087
2088
|
n: number,
|
2088
2089
|
f: (a: A) => IO<R1, E1, B>,
|
2089
|
-
): Stream<R
|
2090
|
+
): Stream<R | R1, E | E1, B> {
|
2090
2091
|
return new Stream(stream.channel.concatMap(Channel.writeChunk).mapOutIOC(n, f).mapOut(Conc.single));
|
2091
2092
|
}
|
2092
2093
|
|
@@ -2103,7 +2104,7 @@ export function mergeMap_<R, E, A, R1, E1, B>(
|
|
2103
2104
|
f: (a: A) => Stream<R1, E1, B>,
|
2104
2105
|
n: number,
|
2105
2106
|
bufferSize = 16,
|
2106
|
-
): Stream<R
|
2107
|
+
): Stream<R | R1, E | E1, B> {
|
2107
2108
|
return new Stream(ma.channel.concatMap(Channel.writeChunk).mergeMap((a) => f(a).channel, n, bufferSize));
|
2108
2109
|
}
|
2109
2110
|
|
@@ -2119,7 +2120,7 @@ export function mergeMapIO_<R, E, A, R1, E1, B>(
|
|
2119
2120
|
f: (a: A) => IO<R1, E1, B>,
|
2120
2121
|
n: number,
|
2121
2122
|
bufferSize = 16,
|
2122
|
-
): Stream<R
|
2123
|
+
): Stream<R | R1, E | E1, B> {
|
2123
2124
|
return stream.mergeMap((a) => Stream.fromIO(f(a)), n, bufferSize);
|
2124
2125
|
}
|
2125
2126
|
|
@@ -2129,7 +2130,7 @@ export function mergeMapIO_<R, E, A, R1, E1, B>(
|
|
2129
2130
|
export function mergeEither_<R, E, A, R1, E1, B>(
|
2130
2131
|
fa: Stream<R, E, A>,
|
2131
2132
|
fb: Stream<R1, E1, B>,
|
2132
|
-
): Stream<R
|
2133
|
+
): Stream<R | R1, E | E1, Either<A, B>> {
|
2133
2134
|
return fa.mergeWith(fb, Either.left, Either.right);
|
2134
2135
|
}
|
2135
2136
|
|
@@ -2151,8 +2152,8 @@ export function mergeWith_<R, E, A, R1, E1, A1, B, C>(
|
|
2151
2152
|
l: (a: A) => B,
|
2152
2153
|
r: (b: A1) => C,
|
2153
2154
|
strategy: TerminationStrategy = "Both",
|
2154
|
-
): Stream<R
|
2155
|
-
return new Stream<R
|
2155
|
+
): Stream<R | R1, E | E1, B | C> {
|
2156
|
+
return new Stream<R | R1, E | E1, B | C>(
|
2156
2157
|
sa
|
2157
2158
|
.map(l)
|
2158
2159
|
.channel.mergeWith(
|
@@ -2173,7 +2174,7 @@ export function mergeWith_<R, E, A, R1, E1, A1, B, C>(
|
|
2173
2174
|
export function onError_<R, E, A, R1>(
|
2174
2175
|
stream: Stream<R, E, A>,
|
2175
2176
|
cleanup: (e: Cause<E>) => IO<R1, never, any>,
|
2176
|
-
): Stream<R
|
2177
|
+
): Stream<R | R1, E, A> {
|
2177
2178
|
return stream.catchAllCause((cause) => fromIO(cleanup(cause).apSecond(IO.failCauseNow(cause))));
|
2178
2179
|
}
|
2179
2180
|
|
@@ -2187,8 +2188,8 @@ export function onError_<R, E, A, R1>(
|
|
2187
2188
|
export function orElse_<R, E, A, R1, E1, A1>(
|
2188
2189
|
stream: Stream<R, E, A>,
|
2189
2190
|
that: Lazy<Stream<R1, E1, A1>>,
|
2190
|
-
): Stream<R
|
2191
|
-
return new Stream<R
|
2191
|
+
): Stream<R | R1, E1, A | A1> {
|
2192
|
+
return new Stream<R | R1, E1, A | A1>(stream.channel.orElse(that().channel));
|
2192
2193
|
}
|
2193
2194
|
|
2194
2195
|
/**
|
@@ -2201,7 +2202,7 @@ export function orElse_<R, E, A, R1, E1, A1>(
|
|
2201
2202
|
export function orElseEither_<R, E, A, R1, E1, A1>(
|
2202
2203
|
stream: Stream<R, E, A>,
|
2203
2204
|
that: Lazy<Stream<R1, E1, A1>>,
|
2204
|
-
): Stream<R
|
2205
|
+
): Stream<R | R1, E1, Either<A, A1>> {
|
2205
2206
|
return stream.map(Either.left).orElse(that().map(Either.right));
|
2206
2207
|
}
|
2207
2208
|
|
@@ -2224,7 +2225,7 @@ export function orElseFail_<R, E, A, E1>(stream: Stream<R, E, A>, e: Lazy<E1>):
|
|
2224
2225
|
export function orElseOptional_<R, E, A, R1, E1, A1>(
|
2225
2226
|
stream: Stream<R, Maybe<E>, A>,
|
2226
2227
|
that: Lazy<Stream<R1, Maybe<E1>, A1>>,
|
2227
|
-
): Stream<R
|
2228
|
+
): Stream<R | R1, Maybe<E | E1>, A | A1> {
|
2228
2229
|
return stream.catchAll((maybeError) =>
|
2229
2230
|
maybeError.match(
|
2230
2231
|
() => that(),
|
@@ -2248,7 +2249,7 @@ export function orElseSucceed_<R, E, A, A1>(stream: Stream<R, E, A>, a: Lazy<A1>
|
|
2248
2249
|
export function pipeThrough_<R, E, A, R1, E1, L, Z>(
|
2249
2250
|
ma: Stream<R, E, A>,
|
2250
2251
|
sa: Sink<R1, E1, A, L, Z>,
|
2251
|
-
): Stream<R
|
2252
|
+
): Stream<R | R1, E | E1, L> {
|
2252
2253
|
return new Stream(ma.channel.pipeToOrFail(sa.channel));
|
2253
2254
|
}
|
2254
2255
|
|
@@ -2258,7 +2259,7 @@ export function pipeThrough_<R, E, A, R1, E1, L, Z>(
|
|
2258
2259
|
*
|
2259
2260
|
* @tsplus fluent fncts.io.Stream provideEnvironment
|
2260
2261
|
*/
|
2261
|
-
export function provideEnvironment_<R, E, A>(ra: Stream<R, E, A>, r: Environment<R>): Stream<
|
2262
|
+
export function provideEnvironment_<R, E, A>(ra: Stream<R, E, A>, r: Environment<R>): Stream<never, E, A> {
|
2262
2263
|
return new Stream(ra.channel.provideEnvironment(r));
|
2263
2264
|
}
|
2264
2265
|
|
@@ -2280,7 +2281,7 @@ export function provideSomeLayer_<R, E, A, RIn, E1, ROut>(
|
|
2280
2281
|
self: Stream<R, E, A>,
|
2281
2282
|
layer: Layer<RIn, E1, ROut>,
|
2282
2283
|
__tsplusTrace?: string,
|
2283
|
-
): Stream<RIn
|
2284
|
+
): Stream<RIn | Exclude<R, ROut>, E | E1, A> {
|
2284
2285
|
// @ts-expect-error
|
2285
2286
|
return self.provideLayer(Layer.environment<RIn>().and(layer));
|
2286
2287
|
}
|
@@ -2306,7 +2307,7 @@ class Rechunker<A> {
|
|
2306
2307
|
return null;
|
2307
2308
|
}
|
2308
2309
|
|
2309
|
-
emitOfNotEmpty(): Channel<
|
2310
|
+
emitOfNotEmpty(): Channel<never, unknown, unknown, unknown, never, Conc<A>, void> {
|
2310
2311
|
if (this.pos !== 0) {
|
2311
2312
|
return Channel.writeNow(Conc.from(this.builder));
|
2312
2313
|
} else {
|
@@ -2323,7 +2324,7 @@ class Rechunker<A> {
|
|
2323
2324
|
function rechunkProcess<E, In>(
|
2324
2325
|
rechunker: Rechunker<In>,
|
2325
2326
|
target: number,
|
2326
|
-
): Channel<
|
2327
|
+
): Channel<never, E, Conc<In>, unknown, E, Conc<In>, unknown> {
|
2327
2328
|
return Channel.readWithCause(
|
2328
2329
|
(chunk: Conc<In>) => {
|
2329
2330
|
if (chunk.length === target && rechunker.isEmpty) {
|
@@ -2421,7 +2422,7 @@ export function repeatIOChunkMaybe<R, E, A>(fa: IO<R, Maybe<E>, Conc<A>>): Strea
|
|
2421
2422
|
export function run_<R, E, A, R2, E2, Z>(
|
2422
2423
|
stream: Stream<R, E, A>,
|
2423
2424
|
sink: Sink<R2, E2, A, unknown, Z>,
|
2424
|
-
): IO<R
|
2425
|
+
): IO<R | R2, E | E2, Z> {
|
2425
2426
|
return stream.channel.pipeToOrFail(sink.channel).runDrain;
|
2426
2427
|
}
|
2427
2428
|
|
@@ -2449,7 +2450,7 @@ export function runDrain<R, E, A>(stream: Stream<R, E, A>): IO<R, E, void> {
|
|
2449
2450
|
export function runForeachScoped_<R, E, A, R2, E2>(
|
2450
2451
|
self: Stream<R, E, A>,
|
2451
2452
|
f: (a: A) => IO<R2, E2, any>,
|
2452
|
-
): IO<R
|
2453
|
+
): IO<R | R2 | Scope, E | E2, void> {
|
2453
2454
|
return self.runScoped(Sink.foreach(f));
|
2454
2455
|
}
|
2455
2456
|
|
@@ -2462,8 +2463,8 @@ export function runForeachScoped_<R, E, A, R2, E2>(
|
|
2462
2463
|
export function runIntoElementsScoped_<R, E, A, R1, E1>(
|
2463
2464
|
stream: Stream<R, E, A>,
|
2464
2465
|
queue: PQueue<R1, unknown, never, never, Exit<Maybe<E | E1>, A>, unknown>,
|
2465
|
-
): IO<R
|
2466
|
-
const writer: Channel<R
|
2466
|
+
): IO<R | R1 | Scope, E | E1, void> {
|
2467
|
+
const writer: Channel<R | R1, E, Conc<A>, unknown, never, Exit<Maybe<E | E1>, A>, unknown> = Channel.readWith(
|
2467
2468
|
(inp: Conc<A>) =>
|
2468
2469
|
inp
|
2469
2470
|
.foldLeft(
|
@@ -2486,7 +2487,7 @@ export function runIntoElementsScoped_<R, E, A, R1, E1>(
|
|
2486
2487
|
export function runIntoQueueScoped_<R, R1, E extends E1, E1, A>(
|
2487
2488
|
stream: Stream<R, E, A>,
|
2488
2489
|
queue: PQueue<R1, never, never, unknown, Take<E1, A>, any>,
|
2489
|
-
): IO<R
|
2490
|
+
): IO<R | R1 | Scope, E | E1, void> {
|
2490
2491
|
const writer: Channel<R, E, Conc<A>, unknown, E, Take<E | E1, A>, any> = Channel.readWithCause(
|
2491
2492
|
(inp) => Channel.writeNow(Take.chunk(inp)).apSecond(writer),
|
2492
2493
|
(cause) => Channel.writeNow(Take.failCause(cause)),
|
@@ -2505,7 +2506,7 @@ export function runIntoQueueScoped_<R, R1, E extends E1, E1, A>(
|
|
2505
2506
|
export function runIntoHubScoped_<R, R1, E extends E1, E1, A>(
|
2506
2507
|
stream: Stream<R, E, A>,
|
2507
2508
|
hub: PHub<R1, never, never, unknown, Take<E1, A>, any>,
|
2508
|
-
): IO<R
|
2509
|
+
): IO<R | R1 | Scope, E | E1, void> {
|
2509
2510
|
return stream.runIntoQueueScoped(hub.toQueue);
|
2510
2511
|
}
|
2511
2512
|
|
@@ -2517,7 +2518,7 @@ export function runIntoHubScoped_<R, R1, E extends E1, E1, A>(
|
|
2517
2518
|
export function runScoped_<R, E, A, R2, E2, Z>(
|
2518
2519
|
stream: Stream<R, E, A>,
|
2519
2520
|
sink: Sink<R2, E2, A, unknown, Z>,
|
2520
|
-
): IO<R
|
2521
|
+
): IO<R | R2 | Scope, E | E2, Z> {
|
2521
2522
|
return stream.channel.pipeToOrFail(sink.channel).drain.runScoped;
|
2522
2523
|
}
|
2523
2524
|
|
@@ -2541,7 +2542,7 @@ export function scanIO_<R, E, A, R1, E1, B>(
|
|
2541
2542
|
sa: Stream<R, E, A>,
|
2542
2543
|
b: B,
|
2543
2544
|
f: (b: B, a: A) => IO<R1, E1, B>,
|
2544
|
-
): Stream<R
|
2545
|
+
): Stream<R | R1, E | E1, B> {
|
2545
2546
|
return Stream.succeedNow(b).concat(sa.mapAccumIO(b, (b, a) => f(b, a).map((b) => [b, b])));
|
2546
2547
|
}
|
2547
2548
|
|
@@ -2564,7 +2565,7 @@ export function scanReduce_<R, E, A extends B, B>(fa: Stream<R, E, A>, f: (b: B,
|
|
2564
2565
|
export function scanReduceIO_<R, E, A extends B, R1, E1, B>(
|
2565
2566
|
fa: Stream<R, E, A>,
|
2566
2567
|
f: (b: B, a: A) => IO<R1, E1, B>,
|
2567
|
-
): Stream<R
|
2568
|
+
): Stream<R | R1, E | E1, B> {
|
2568
2569
|
return fa.mapAccumIO(Nothing<B>(), (s, a) =>
|
2569
2570
|
s.match(
|
2570
2571
|
() => IO.succeedNow([a, Just(a)]),
|
@@ -2578,7 +2579,7 @@ export function scanReduceIO_<R, E, A extends B, R1, E1, B>(
|
|
2578
2579
|
*
|
2579
2580
|
* @tsplus static fncts.io.StreamOps succeedNow
|
2580
2581
|
*/
|
2581
|
-
export function succeedNow<O>(o: O): Stream<
|
2582
|
+
export function succeedNow<O>(o: O): Stream<never, never, O> {
|
2582
2583
|
return fromChunkNow(Conc.single(o));
|
2583
2584
|
}
|
2584
2585
|
|
@@ -2587,11 +2588,11 @@ export function succeedNow<O>(o: O): Stream<unknown, never, O> {
|
|
2587
2588
|
*
|
2588
2589
|
* @tsplus static fncts.io.StreamOps succeed
|
2589
2590
|
*/
|
2590
|
-
export function succeed<A>(a: Lazy<A>): Stream<
|
2591
|
+
export function succeed<A>(a: Lazy<A>): Stream<never, never, A> {
|
2591
2592
|
return fromChunk(Conc.single(a()));
|
2592
2593
|
}
|
2593
2594
|
|
2594
|
-
function takeLoop<E, A>(n: number): Channel<
|
2595
|
+
function takeLoop<E, A>(n: number): Channel<never, E, Conc<A>, unknown, E, Conc<A>, unknown> {
|
2595
2596
|
return Channel.readWithCause(
|
2596
2597
|
(inp) => {
|
2597
2598
|
const taken = inp.take(n);
|
@@ -2628,14 +2629,14 @@ export function take_<R, E, A>(stream: Stream<R, E, A>, n: number): Stream<R, E,
|
|
2628
2629
|
export function takeUntilIO_<R, E, A, R1, E1>(
|
2629
2630
|
ma: Stream<R, E, A>,
|
2630
2631
|
f: (a: A) => IO<R1, E1, boolean>,
|
2631
|
-
): Stream<R
|
2632
|
+
): Stream<R | R1, E | E1, A> {
|
2632
2633
|
return new Stream(ma.channel.pipeTo(takeUntilIOLoop(Iterable.empty<A>()[Symbol.iterator](), f)));
|
2633
2634
|
}
|
2634
2635
|
|
2635
|
-
function takeUntilIOLoop<
|
2636
|
+
function takeUntilIOLoop<E, A, R1, E1>(
|
2636
2637
|
iterator: Iterator<A>,
|
2637
2638
|
f: (a: A) => IO<R1, E1, boolean>,
|
2638
|
-
): Channel<
|
2639
|
+
): Channel<R1, E, Conc<A>, unknown, E | E1, Conc<A>, unknown> {
|
2639
2640
|
const next = iterator.next();
|
2640
2641
|
if (next.done) {
|
2641
2642
|
return Channel.readWithCause(
|
@@ -2648,7 +2649,7 @@ function takeUntilIOLoop<R, E, A, R1, E1>(
|
|
2648
2649
|
f(next.value).map((b) =>
|
2649
2650
|
b
|
2650
2651
|
? Channel.writeNow(Conc.single(next.value))
|
2651
|
-
: Channel.writeNow(Conc.single(next.value)) > takeUntilIOLoop<
|
2652
|
+
: Channel.writeNow(Conc.single(next.value)) > takeUntilIOLoop<E, A, R1, E1>(iterator, f),
|
2652
2653
|
),
|
2653
2654
|
);
|
2654
2655
|
}
|
@@ -2683,7 +2684,7 @@ export function takeUntil_<R, E, A>(fa: Stream<R, E, A>, p: Predicate<A>): Strea
|
|
2683
2684
|
/**
|
2684
2685
|
* @tsplus fluent fncts.io.Stream tap
|
2685
2686
|
*/
|
2686
|
-
export function tap_<R, E, A, R1, E1>(ma: Stream<R, E, A>, f: (a: A) => IO<R1, E1, any>): Stream<R
|
2687
|
+
export function tap_<R, E, A, R1, E1>(ma: Stream<R, E, A>, f: (a: A) => IO<R1, E1, any>): Stream<R | R1, E | E1, A> {
|
2687
2688
|
return ma.mapIO((a) => f(a).as(a));
|
2688
2689
|
}
|
2689
2690
|
|
@@ -2752,7 +2753,7 @@ export function throttleEnforceIO_<R, E, A, R1, E1>(
|
|
2752
2753
|
units: number,
|
2753
2754
|
duration: number,
|
2754
2755
|
burst = 0,
|
2755
|
-
): Stream<R
|
2756
|
+
): Stream<R | R1, E | E1, A> {
|
2756
2757
|
return new Stream(
|
2757
2758
|
Channel.fromIO(Clock.currentTime).flatMap((current) =>
|
2758
2759
|
sa.channel.pipeTo(throttleEnforceIOLoop(costFn, units, duration, burst, units, current)),
|
@@ -2766,7 +2767,7 @@ export function throttleEnforceIO_<R, E, A, R1, E1>(
|
|
2766
2767
|
*
|
2767
2768
|
* @tsplus fluent fncts.io.Stream toHub
|
2768
2769
|
*/
|
2769
|
-
export function toHub_<R, E, A>(stream: Stream<R, E, A>, capacity: number): IO<R
|
2770
|
+
export function toHub_<R, E, A>(stream: Stream<R, E, A>, capacity: number): IO<R | Scope, never, Hub<Take<E, A>>> {
|
2770
2771
|
return Do((Δ) => {
|
2771
2772
|
const hub = Δ(IO.acquireRelease(Hub.makeBounded<Take<E, A>>(capacity), (_) => _.shutdown));
|
2772
2773
|
Δ(stream.runIntoHubScoped(hub).fork);
|
@@ -2779,7 +2780,7 @@ export function toHub_<R, E, A>(stream: Stream<R, E, A>, capacity: number): IO<R
|
|
2779
2780
|
*
|
2780
2781
|
* @tsplus getter fncts.io.Stream toPull
|
2781
2782
|
*/
|
2782
|
-
export function toPull<R, E, A>(stream: Stream<R, E, A>): IO<R
|
2783
|
+
export function toPull<R, E, A>(stream: Stream<R, E, A>): IO<R | Scope, never, IO<R, Maybe<E>, Conc<A>>> {
|
2783
2784
|
return stream.channel.toPull.map((io) =>
|
2784
2785
|
io.mapError(Maybe.just).flatMap((r) => r.match(() => IO.failNow(Nothing()), IO.succeedNow)),
|
2785
2786
|
);
|
@@ -2791,7 +2792,7 @@ export function toPull<R, E, A>(stream: Stream<R, E, A>): IO<R & Has<Scope>, nev
|
|
2791
2792
|
*
|
2792
2793
|
* @tsplus fluent fncts.io.Stream toQueue
|
2793
2794
|
*/
|
2794
|
-
export function toQueue_<R, E, A>(stream: Stream<R, E, A>, capacity = 2): IO<R
|
2795
|
+
export function toQueue_<R, E, A>(stream: Stream<R, E, A>, capacity = 2): IO<R | Scope, never, Queue<Take<E, A>>> {
|
2795
2796
|
return Do((Δ) => {
|
2796
2797
|
const queue = Δ(IO.acquireRelease(Queue.makeBounded<Take<E, A>>(capacity), (_) => _.shutdown));
|
2797
2798
|
Δ(stream.runIntoQueueScoped(queue).fork);
|
@@ -2805,7 +2806,7 @@ export function toQueue_<R, E, A>(stream: Stream<R, E, A>, capacity = 2): IO<R &
|
|
2805
2806
|
export function toQueueDropping_<R, E, A>(
|
2806
2807
|
stream: Stream<R, E, A>,
|
2807
2808
|
capacity = 2,
|
2808
|
-
): IO<R
|
2809
|
+
): IO<R | Scope, never, Queue.Dequeue<Take<E, A>>> {
|
2809
2810
|
return Do((Δ) => {
|
2810
2811
|
const queue = Δ(IO.acquireRelease(Queue.makeDropping<Take<E, A>>(capacity), (_) => _.shutdown));
|
2811
2812
|
Δ(stream.runIntoQueueScoped(queue).fork);
|
@@ -2819,7 +2820,7 @@ export function toQueueDropping_<R, E, A>(
|
|
2819
2820
|
export function toQueueOfElements_<R, E, A>(
|
2820
2821
|
stream: Stream<R, E, A>,
|
2821
2822
|
capacity = 2,
|
2822
|
-
): IO<R
|
2823
|
+
): IO<R | Scope, never, Queue.Dequeue<Exit<Maybe<E>, A>>> {
|
2823
2824
|
return Do((Δ) => {
|
2824
2825
|
const queue = Δ(IO.acquireRelease(Queue.makeBounded<Exit<Maybe<E>, A>>(capacity), (_) => _.shutdown));
|
2825
2826
|
Δ(stream.runIntoElementsScoped(queue).fork);
|
@@ -2833,7 +2834,7 @@ export function toQueueOfElements_<R, E, A>(
|
|
2833
2834
|
export function toQueueSliding_<R, E, A>(
|
2834
2835
|
stream: Stream<R, E, A>,
|
2835
2836
|
capacity = 2,
|
2836
|
-
): IO<R
|
2837
|
+
): IO<R | Scope, never, Queue.Dequeue<Take<E, A>>> {
|
2837
2838
|
return Do((Δ) => {
|
2838
2839
|
const queue = Δ(IO.acquireRelease(Queue.makeSliding<Take<E, A>>(capacity), (_) => _.shutdown));
|
2839
2840
|
Δ(stream.runIntoQueueScoped(queue).fork);
|
@@ -2847,7 +2848,7 @@ export function toQueueSliding_<R, E, A>(
|
|
2847
2848
|
*
|
2848
2849
|
* @tsplus getter fncts.io.Stream toQueueUnbounded
|
2849
2850
|
*/
|
2850
|
-
export function toQueueUnbounded<R, E, A>(stream: Stream<R, E, A>): IO<R
|
2851
|
+
export function toQueueUnbounded<R, E, A>(stream: Stream<R, E, A>): IO<R | Scope, never, Queue<Take<E, A>>> {
|
2851
2852
|
return Do((Δ) => {
|
2852
2853
|
const queue = Δ(IO.acquireRelease(Queue.makeUnbounded<Take<E, A>>(), (_) => _.shutdown));
|
2853
2854
|
Δ(stream.runIntoQueueScoped(queue).fork);
|
@@ -2890,7 +2891,7 @@ export function unfoldIO<S, R, E, A>(s: S, f: (s: S) => IO<R, E, Maybe<readonly
|
|
2890
2891
|
function unfoldChunkLoop<S, A>(
|
2891
2892
|
s: S,
|
2892
2893
|
f: (s: S) => Maybe<readonly [Conc<A>, S]>,
|
2893
|
-
): Channel<
|
2894
|
+
): Channel<never, unknown, unknown, unknown, never, Conc<A>, unknown> {
|
2894
2895
|
return f(s).match(
|
2895
2896
|
() => Channel.unit,
|
2896
2897
|
([as, s]) => Channel.writeNow(as).flatMap(() => unfoldChunkLoop(s, f)),
|
@@ -2900,14 +2901,14 @@ function unfoldChunkLoop<S, A>(
|
|
2900
2901
|
/**
|
2901
2902
|
* @tsplus static fncts.io.StreamOps unfoldChunk
|
2902
2903
|
*/
|
2903
|
-
export function unfoldChunk<S, A>(s: S, f: (s: S) => Maybe<readonly [Conc<A>, S]>): Stream<
|
2904
|
+
export function unfoldChunk<S, A>(s: S, f: (s: S) => Maybe<readonly [Conc<A>, S]>): Stream<never, never, A> {
|
2904
2905
|
return new Stream(Channel.defer(unfoldChunkLoop(s, f)));
|
2905
2906
|
}
|
2906
2907
|
|
2907
2908
|
/**
|
2908
2909
|
* @tsplus static fncts.io.StreamOps unfold
|
2909
2910
|
*/
|
2910
|
-
export function unfold<S, A>(s: S, f: (s: S) => Maybe<readonly [A, S]>): Stream<
|
2911
|
+
export function unfold<S, A>(s: S, f: (s: S) => Maybe<readonly [A, S]>): Stream<never, never, A> {
|
2911
2912
|
return Stream.unfoldChunk(s, (s) => f(s).map(([a, s]) => tuple(Conc.single(a), s)));
|
2912
2913
|
}
|
2913
2914
|
|
@@ -2916,7 +2917,7 @@ export function unfold<S, A>(s: S, f: (s: S) => Maybe<readonly [A, S]>): Stream<
|
|
2916
2917
|
*
|
2917
2918
|
* @tsplus static fncts.io.StreamOps unwrap
|
2918
2919
|
*/
|
2919
|
-
export function unwrap<R, E, R1, E1, A>(stream: IO<R, E, Stream<R1, E1, A>>): Stream<R
|
2920
|
+
export function unwrap<R, E, R1, E1, A>(stream: IO<R, E, Stream<R1, E1, A>>): Stream<R | R1, E | E1, A> {
|
2920
2921
|
return Stream.fromIO(stream).flatten;
|
2921
2922
|
}
|
2922
2923
|
|
@@ -2926,8 +2927,8 @@ export function unwrap<R, E, R1, E1, A>(stream: IO<R, E, Stream<R1, E1, A>>): St
|
|
2926
2927
|
* @tsplus static fncts.io.StreamOps unwrapScoped
|
2927
2928
|
*/
|
2928
2929
|
export function unwrapScoped<R0, E0, R, E, A>(
|
2929
|
-
stream: IO<R0
|
2930
|
-
): Stream<
|
2930
|
+
stream: IO<R0, E0, Stream<R, E, A>>,
|
2931
|
+
): Stream<R | Exclude<R0, Scope>, E0 | E, A> {
|
2931
2932
|
return Stream.scoped(stream).flatten;
|
2932
2933
|
}
|
2933
2934
|
|
@@ -2956,7 +2957,7 @@ export function zipWithLatest_<R, E, A, R1, E1, B, C>(
|
|
2956
2957
|
fa: Stream<R, E, A>,
|
2957
2958
|
fb: Stream<R1, E1, B>,
|
2958
2959
|
f: (a: A, b: B) => C,
|
2959
|
-
): Stream<R
|
2960
|
+
): Stream<R | R1, E | E1, C> {
|
2960
2961
|
function pullNonEmpty<R, E, A>(pull: IO<R, Maybe<E>, Conc<A>>): IO<R, Maybe<E>, Conc<A>> {
|
2961
2962
|
return pull.flatMap((chunk) => (chunk.isNonEmpty ? pullNonEmpty(pull) : IO.succeedNow(chunk)));
|
2962
2963
|
}
|