@fncts/io 0.0.10 → 0.0.13
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 -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/Schedule/Driver.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
export class Driver<State, Env, In, Out> {
|
|
6
6
|
constructor(
|
|
7
7
|
readonly next: (inp: In, __tsplusTrace?: string) => IO<Env, Nothing, Out>,
|
|
8
|
-
readonly last: IO<
|
|
8
|
+
readonly last: IO<never, NoSuchElementError, Out>,
|
|
9
9
|
readonly reset: UIO<void>,
|
|
10
10
|
readonly state: UIO<State>,
|
|
11
11
|
) {}
|
|
@@ -16,7 +16,7 @@ export class Driver<State, Env, In, Out> {
|
|
|
16
16
|
*/
|
|
17
17
|
export function makeDriver<State, Env, In, Out>(
|
|
18
18
|
next: (inp: In, __tsplusTrace?: string) => IO<Env, Nothing, Out>,
|
|
19
|
-
last: IO<
|
|
19
|
+
last: IO<never, NoSuchElementError, Out>,
|
|
20
20
|
reset: UIO<void>,
|
|
21
21
|
state: UIO<State>,
|
|
22
22
|
): Driver<State, Env, In, Out> {
|
|
@@ -9,17 +9,17 @@ export function driver<State, Env, In, Out>(
|
|
|
9
9
|
): UIO<Schedule.Driver<State, Env, In, Out>> {
|
|
10
10
|
return Ref.make<readonly [Maybe<Out>, State]>([Nothing(), schedule.initial]).map((ref) => {
|
|
11
11
|
const next = (inp: In, __tsplusTrace?: string) =>
|
|
12
|
-
|
|
13
|
-
const state =
|
|
14
|
-
const now =
|
|
15
|
-
const [state1, out, decision] =
|
|
16
|
-
return
|
|
12
|
+
Do((_) => {
|
|
13
|
+
const state = _(ref.get.map(([_, s]) => s));
|
|
14
|
+
const now = _(Clock.currentTime);
|
|
15
|
+
const [state1, out, decision] = _(schedule.step(now, inp, state));
|
|
16
|
+
return _(
|
|
17
17
|
decision.match(
|
|
18
18
|
() => ref.set([Just(out), state1]).apSecond(IO.failNow(Nothing() as Nothing)),
|
|
19
19
|
(interval) =>
|
|
20
20
|
ref
|
|
21
21
|
.set([Just(out), state1])
|
|
22
|
-
.apSecond(Clock.sleep(Duration.fromInterval(now, interval.
|
|
22
|
+
.apSecond(Clock.sleep(Duration.fromInterval(now, interval.start)))
|
|
23
23
|
.as(out),
|
|
24
24
|
),
|
|
25
25
|
);
|
package/_src/Schedule/api.ts
CHANGED
|
@@ -30,7 +30,7 @@ export function addDelay_<State, Env, In, Out>(
|
|
|
30
30
|
export function addDelayIO_<State, Env, In, Out, Env1>(
|
|
31
31
|
self: Schedule.WithState<State, Env, In, Out>,
|
|
32
32
|
f: (out: Out) => URIO<Env1, number>,
|
|
33
|
-
): Schedule.WithState<State, Env
|
|
33
|
+
): Schedule.WithState<State, Env | Env1, In, Out> {
|
|
34
34
|
return self.modifyDelayIO((out, duration) => f(out).map((d) => duration + d));
|
|
35
35
|
}
|
|
36
36
|
|
|
@@ -40,7 +40,7 @@ export function addDelayIO_<State, Env, In, Out, Env1>(
|
|
|
40
40
|
export function andThen<State, Env, In, Out, State1, Env1, In1, Out1>(
|
|
41
41
|
self: Schedule.WithState<State, Env, In, Out>,
|
|
42
42
|
that: Schedule.WithState<State1, Env1, In1, Out1>,
|
|
43
|
-
): Schedule.WithState<readonly [State, State1, boolean], Env
|
|
43
|
+
): Schedule.WithState<readonly [State, State1, boolean], Env | Env1, In & In1, Out | Out1> {
|
|
44
44
|
return self.andThenEither(that).map((out) => out.value);
|
|
45
45
|
}
|
|
46
46
|
|
|
@@ -50,8 +50,8 @@ export function andThen<State, Env, In, Out, State1, Env1, In1, Out1>(
|
|
|
50
50
|
export function andThenEither_<State, Env, In, Out, State1, Env1, In1, Out1>(
|
|
51
51
|
self: Schedule.WithState<State, Env, In, Out>,
|
|
52
52
|
that: Schedule.WithState<State1, Env1, In1, Out1>,
|
|
53
|
-
): Schedule.WithState<readonly [State, State1, boolean], Env
|
|
54
|
-
return Schedule<readonly [State, State1, boolean], Env
|
|
53
|
+
): Schedule.WithState<readonly [State, State1, boolean], Env | Env1, In & In1, Either<Out, Out1>> {
|
|
54
|
+
return Schedule<readonly [State, State1, boolean], Env | Env1, In & In1, Either<Out, Out1>>(
|
|
55
55
|
[self.initial, that.initial, true],
|
|
56
56
|
(now, inp, [s1, s2, onLeft]) => {
|
|
57
57
|
if (onLeft) {
|
|
@@ -99,7 +99,7 @@ export function check_<State, Env, In, Out>(
|
|
|
99
99
|
export function checkIO_<State, Env, In, Out, Env1>(
|
|
100
100
|
self: Schedule.WithState<State, Env, In, Out>,
|
|
101
101
|
test: (inp: In, out: Out) => URIO<Env1, boolean>,
|
|
102
|
-
): Schedule.WithState<State, Env
|
|
102
|
+
): Schedule.WithState<State, Env | Env1, In, Out> {
|
|
103
103
|
return Schedule(self.initial, (now, inp, state) =>
|
|
104
104
|
self.step(now, inp, state).flatMap(([state, out, decision]) =>
|
|
105
105
|
decision.match(
|
|
@@ -117,7 +117,7 @@ export function checkIO_<State, Env, In, Out, Env1>(
|
|
|
117
117
|
export function compose_<S, R, I, O, S1, R1, O2>(
|
|
118
118
|
self: Schedule.WithState<S, R, I, O>,
|
|
119
119
|
that: Schedule.WithState<S1, R1, O, O2>,
|
|
120
|
-
): Schedule.WithState<readonly [S, S1], R
|
|
120
|
+
): Schedule.WithState<readonly [S, S1], R | R1, I, O2> {
|
|
121
121
|
return Schedule([self.initial, that.initial], (now, inp, state) =>
|
|
122
122
|
self.step(now, inp, state[0]).flatMap(([lState, out, decision]) =>
|
|
123
123
|
decision.match(
|
|
@@ -160,7 +160,7 @@ export function contramapEnvironment_<S, R, I, O, R1>(
|
|
|
160
160
|
export function contramapIO_<S, R, I, O, R1, I2>(
|
|
161
161
|
self: Schedule.WithState<S, R, I, O>,
|
|
162
162
|
f: (inp: I2) => URIO<R1, I>,
|
|
163
|
-
): Schedule.WithState<S, R
|
|
163
|
+
): Schedule.WithState<S, R | R1, I2, O> {
|
|
164
164
|
return Schedule(self.initial, (now, inp2, state) => f(inp2).flatMap((inp) => self.step(now, inp, state)));
|
|
165
165
|
}
|
|
166
166
|
|
|
@@ -187,7 +187,7 @@ export function delayedSelf_<S, R, I, O>(
|
|
|
187
187
|
export function delayedIO_<S, R, I, O, R1>(
|
|
188
188
|
self: Schedule.WithState<S, R, I, O>,
|
|
189
189
|
f: (delay: number) => URIO<R1, number>,
|
|
190
|
-
): Schedule.WithState<S, R
|
|
190
|
+
): Schedule.WithState<S, R | R1, I, O> {
|
|
191
191
|
return self.modifyDelayIO((_, delay) => f(delay));
|
|
192
192
|
}
|
|
193
193
|
|
|
@@ -200,7 +200,7 @@ export function delays<S, R, I, O>(self: Schedule.WithState<S, R, I, O>): Schedu
|
|
|
200
200
|
decision.match(
|
|
201
201
|
() => IO.succeedNow([state, 0, Decision.Done]),
|
|
202
202
|
(interval) => {
|
|
203
|
-
const delay = interval.
|
|
203
|
+
const delay = interval.start - now;
|
|
204
204
|
return IO.succeedNow([state, delay, Decision.Continue(interval)]);
|
|
205
205
|
},
|
|
206
206
|
),
|
|
@@ -226,19 +226,19 @@ export function dimapIO_<S, R, I, O, R1, I2, R2, O2>(
|
|
|
226
226
|
self: Schedule.WithState<S, R, I, O>,
|
|
227
227
|
f: (inp2: I2) => URIO<R1, I>,
|
|
228
228
|
g: (out: O) => URIO<R2, O2>,
|
|
229
|
-
): Schedule.WithState<S, R
|
|
229
|
+
): Schedule.WithState<S, R | R1 | R2, I2, O2> {
|
|
230
230
|
return self.contramapIO(f).mapIO(g);
|
|
231
231
|
}
|
|
232
232
|
|
|
233
233
|
/**
|
|
234
234
|
* @tsplus static fncts.io.ScheduleOps duration
|
|
235
235
|
*/
|
|
236
|
-
export function duration(duration: number): Schedule.WithState<boolean,
|
|
237
|
-
return Schedule<boolean,
|
|
236
|
+
export function duration(duration: number): Schedule.WithState<boolean, never, unknown, number> {
|
|
237
|
+
return Schedule<boolean, never, unknown, number>(true, (now, _, state) =>
|
|
238
238
|
IO.succeed(() => {
|
|
239
239
|
if (state) {
|
|
240
240
|
const interval = Interval.after(now + duration);
|
|
241
|
-
return [false, duration, Decision.
|
|
241
|
+
return [false, duration, Decision.continueWith(interval)];
|
|
242
242
|
} else {
|
|
243
243
|
return [false, 0, Decision.Done];
|
|
244
244
|
}
|
|
@@ -246,21 +246,41 @@ export function duration(duration: number): Schedule.WithState<boolean, unknown,
|
|
|
246
246
|
);
|
|
247
247
|
}
|
|
248
248
|
|
|
249
|
+
/**
|
|
250
|
+
* @tsplus fluent fncts.io.Schedule either
|
|
251
|
+
* @tsplus operator fncts.io.Schedule ||
|
|
252
|
+
*/
|
|
253
|
+
export function either<S, R, I, O, S1, R1, I1, O1>(
|
|
254
|
+
self: Schedule.WithState<S, R, I, O>,
|
|
255
|
+
that: Schedule.WithState<S1, R1, I1, O1>,
|
|
256
|
+
): Schedule.WithState<readonly [S, S1], R | R1, I & I1, readonly [O, O1]> {
|
|
257
|
+
return self.unionWith(that, (interval1, interval2) => interval1 || interval2);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* @tsplus fluent fncts.io.Schedule eitherWith
|
|
262
|
+
*/
|
|
263
|
+
export function eitherWith<S, R, I, O, S1, R1, I1, O1, O2>(
|
|
264
|
+
self: Schedule.WithState<S, R, I, O>,
|
|
265
|
+
that: Schedule.WithState<S1, R1, I1, O1>,
|
|
266
|
+
f: (out1: O, out2: O1) => O2,
|
|
267
|
+
): Schedule.WithState<readonly [S, S1], R | R1, I & I1, O2> {
|
|
268
|
+
return (self || that).map(f.tupled);
|
|
269
|
+
}
|
|
270
|
+
|
|
249
271
|
/**
|
|
250
272
|
* @tsplus static fncts.io.ScheduleOps elapsed
|
|
251
273
|
*/
|
|
252
|
-
export const elapsed: Schedule.WithState<Maybe<number>,
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
(start)
|
|
259
|
-
|
|
260
|
-
return [Just(start), duration, Decision.Continue(Interval(now, Number.MAX_SAFE_INTEGER))];
|
|
261
|
-
},
|
|
262
|
-
),
|
|
274
|
+
export const elapsed: Schedule.WithState<Maybe<number>, never, unknown, number> = Schedule(Nothing(), (now, _, state) =>
|
|
275
|
+
IO.succeed(
|
|
276
|
+
state.match(
|
|
277
|
+
() => [Just(now), 0, Decision.continueWith(Interval(now, Number.MAX_SAFE_INTEGER))],
|
|
278
|
+
(start) => {
|
|
279
|
+
const duration = now - start;
|
|
280
|
+
return [Just(start), duration, Decision.continueWith(Interval(now, Number.MAX_SAFE_INTEGER))];
|
|
281
|
+
},
|
|
263
282
|
),
|
|
283
|
+
),
|
|
264
284
|
);
|
|
265
285
|
|
|
266
286
|
/**
|
|
@@ -283,7 +303,7 @@ export function ensuring_<S, R, I, O>(
|
|
|
283
303
|
/**
|
|
284
304
|
* @tsplus static fncts.io.ScheduleOps exponential
|
|
285
305
|
*/
|
|
286
|
-
export function exponential(base: number, factor = 2): Schedule.WithState<number,
|
|
306
|
+
export function exponential(base: number, factor = 2): Schedule.WithState<number, never, unknown, number> {
|
|
287
307
|
return Schedule.delayed(Schedule.forever.map((i) => base * Math.pow(factor, i)));
|
|
288
308
|
}
|
|
289
309
|
|
|
@@ -303,20 +323,20 @@ export function exponential(base: number, factor = 2): Schedule.WithState<number
|
|
|
303
323
|
*/
|
|
304
324
|
export function fixed(
|
|
305
325
|
interval: number,
|
|
306
|
-
): Schedule.WithState<readonly [Maybe<readonly [number, number]>, number],
|
|
326
|
+
): Schedule.WithState<readonly [Maybe<readonly [number, number]>, number], never, unknown, number> {
|
|
307
327
|
return Schedule([Nothing(), 0], (now, inp, [ms, n]) =>
|
|
308
328
|
IO.succeed(
|
|
309
329
|
ms.match(
|
|
310
330
|
() => {
|
|
311
331
|
const nextRun = now + interval;
|
|
312
|
-
return [[Just([now, nextRun]), n + 1], n, Decision.
|
|
332
|
+
return [[Just([now, nextRun]), n + 1], n, Decision.continueWith(Interval.after(nextRun))];
|
|
313
333
|
},
|
|
314
334
|
([startMillis, lastRun]) => {
|
|
315
335
|
const runningBehind = now > lastRun + interval;
|
|
316
336
|
const boundary = interval === 0 ? interval : interval - ((now - startMillis) % interval);
|
|
317
337
|
const sleepTime = boundary === 0 ? interval : boundary;
|
|
318
338
|
const nextRun = runningBehind ? now : now + sleepTime;
|
|
319
|
-
return [[Just([startMillis, nextRun]), n + 1], n, Decision.
|
|
339
|
+
return [[Just([startMillis, nextRun]), n + 1], n, Decision.continueWith(Interval.after(nextRun))];
|
|
320
340
|
},
|
|
321
341
|
),
|
|
322
342
|
),
|
|
@@ -341,7 +361,7 @@ export function foldIO_<S, R, I, O, Z, R1>(
|
|
|
341
361
|
self: Schedule.WithState<S, R, I, O>,
|
|
342
362
|
z: Z,
|
|
343
363
|
f: (z: Z, out: O) => URIO<R1, Z>,
|
|
344
|
-
): Schedule.WithState<readonly [S, Z], R
|
|
364
|
+
): Schedule.WithState<readonly [S, Z], R | R1, I, Z> {
|
|
345
365
|
return Schedule([self.initial, z], (now, inp, [s, z]) =>
|
|
346
366
|
self.step(now, inp, s).flatMap(([s, out, decision]) =>
|
|
347
367
|
decision.match(
|
|
@@ -374,8 +394,8 @@ export const forever = Schedule.unfold(0, (n) => n + 1);
|
|
|
374
394
|
/**
|
|
375
395
|
* @tsplus static fncts.io.ScheduleOps identity
|
|
376
396
|
*/
|
|
377
|
-
export function identity<A>(): Schedule.WithState<void,
|
|
378
|
-
return Schedule(undefined, (now, inp, state) => IO.succeed([state, inp, Decision.
|
|
397
|
+
export function identity<A>(): Schedule.WithState<void, never, A, A> {
|
|
398
|
+
return Schedule(undefined, (now, inp, state) => IO.succeed([state, inp, Decision.continueWith(Interval.after(now))]));
|
|
379
399
|
}
|
|
380
400
|
|
|
381
401
|
function intersectWithLoop<S, R, I, O, S1, R1, I1, O1>(
|
|
@@ -384,24 +404,24 @@ function intersectWithLoop<S, R, I, O, S1, R1, I1, O1>(
|
|
|
384
404
|
inp: I & I1,
|
|
385
405
|
lState: S,
|
|
386
406
|
out: O,
|
|
387
|
-
lInterval:
|
|
407
|
+
lInterval: Intervals,
|
|
388
408
|
rState: S1,
|
|
389
409
|
out2: O1,
|
|
390
|
-
rInterval:
|
|
391
|
-
f: (lInterval:
|
|
392
|
-
): IO<R
|
|
410
|
+
rInterval: Intervals,
|
|
411
|
+
f: (lInterval: Intervals, rInterval: Intervals) => Intervals,
|
|
412
|
+
): IO<R | R1, never, readonly [readonly [S, S1], readonly [O, O1], Decision]> {
|
|
393
413
|
const combined = f(lInterval, rInterval);
|
|
394
414
|
if (combined.isNonEmpty) {
|
|
395
415
|
return IO.succeedNow([[lState, rState], [out, out2], Decision.Continue(combined)]);
|
|
396
416
|
} else if (lInterval < rInterval) {
|
|
397
|
-
return self.step(lInterval.
|
|
417
|
+
return self.step(lInterval.end, inp, lState).flatMap(([lState, out, decision]) =>
|
|
398
418
|
decision.match(
|
|
399
419
|
() => IO.succeedNow([[lState, rState], [out, out2], Decision.Done]),
|
|
400
420
|
(lInterval) => intersectWithLoop(self, that, inp, lState, out, lInterval, rState, out2, rInterval, f),
|
|
401
421
|
),
|
|
402
422
|
);
|
|
403
423
|
} else {
|
|
404
|
-
return that.step(rInterval.
|
|
424
|
+
return that.step(rInterval.end, inp, rState).flatMap(([rState, out2, decision]) =>
|
|
405
425
|
decision.match(
|
|
406
426
|
() => IO.succeedNow([[lState, rState], [out, out2], Decision.Done]),
|
|
407
427
|
(rInterval) => intersectWithLoop(self, that, inp, lState, out, lInterval, rState, out2, rInterval, f),
|
|
@@ -416,8 +436,8 @@ function intersectWithLoop<S, R, I, O, S1, R1, I1, O1>(
|
|
|
416
436
|
export function intersectWith_<S, R, I, O, S1, R1, I1, O1>(
|
|
417
437
|
self: Schedule.WithState<S, R, I, O>,
|
|
418
438
|
that: Schedule.WithState<S1, R1, I1, O1>,
|
|
419
|
-
f: (int1:
|
|
420
|
-
): Schedule.WithState<readonly [S, S1], R
|
|
439
|
+
f: (int1: Intervals, int2: Intervals) => Intervals,
|
|
440
|
+
): Schedule.WithState<readonly [S, S1], R | R1, I & I1, readonly [O, O1]> {
|
|
421
441
|
return Schedule([self.initial, that.initial] as const, (now, inp, state) => {
|
|
422
442
|
const left = self.step(now, inp, state[0]);
|
|
423
443
|
const right = that.step(now, inp, state[1]);
|
|
@@ -435,7 +455,7 @@ export function intersectWith_<S, R, I, O, S1, R1, I1, O1>(
|
|
|
435
455
|
/**
|
|
436
456
|
* @tsplus static fncts.io.Schedule linear
|
|
437
457
|
*/
|
|
438
|
-
export function linear(base: number): Schedule.WithState<number,
|
|
458
|
+
export function linear(base: number): Schedule.WithState<number, never, unknown, number> {
|
|
439
459
|
return Schedule.delayed(Schedule.forever.map((i) => base * (i + 1)));
|
|
440
460
|
}
|
|
441
461
|
|
|
@@ -455,7 +475,7 @@ export function map_<State, Env, In, Out, Out1>(
|
|
|
455
475
|
export function mapIO_<State, Env, In, Out, Env1, Out1>(
|
|
456
476
|
self: Schedule.WithState<State, Env, In, Out>,
|
|
457
477
|
f: (out: Out) => URIO<Env1, Out1>,
|
|
458
|
-
): Schedule.WithState<State, Env
|
|
478
|
+
): Schedule.WithState<State, Env | Env1, In, Out1> {
|
|
459
479
|
return Schedule(self.initial, (now, inp, state) =>
|
|
460
480
|
self.step(now, inp, state).flatMap(([state, out, decision]) => f(out).map((out1) => [state, out1, decision])),
|
|
461
481
|
);
|
|
@@ -467,21 +487,21 @@ export function mapIO_<State, Env, In, Out, Env1, Out1>(
|
|
|
467
487
|
export function modifyDelayIO_<State, Env, In, Out, Env1>(
|
|
468
488
|
self: Schedule.WithState<State, Env, In, Out>,
|
|
469
489
|
f: (out: Out, duration: number) => URIO<Env1, number>,
|
|
470
|
-
): Schedule.WithState<State, Env
|
|
490
|
+
): Schedule.WithState<State, Env | Env1, In, Out> {
|
|
471
491
|
return Schedule(self.initial, (now, inp, state) =>
|
|
472
492
|
self.step(now, inp, state).flatMap(([state, out, decision]) =>
|
|
473
493
|
decision.match(
|
|
474
494
|
() => IO.succeedNow([state, out, decision]),
|
|
475
495
|
(interval) => {
|
|
476
|
-
const delay = Interval(now, interval.
|
|
496
|
+
const delay = Interval(now, interval.start).size;
|
|
477
497
|
|
|
478
498
|
return f(out, delay).map((duration) => {
|
|
479
|
-
const oldStart = interval.
|
|
499
|
+
const oldStart = interval.start;
|
|
480
500
|
const newStart = now + duration;
|
|
481
501
|
const delta = newStart - oldStart;
|
|
482
|
-
const newEnd = interval.
|
|
502
|
+
const newEnd = interval.end + delta;
|
|
483
503
|
const newInterval = Interval(newStart, newEnd);
|
|
484
|
-
return [state, out, Decision.
|
|
504
|
+
return [state, out, Decision.continueWith(newInterval)];
|
|
485
505
|
});
|
|
486
506
|
},
|
|
487
507
|
),
|
|
@@ -495,7 +515,7 @@ export function modifyDelayIO_<State, Env, In, Out, Env1>(
|
|
|
495
515
|
export function onDecision_<S, R, I, O, R1>(
|
|
496
516
|
self: Schedule.WithState<S, R, I, O>,
|
|
497
517
|
f: (state: S, out: O, decision: Decision) => URIO<R1, any>,
|
|
498
|
-
): Schedule.WithState<S, R
|
|
518
|
+
): Schedule.WithState<S, R | R1, I, O> {
|
|
499
519
|
return Schedule(self.initial, (now, inp, state) =>
|
|
500
520
|
self.step(now, inp, state).flatMap(([state, out, decision]) => f(state, out, decision).as([state, out, decision])),
|
|
501
521
|
);
|
|
@@ -507,7 +527,7 @@ export function onDecision_<S, R, I, O, R1>(
|
|
|
507
527
|
export function provideEnvironment_<S, R, I, O>(
|
|
508
528
|
self: Schedule.WithState<S, R, I, O>,
|
|
509
529
|
env: Environment<R>,
|
|
510
|
-
): Schedule.WithState<S,
|
|
530
|
+
): Schedule.WithState<S, never, I, O> {
|
|
511
531
|
return Schedule(self.initial, (now, inp, state) => self.step(now, inp, state).provideEnvironment(env));
|
|
512
532
|
}
|
|
513
533
|
|
|
@@ -527,7 +547,7 @@ export function reconsider_<S, R, I, O, O2>(
|
|
|
527
547
|
export function reconsiderIO_<S, R, I, O, R1, O1>(
|
|
528
548
|
self: Schedule.WithState<S, R, I, O>,
|
|
529
549
|
f: (state: S, out: O, decision: Decision) => URIO<R1, Either<O1, readonly [O1, Interval]>>,
|
|
530
|
-
): Schedule.WithState<S, R
|
|
550
|
+
): Schedule.WithState<S, R | R1, I, O1> {
|
|
531
551
|
return Schedule(self.initial, (now, inp, state) =>
|
|
532
552
|
self.step(now, inp, state).flatMap(([state, out, decision]) =>
|
|
533
553
|
decision.match(
|
|
@@ -542,7 +562,7 @@ export function reconsiderIO_<S, R, I, O, R1, O1>(
|
|
|
542
562
|
f(state, out, decision).map((r) =>
|
|
543
563
|
r.match(
|
|
544
564
|
(out1) => [state, out1, Decision.Done],
|
|
545
|
-
([out1, interval]) => [state, out1, Decision.
|
|
565
|
+
([out1, interval]) => [state, out1, Decision.continueWith(interval)],
|
|
546
566
|
),
|
|
547
567
|
),
|
|
548
568
|
),
|
|
@@ -553,14 +573,14 @@ export function reconsiderIO_<S, R, I, O, R1, O1>(
|
|
|
553
573
|
/**
|
|
554
574
|
* @tsplus static fncts.io.Schedule recurs
|
|
555
575
|
*/
|
|
556
|
-
export function recurs(n: number): Schedule.WithState<number,
|
|
576
|
+
export function recurs(n: number): Schedule.WithState<number, never, unknown, number> {
|
|
557
577
|
return Schedule.forever.whileOutput((_) => _ < n);
|
|
558
578
|
}
|
|
559
579
|
|
|
560
580
|
/**
|
|
561
581
|
* @tsplus static fncts.io.Schedule recurWhile
|
|
562
582
|
*/
|
|
563
|
-
export function recurWhile<A>(f: (a: A) => boolean): Schedule.WithState<void,
|
|
583
|
+
export function recurWhile<A>(f: (a: A) => boolean): Schedule.WithState<void, never, A, A> {
|
|
564
584
|
return identity<A>().whileInput(f);
|
|
565
585
|
}
|
|
566
586
|
|
|
@@ -574,14 +594,14 @@ export function recurWhileIO<R, A>(f: (a: A) => URIO<R, boolean>): Schedule.With
|
|
|
574
594
|
/**
|
|
575
595
|
* @tsplus static fncts.io.Schedule recurWhileEquals
|
|
576
596
|
*/
|
|
577
|
-
export function recurWhileEquals<A>(value: Lazy<A>): Schedule.WithState<void,
|
|
597
|
+
export function recurWhileEquals<A>(value: Lazy<A>): Schedule.WithState<void, never, A, A> {
|
|
578
598
|
return identity<A>().whileInput((a) => Equatable.strictEquals(a, value()));
|
|
579
599
|
}
|
|
580
600
|
|
|
581
601
|
/**
|
|
582
602
|
* @tsplus static fncts.io.Schedule recurUntil
|
|
583
603
|
*/
|
|
584
|
-
export function recurUntil<A>(f: (a: A) => boolean): Schedule.WithState<void,
|
|
604
|
+
export function recurUntil<A>(f: (a: A) => boolean): Schedule.WithState<void, never, A, A> {
|
|
585
605
|
return identity<A>().untilInput(f);
|
|
586
606
|
}
|
|
587
607
|
|
|
@@ -595,7 +615,7 @@ export function recurUntilIO<R, A>(f: (a: A) => URIO<R, boolean>): Schedule.With
|
|
|
595
615
|
/**
|
|
596
616
|
* @tsplus static fncts.io.Schedule recurUntilEquals
|
|
597
617
|
*/
|
|
598
|
-
export function recurUntilEquals<A>(value: Lazy<A>): Schedule.WithState<void,
|
|
618
|
+
export function recurUntilEquals<A>(value: Lazy<A>): Schedule.WithState<void, never, A, A> {
|
|
599
619
|
return identity<A>().untilInput((a) => Equatable.strictEquals(a, value()));
|
|
600
620
|
}
|
|
601
621
|
|
|
@@ -652,7 +672,7 @@ export function run_<S, R, I, O>(
|
|
|
652
672
|
return self.step(now, xs.head, state).flatMap(([state, out, decision]) =>
|
|
653
673
|
decision.match(
|
|
654
674
|
() => IO.succeed(acc.append(out)),
|
|
655
|
-
(interval) => loop(interval.
|
|
675
|
+
(interval) => loop(interval.start, xs.tail, state, acc.append(out)),
|
|
656
676
|
),
|
|
657
677
|
);
|
|
658
678
|
}
|
|
@@ -663,14 +683,14 @@ export function run_<S, R, I, O>(
|
|
|
663
683
|
/**
|
|
664
684
|
* @tsplus static fncts.io.Schedule spaced
|
|
665
685
|
*/
|
|
666
|
-
export function spaced(duration: number): Schedule.WithState<number,
|
|
686
|
+
export function spaced(duration: number): Schedule.WithState<number, never, unknown, number> {
|
|
667
687
|
return Schedule.forever.addDelay(() => duration);
|
|
668
688
|
}
|
|
669
689
|
|
|
670
690
|
/**
|
|
671
691
|
* @tsplus static fncts.io.Schedule succeed
|
|
672
692
|
*/
|
|
673
|
-
export function succeed<A>(a: Lazy<A>): Schedule.WithState<number,
|
|
693
|
+
export function succeed<A>(a: Lazy<A>): Schedule.WithState<number, never, unknown, A> {
|
|
674
694
|
return Schedule.forever.as(a);
|
|
675
695
|
}
|
|
676
696
|
|
|
@@ -680,7 +700,7 @@ export function succeed<A>(a: Lazy<A>): Schedule.WithState<number, unknown, unkn
|
|
|
680
700
|
export function tapInput_<S, R, I, O, R1>(
|
|
681
701
|
self: Schedule.WithState<S, R, I, O>,
|
|
682
702
|
f: (inp: I) => URIO<R1, any>,
|
|
683
|
-
): Schedule.WithState<S, R
|
|
703
|
+
): Schedule.WithState<S, R | R1, I, O> {
|
|
684
704
|
return Schedule(self.initial, (now, inp, state) => f(inp).apSecond(self.step(now, inp, state)));
|
|
685
705
|
}
|
|
686
706
|
|
|
@@ -690,7 +710,7 @@ export function tapInput_<S, R, I, O, R1>(
|
|
|
690
710
|
export function tapOutput_<S, R, I, O, R1>(
|
|
691
711
|
self: Schedule.WithState<S, R, I, O>,
|
|
692
712
|
f: (out: O) => URIO<R1, any>,
|
|
693
|
-
): Schedule.WithState<S, R
|
|
713
|
+
): Schedule.WithState<S, R | R1, I, O> {
|
|
694
714
|
return Schedule(self.initial, (now, inp, state) => self.step(now, inp, state).tap(([_, out]) => f(out)));
|
|
695
715
|
}
|
|
696
716
|
|
|
@@ -700,8 +720,8 @@ export function tapOutput_<S, R, I, O, R1>(
|
|
|
700
720
|
export function unionWith_<S, R, I, O, S1, R1, I1, O1>(
|
|
701
721
|
self: Schedule.WithState<S, R, I, O>,
|
|
702
722
|
that: Schedule.WithState<S1, R1, I1, O1>,
|
|
703
|
-
f: (int1:
|
|
704
|
-
): Schedule.WithState<readonly [S, S1], R
|
|
723
|
+
f: (int1: Intervals, int2: Intervals) => Intervals,
|
|
724
|
+
): Schedule.WithState<readonly [S, S1], R | R1, I & I1, readonly [O, O1]> {
|
|
705
725
|
return Schedule([self.initial, that.initial], (now, inp, state) => {
|
|
706
726
|
const left = self.step(now, inp, state[0]);
|
|
707
727
|
const right = that.step(now, inp, state[1]);
|
|
@@ -729,9 +749,9 @@ export function unionWith_<S, R, I, O, S1, R1, I1, O1>(
|
|
|
729
749
|
/**
|
|
730
750
|
* @tsplus static fncts.io.ScheduleOps unfold
|
|
731
751
|
*/
|
|
732
|
-
export function unfold<A>(a: Lazy<A>, f: (a: A) => A): Schedule.WithState<A,
|
|
733
|
-
return Schedule<A,
|
|
734
|
-
IO.succeed([f(state), state, Decision.
|
|
752
|
+
export function unfold<A>(a: Lazy<A>, f: (a: A) => A): Schedule.WithState<A, never, unknown, A> {
|
|
753
|
+
return Schedule<A, never, unknown, A>(a(), (now, inp, state) =>
|
|
754
|
+
IO.succeed([f(state), state, Decision.continueWith(Interval(now, Number.MAX_SAFE_INTEGER))]),
|
|
735
755
|
);
|
|
736
756
|
}
|
|
737
757
|
|
|
@@ -751,7 +771,7 @@ export function untilInput_<S, R, I, O>(
|
|
|
751
771
|
export function untilInputIO_<S, R, I, O, R1>(
|
|
752
772
|
self: Schedule.WithState<S, R, I, O>,
|
|
753
773
|
f: (inp: I) => URIO<R1, boolean>,
|
|
754
|
-
): Schedule.WithState<S, R
|
|
774
|
+
): Schedule.WithState<S, R | R1, I, O> {
|
|
755
775
|
return self.checkIO((inp) => f(inp).map((b) => !b));
|
|
756
776
|
}
|
|
757
777
|
|
|
@@ -771,14 +791,14 @@ export function untilOutput_<S, R, I, O>(
|
|
|
771
791
|
export function untilOutputIO_<S, R, I, O, R1>(
|
|
772
792
|
self: Schedule.WithState<S, R, I, O>,
|
|
773
793
|
f: (out: O) => URIO<R1, boolean>,
|
|
774
|
-
): Schedule.WithState<S, R
|
|
794
|
+
): Schedule.WithState<S, R | R1, I, O> {
|
|
775
795
|
return self.checkIO((_, out) => f(out).map((b) => !b));
|
|
776
796
|
}
|
|
777
797
|
|
|
778
798
|
/**
|
|
779
799
|
* @tsplus static fncts.io.Schedule upTo
|
|
780
800
|
*/
|
|
781
|
-
export function upTo(duration: number): Schedule.WithState<Maybe<number>,
|
|
801
|
+
export function upTo(duration: number): Schedule.WithState<Maybe<number>, never, unknown, number> {
|
|
782
802
|
return Schedule.elapsed.whileOutput((n) => n < duration);
|
|
783
803
|
}
|
|
784
804
|
|
|
@@ -798,7 +818,7 @@ export function whileInput_<S, R, I, O>(
|
|
|
798
818
|
export function whileInputIO_<S, R, I, O, R1>(
|
|
799
819
|
self: Schedule.WithState<S, R, I, O>,
|
|
800
820
|
f: (inp: I) => URIO<R1, boolean>,
|
|
801
|
-
): Schedule.WithState<S, R
|
|
821
|
+
): Schedule.WithState<S, R | R1, I, O> {
|
|
802
822
|
return self.checkIO((inp) => f(inp));
|
|
803
823
|
}
|
|
804
824
|
|
|
@@ -818,7 +838,7 @@ export function whileOutput_<S, R, I, O>(
|
|
|
818
838
|
export function whileOutputIO_<S, R, I, O, R1>(
|
|
819
839
|
self: Schedule.WithState<S, R, I, O>,
|
|
820
840
|
f: (out: O) => URIO<R1, boolean>,
|
|
821
|
-
): Schedule.WithState<S, R
|
|
841
|
+
): Schedule.WithState<S, R | R1, I, O> {
|
|
822
842
|
return self.checkIO((_, out) => f(out));
|
|
823
843
|
}
|
|
824
844
|
|
|
@@ -827,15 +847,15 @@ export function whileOutputIO_<S, R, I, O, R1>(
|
|
|
827
847
|
*/
|
|
828
848
|
export function windowed(
|
|
829
849
|
interval: number,
|
|
830
|
-
): Schedule.WithState<readonly [Maybe<number>, number],
|
|
850
|
+
): Schedule.WithState<readonly [Maybe<number>, number], never, unknown, number> {
|
|
831
851
|
return Schedule([Nothing(), 0], (now, inp, [m, n]) =>
|
|
832
852
|
IO.succeed(() =>
|
|
833
853
|
m.match(
|
|
834
|
-
() => [[Just(now), n + 1], n, Decision.
|
|
854
|
+
() => [[Just(now), n + 1], n, Decision.continueWith(Interval.after(now + interval))],
|
|
835
855
|
(startMillis) => [
|
|
836
856
|
[Just(startMillis), n + 1],
|
|
837
857
|
n,
|
|
838
|
-
Decision.
|
|
858
|
+
Decision.continueWith(Interval.after(now + (interval - ((now - startMillis) % interval)))),
|
|
839
859
|
],
|
|
840
860
|
),
|
|
841
861
|
),
|
|
@@ -848,7 +868,7 @@ export function windowed(
|
|
|
848
868
|
export function zip_<S, R, I, O, S1, R1, I1, O1>(
|
|
849
869
|
self: Schedule.WithState<S, R, I, O>,
|
|
850
870
|
that: Schedule.WithState<S1, R1, I1, O1>,
|
|
851
|
-
): Schedule.WithState<readonly [S, S1], R
|
|
871
|
+
): Schedule.WithState<readonly [S, S1], R | R1, I & I1, readonly [O, O1]> {
|
|
852
872
|
return self.intersectWith(that, (lInterval, rInterval) => lInterval.intersect(rInterval));
|
|
853
873
|
}
|
|
854
874
|
|
|
@@ -858,7 +878,7 @@ export function zip_<S, R, I, O, S1, R1, I1, O1>(
|
|
|
858
878
|
export function zipLeft_<S, R, I, O, S1, R1, I1, O1>(
|
|
859
879
|
self: Schedule.WithState<S, R, I, O>,
|
|
860
880
|
that: Schedule.WithState<S1, R1, I1, O1>,
|
|
861
|
-
): Schedule.WithState<readonly [S, S1], R
|
|
881
|
+
): Schedule.WithState<readonly [S, S1], R | R1, I & I1, O> {
|
|
862
882
|
return self.zip(that).map(([out]) => out);
|
|
863
883
|
}
|
|
864
884
|
|
|
@@ -868,7 +888,7 @@ export function zipLeft_<S, R, I, O, S1, R1, I1, O1>(
|
|
|
868
888
|
export function zipRight_<S, R, I, O, S1, R1, I1, O1>(
|
|
869
889
|
self: Schedule.WithState<S, R, I, O>,
|
|
870
890
|
that: Schedule.WithState<S1, R1, I1, O1>,
|
|
871
|
-
): Schedule.WithState<readonly [S, S1], R
|
|
891
|
+
): Schedule.WithState<readonly [S, S1], R | R1, I & I1, O1> {
|
|
872
892
|
return self.zip(that).map(([_, out1]) => out1);
|
|
873
893
|
}
|
|
874
894
|
|
|
@@ -879,6 +899,6 @@ export function zipWith_<S, R, I, O, S1, R1, I1, O2, O3>(
|
|
|
879
899
|
self: Schedule.WithState<S, R, I, O>,
|
|
880
900
|
that: Schedule.WithState<S1, R1, I1, O2>,
|
|
881
901
|
f: (out1: O, out2: O2) => O3,
|
|
882
|
-
): Schedule.WithState<readonly [S, S1], R
|
|
902
|
+
): Schedule.WithState<readonly [S, S1], R | R1, I & I1, O3> {
|
|
883
903
|
return self.zip(that).map(([out1, out2]) => f(out1, out2));
|
|
884
904
|
}
|
|
@@ -32,7 +32,7 @@ import type { Driver as Driver_ } from "./Driver.js";
|
|
|
32
32
|
* @tsplus companion fncts.io.ScheduleOps
|
|
33
33
|
*/
|
|
34
34
|
export abstract class Schedule<Env, In, Out> {
|
|
35
|
-
readonly _Env!: (
|
|
35
|
+
readonly _Env!: () => Env;
|
|
36
36
|
readonly _In!: (_: In) => void;
|
|
37
37
|
readonly _Out!: () => Out;
|
|
38
38
|
readonly _State!: unknown;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
interface FinalizerN extends HKT {
|
|
2
|
-
readonly
|
|
2
|
+
readonly type: Finalizer;
|
|
3
3
|
}
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -10,7 +10,7 @@ export interface Finalizer
|
|
|
10
10
|
{
|
|
11
11
|
readonly Finalizer: unique symbol;
|
|
12
12
|
},
|
|
13
|
-
(exit: Exit<any, any>) => IO<
|
|
13
|
+
(exit: Exit<any, any>) => IO<never, never, any>
|
|
14
14
|
> {}
|
|
15
15
|
|
|
16
16
|
/**
|
|
@@ -23,7 +23,7 @@ export function addIfOpen_(releaseMap: ReleaseMap, finalizer: Finalizer): UIO<Ma
|
|
|
23
23
|
/**
|
|
24
24
|
* @tsplus fluent fncts.io.Scope.ReleaseMap release
|
|
25
25
|
*/
|
|
26
|
-
export function release_(releaseMap: ReleaseMap, key: number, exit: Exit<any, any>): IO<
|
|
26
|
+
export function release_(releaseMap: ReleaseMap, key: number, exit: Exit<any, any>): IO<never, never, any> {
|
|
27
27
|
return ReleaseMap.reverseGet(releaseMap).modify((s) => {
|
|
28
28
|
switch (s._tag) {
|
|
29
29
|
case "Exited": {
|