@fncts/io 0.0.1 → 0.0.4
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/Channel/api.d.ts +2 -2
- package/Clock/api.d.ts +3 -1
- package/Clock/definition.d.ts +3 -1
- package/Clock/live.d.ts +2 -0
- package/Fiber/api/interruptFork.d.ts +1 -1
- package/IO/api/asyncIO.d.ts +6 -0
- package/IO/api/ensuringChildren.d.ts +7 -0
- package/IO/api/sequenceT.d.ts +2 -3
- package/IO/api/sleep.d.ts +3 -1
- package/IO/api/timeout.d.ts +14 -0
- package/IO/api.d.ts +2 -2
- package/IO/definition.d.ts +8 -4
- package/IO.d.ts +3 -0
- package/IOSpec.d.ts +10 -1
- package/Latch.d.ts +3 -0
- package/Schedule/Decision.d.ts +1 -1
- package/Schedule/api.d.ts +1 -1
- package/Schedule.d.ts +0 -1
- package/Scope/Finalizer/definition.d.ts +1 -1
- package/Scope/ReleaseMap/definition.d.ts +1 -1
- package/Stream/api.d.ts +5 -22
- package/Stream/internal/DebounceState.d.ts +3 -3
- package/Stream/internal/Handoff.d.ts +9 -9
- package/Stream/internal/SinkEndReason.d.ts +6 -18
- package/TFuture/definition.d.ts +1 -1
- package/TSemaphore/definition.d.ts +1 -1
- package/_cjs/Cached.cjs +3 -3
- package/_cjs/Channel/ChildExecutorDecision.cjs +2 -2
- package/_cjs/Channel/UpstreamPullRequest.cjs +2 -2
- package/_cjs/Channel/UpstreamPullStrategy.cjs +1 -1
- package/_cjs/Channel/api/interruptWhen.cjs +1 -1
- package/_cjs/Channel/api/interruptWhen.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 +1 -1
- package/_cjs/Channel/api/mergeAllWith.cjs.map +1 -1
- package/_cjs/Channel/api/mergeWith.cjs +6 -6
- package/_cjs/Channel/api/mergeWith.cjs.map +1 -1
- package/_cjs/Channel/api.cjs +14 -14
- package/_cjs/Channel/api.cjs.map +1 -1
- package/_cjs/Channel/core-api.cjs +1 -1
- package/_cjs/Channel/internal/ChannelExecutor.cjs +2 -2
- package/_cjs/Channel/internal/ChannelExecutor.cjs.map +1 -1
- package/_cjs/Channel/internal/SingleProducerAsyncInput.cjs +8 -7
- package/_cjs/Channel/internal/SingleProducerAsyncInput.cjs.map +1 -1
- package/_cjs/Channel.cjs +3 -3
- package/_cjs/Clock/api.cjs.map +1 -1
- package/_cjs/Clock/live.cjs +1 -1
- package/_cjs/Clock/live.cjs.map +1 -1
- package/_cjs/Clock.cjs +3 -3
- package/_cjs/Console.cjs +3 -3
- package/_cjs/Fiber/FiberContext.cjs +57 -56
- package/_cjs/Fiber/FiberContext.cjs.map +1 -1
- package/_cjs/Fiber/api/interruptFork.cjs +1 -1
- package/_cjs/Fiber/api/interruptFork.cjs.map +1 -1
- package/_cjs/Fiber.cjs +23 -23
- package/_cjs/FiberRef/constructors.cjs +1 -1
- package/_cjs/FiberRef/constructors.cjs.map +1 -1
- package/_cjs/FiberRef.cjs +5 -5
- package/_cjs/FiberRefs/join.cjs +2 -2
- package/_cjs/FiberRefs/join.cjs.map +1 -1
- package/_cjs/FiberRefs.cjs +3 -3
- package/_cjs/FiberScope.cjs +2 -2
- package/_cjs/FiberState/constructors.cjs +1 -1
- package/_cjs/FiberState.cjs +3 -3
- package/_cjs/FiberStatus/constructors.cjs +1 -1
- package/_cjs/FiberStatus.cjs +2 -2
- package/_cjs/Future.cjs +3 -3
- package/_cjs/Hub.cjs +2 -2
- package/_cjs/IO/api/asyncIO.cjs +37 -0
- package/_cjs/IO/api/asyncIO.cjs.map +1 -0
- package/_cjs/IO/api/core-scope.cjs +1 -1
- package/_cjs/IO/api/ensuringChildren.cjs +24 -0
- package/_cjs/IO/api/ensuringChildren.cjs.map +1 -0
- package/_cjs/IO/api/interrupt.cjs +5 -5
- package/_cjs/IO/api/interrupt.cjs.map +1 -1
- package/_cjs/IO/api/sleep.cjs.map +1 -1
- package/_cjs/IO/api/timeout.cjs +42 -0
- package/_cjs/IO/api/timeout.cjs.map +1 -0
- package/_cjs/IO/api.cjs +41 -40
- package/_cjs/IO/api.cjs.map +1 -1
- package/_cjs/IO/definition.cjs +9 -6
- package/_cjs/IO/definition.cjs.map +1 -1
- package/_cjs/IO/runtime.cjs +1 -1
- package/_cjs/IO/runtime.cjs.map +1 -1
- package/_cjs/IO.cjs +86 -47
- package/_cjs/IO.cjs.map +1 -1
- package/_cjs/IOEnv.cjs +3 -3
- package/_cjs/InterruptStatus.cjs +2 -2
- package/_cjs/Layer/api.cjs +5 -3
- package/_cjs/Layer/api.cjs.map +1 -1
- package/_cjs/Layer.cjs +3 -3
- package/_cjs/Logger.cjs +3 -3
- package/_cjs/Queue/api.cjs +7 -7
- package/_cjs/Queue.cjs +5 -5
- package/_cjs/Random.cjs +3 -3
- package/_cjs/Ref/Atomic/Atomic.cjs +3 -3
- package/_cjs/Ref/Atomic/api.cjs +10 -6
- package/_cjs/Ref/Atomic/api.cjs.map +1 -1
- package/_cjs/Ref/Atomic.cjs +2 -2
- package/_cjs/Ref/Derived.cjs +2 -2
- package/_cjs/Ref/DerivedAll.cjs +1 -1
- package/_cjs/Ref/Synchronized/api.cjs +1 -1
- package/_cjs/Ref/Synchronized/constructors.cjs +1 -1
- package/_cjs/Ref/Synchronized/definition.cjs +1 -1
- package/_cjs/Ref/api/get.cjs +1 -1
- package/_cjs/Ref/api/match.cjs +1 -1
- package/_cjs/Ref/api/matchAll.cjs +1 -1
- package/_cjs/Ref/api/modify.cjs +1 -1
- package/_cjs/Ref/api/set.cjs +1 -1
- package/_cjs/Ref/api.cjs +8 -8
- package/_cjs/Ref/constructors.cjs +1 -1
- package/_cjs/Ref.cjs +9 -9
- package/_cjs/STM/api/core-api.cjs +1 -1
- package/_cjs/STM/api/core-constructors.cjs +1 -1
- package/_cjs/STM/api.cjs +2 -2
- package/_cjs/STM/driver.cjs +1 -1
- package/_cjs/STM/internal/Entry.cjs +1 -1
- package/_cjs/STM/internal/Journal.cjs +2 -2
- package/_cjs/STM.cjs +5 -5
- package/_cjs/Schedule/Decision.cjs.map +1 -1
- package/_cjs/Schedule/api/driver.cjs +11 -9
- package/_cjs/Schedule/api/driver.cjs.map +1 -1
- package/_cjs/Schedule/api.cjs +49 -49
- package/_cjs/Schedule/api.cjs.map +1 -1
- package/_cjs/Schedule.cjs +4 -17
- package/_cjs/Schedule.cjs.map +1 -1
- package/_cjs/Scope/Finalizer/definition.cjs +6 -4
- package/_cjs/Scope/Finalizer/definition.cjs.map +1 -1
- package/_cjs/Scope/Finalizer.cjs +1 -1
- package/_cjs/Scope/ReleaseMap/api/releaseAll.cjs +1 -1
- package/_cjs/Scope/ReleaseMap/api.cjs +1 -1
- package/_cjs/Scope/ReleaseMap/constructors.cjs +1 -1
- package/_cjs/Scope/ReleaseMap/definition.cjs +4 -2
- package/_cjs/Scope/ReleaseMap/definition.cjs.map +1 -1
- package/_cjs/Scope/ReleaseMap.cjs +3 -3
- package/_cjs/Scope/api.cjs +1 -1
- package/_cjs/Scope.cjs +2 -2
- package/_cjs/ScopedRef.cjs +2 -2
- package/_cjs/Sink/api.cjs +1 -1
- package/_cjs/Sink/api.cjs.map +1 -1
- package/_cjs/Sink.cjs +2 -2
- package/_cjs/State/api.cjs +2 -2
- package/_cjs/State/definition.cjs +1 -1
- package/_cjs/State.cjs +2 -2
- package/_cjs/Stream/api/zipAllWith.cjs +1 -1
- package/_cjs/Stream/api/zipWith.cjs +1 -1
- package/_cjs/Stream/api.cjs +308 -308
- package/_cjs/Stream/api.cjs.map +1 -1
- package/_cjs/Stream/internal/DebounceState.cjs.map +1 -1
- package/_cjs/Stream/internal/Handoff.cjs.map +1 -1
- package/_cjs/Stream/internal/SinkEndReason.cjs +2 -37
- package/_cjs/Stream/internal/SinkEndReason.cjs.map +1 -1
- package/_cjs/Stream.cjs +2 -2
- package/_cjs/Supervisor/constructors.cjs +1 -1
- package/_cjs/Supervisor.cjs +3 -3
- package/_cjs/TExit/constructors.cjs +1 -1
- package/_cjs/TExit.cjs +2 -2
- package/_cjs/TFuture/definition.cjs +4 -2
- package/_cjs/TFuture/definition.cjs.map +1 -1
- package/_cjs/TFuture.cjs +3 -3
- package/_cjs/TRef/api.cjs +2 -2
- package/_cjs/TRef/constructors.cjs +3 -3
- package/_cjs/TRef.cjs +3 -3
- package/_cjs/TSemaphore/api.cjs +1 -1
- package/_cjs/TSemaphore/definition.cjs +4 -2
- package/_cjs/TSemaphore/definition.cjs.map +1 -1
- package/_cjs/TSemaphore.cjs +3 -3
- package/_cjs/collection/immutable/Conc.cjs +3 -3
- package/_mjs/Channel/api/interruptWhen.mjs +1 -1
- package/_mjs/Channel/api/interruptWhen.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 +1 -1
- package/_mjs/Channel/api/mergeAllWith.mjs.map +1 -1
- package/_mjs/Channel/api/mergeWith.mjs +6 -6
- package/_mjs/Channel/api/mergeWith.mjs.map +1 -1
- package/_mjs/Channel/api.mjs +14 -14
- package/_mjs/Channel/api.mjs.map +1 -1
- package/_mjs/Channel/internal/ChannelExecutor.mjs +2 -2
- package/_mjs/Channel/internal/ChannelExecutor.mjs.map +1 -1
- package/_mjs/Channel/internal/SingleProducerAsyncInput.mjs +8 -7
- package/_mjs/Channel/internal/SingleProducerAsyncInput.mjs.map +1 -1
- package/_mjs/Clock/api.mjs.map +1 -1
- package/_mjs/Clock/live.mjs +1 -1
- package/_mjs/Clock/live.mjs.map +1 -1
- package/_mjs/Fiber/FiberContext.mjs +57 -56
- package/_mjs/Fiber/FiberContext.mjs.map +1 -1
- package/_mjs/Fiber/api/interruptFork.mjs +1 -1
- package/_mjs/Fiber/api/interruptFork.mjs.map +1 -1
- package/_mjs/FiberRef/constructors.mjs +1 -1
- package/_mjs/FiberRef/constructors.mjs.map +1 -1
- package/_mjs/FiberRefs/join.mjs +2 -2
- package/_mjs/FiberRefs/join.mjs.map +1 -1
- package/_mjs/IO/api/asyncIO.mjs +20 -0
- package/_mjs/IO/api/asyncIO.mjs.map +1 -0
- package/_mjs/IO/api/ensuringChildren.mjs +11 -0
- package/_mjs/IO/api/ensuringChildren.mjs.map +1 -0
- package/_mjs/IO/api/interrupt.mjs +4 -4
- package/_mjs/IO/api/interrupt.mjs.map +1 -1
- package/_mjs/IO/api/sleep.mjs.map +1 -1
- package/_mjs/IO/api/timeout.mjs +23 -0
- package/_mjs/IO/api/timeout.mjs.map +1 -0
- package/_mjs/IO/api.mjs +41 -40
- package/_mjs/IO/api.mjs.map +1 -1
- package/_mjs/IO/definition.mjs +6 -4
- package/_mjs/IO/definition.mjs.map +1 -1
- package/_mjs/IO/runtime.mjs +1 -1
- package/_mjs/IO/runtime.mjs.map +1 -1
- package/_mjs/IO.mjs +3 -0
- package/_mjs/IO.mjs.map +1 -1
- package/_mjs/Layer/api.mjs +4 -3
- package/_mjs/Layer/api.mjs.map +1 -1
- package/_mjs/Ref/Atomic/api.mjs +10 -6
- package/_mjs/Ref/Atomic/api.mjs.map +1 -1
- package/_mjs/Schedule/Decision.mjs.map +1 -1
- package/_mjs/Schedule/api/driver.mjs +10 -9
- package/_mjs/Schedule/api/driver.mjs.map +1 -1
- package/_mjs/Schedule/api.mjs +49 -49
- package/_mjs/Schedule/api.mjs.map +1 -1
- package/_mjs/Schedule.mjs +0 -1
- package/_mjs/Schedule.mjs.map +1 -1
- package/_mjs/Scope/Finalizer/definition.mjs +5 -4
- package/_mjs/Scope/Finalizer/definition.mjs.map +1 -1
- package/_mjs/Scope/ReleaseMap/definition.mjs +3 -2
- package/_mjs/Scope/ReleaseMap/definition.mjs.map +1 -1
- package/_mjs/Sink/api.mjs +1 -1
- package/_mjs/Sink/api.mjs.map +1 -1
- package/_mjs/Stream/api.mjs +308 -302
- package/_mjs/Stream/api.mjs.map +1 -1
- package/_mjs/Stream/internal/DebounceState.mjs.map +1 -1
- package/_mjs/Stream/internal/Handoff.mjs.map +1 -1
- package/_mjs/Stream/internal/SinkEndReason.mjs +1 -30
- package/_mjs/Stream/internal/SinkEndReason.mjs.map +1 -1
- package/_mjs/TFuture/definition.mjs +3 -2
- package/_mjs/TFuture/definition.mjs.map +1 -1
- package/_mjs/TSemaphore/definition.mjs +3 -2
- package/_mjs/TSemaphore/definition.mjs.map +1 -1
- package/_src/Channel/api.ts +3 -3
- package/_src/Channel/internal/ChannelExecutor.ts +2 -2
- package/_src/Channel/internal/SingleProducerAsyncInput.ts +1 -0
- package/_src/Clock/api.ts +1 -1
- package/_src/Clock/definition.ts +1 -1
- package/_src/Clock/live.ts +2 -2
- package/_src/Fiber/FiberContext.ts +3 -2
- package/_src/Fiber/api/interruptFork.ts +1 -1
- package/_src/FiberRef/constructors.ts +1 -1
- package/_src/FiberRefs/join.ts +2 -2
- package/_src/IO/api/asyncIO.ts +16 -0
- package/_src/IO/api/ensuringChildren.ts +11 -0
- package/_src/IO/api/interrupt.ts +2 -1
- package/_src/IO/api/sequenceT.ts +1 -1
- package/_src/IO/api/sleep.ts +1 -1
- package/_src/IO/api/timeout.ts +19 -0
- package/_src/IO/api.ts +6 -4
- package/_src/IO/definition.ts +8 -4
- package/_src/IO.ts +3 -0
- package/_src/Layer/api.ts +1 -1
- package/_src/Ref/Atomic/api.ts +4 -0
- package/_src/Schedule/Decision.ts +0 -2
- package/_src/Schedule/api/driver.ts +1 -1
- package/_src/Schedule/api.ts +0 -3
- package/_src/Schedule.ts +0 -1
- package/_src/Scope/Finalizer/definition.ts +1 -1
- package/_src/Scope/ReleaseMap/definition.ts +1 -1
- package/_src/Stream/api.ts +199 -134
- package/_src/Stream/internal/DebounceState.ts +2 -2
- package/_src/Stream/internal/Handoff.ts +9 -9
- package/_src/Stream/internal/SinkEndReason.ts +7 -25
- package/_src/TFuture/definition.ts +2 -2
- package/_src/TSemaphore/definition.ts +1 -1
- package/package.json +5 -5
- package/runTests.d.ts +1 -0
- package/Schedule/Interval.d.ts +0 -71
- package/_cjs/Schedule/Interval.cjs +0 -154
- package/_cjs/Schedule/Interval.cjs.map +0 -1
- package/_mjs/Schedule/Interval.mjs +0 -114
- package/_mjs/Schedule/Interval.mjs.map +0 -1
- package/_src/Schedule/Interval.ts +0 -103
package/_mjs/Stream/api.mjs
CHANGED
@@ -12,47 +12,47 @@ import * as tsplus_module_10 from "@fncts/io/Channel/api";
|
|
12
12
|
import * as tsplus_module_11 from "@fncts/io/Channel/core-api";
|
13
13
|
import * as tsplus_module_12 from "@fncts/base/collection/immutable/Conc/api";
|
14
14
|
import * as tsplus_module_13 from "@fncts/io/Ref/api/set";
|
15
|
-
import * as tsplus_module_14 from "@fncts/io/Ref/api/
|
16
|
-
import * as tsplus_module_15 from "@fncts/
|
17
|
-
import * as tsplus_module_16 from "@fncts/
|
18
|
-
import * as tsplus_module_17 from "@fncts/
|
19
|
-
import * as tsplus_module_18 from "@fncts/base/
|
20
|
-
import * as tsplus_module_19 from "@fncts/
|
21
|
-
import * as tsplus_module_20 from "@fncts/
|
22
|
-
import * as tsplus_module_21 from "@fncts/io/
|
23
|
-
import * as tsplus_module_22 from "@fncts/io/
|
24
|
-
import * as tsplus_module_23 from "@fncts/io/
|
25
|
-
import * as tsplus_module_24 from "@fncts/io/
|
26
|
-
import * as tsplus_module_25 from "@fncts/
|
27
|
-
import * as tsplus_module_26 from "@fncts/io/
|
28
|
-
import * as tsplus_module_27 from "@fncts/io/Queue/
|
29
|
-
import * as tsplus_module_28 from "@fncts/io/IO/
|
30
|
-
import * as tsplus_module_29 from "@fncts/io/
|
31
|
-
import * as tsplus_module_30 from "@fncts/io/
|
32
|
-
import * as tsplus_module_31 from "@fncts/
|
33
|
-
import * as tsplus_module_32 from "@fncts/
|
34
|
-
import * as tsplus_module_33 from "@fncts/
|
35
|
-
import * as tsplus_module_34 from "@fncts/
|
36
|
-
import * as tsplus_module_35 from "@fncts/io/
|
37
|
-
import * as tsplus_module_36 from "@fncts/
|
38
|
-
import * as tsplus_module_37 from "@fncts/base/data/
|
39
|
-
import * as tsplus_module_38 from "@fncts/
|
40
|
-
import * as tsplus_module_39 from "@fncts/
|
41
|
-
import * as tsplus_module_40 from "@fncts/io/
|
42
|
-
import * as tsplus_module_41 from "@fncts/
|
43
|
-
import * as tsplus_module_42 from "@fncts/
|
44
|
-
import * as tsplus_module_43 from "@fncts/io/
|
45
|
-
import * as tsplus_module_44 from "@fncts/io/
|
46
|
-
import * as tsplus_module_45 from "@fncts/io/
|
47
|
-
import * as tsplus_module_46 from "@fncts/
|
48
|
-
import * as tsplus_module_47 from "@fncts/
|
49
|
-
import * as tsplus_module_48 from "@fncts/io/
|
50
|
-
import * as tsplus_module_49 from "@fncts/io/
|
51
|
-
import * as tsplus_module_50 from "@fncts/
|
52
|
-
import * as tsplus_module_51 from "@fncts/
|
53
|
-
import * as tsplus_module_52 from "@fncts/io/
|
54
|
-
import * as tsplus_module_53 from "@fncts/io/
|
55
|
-
import * as tsplus_module_54 from "@fncts/io/
|
15
|
+
import * as tsplus_module_14 from "@fncts/io/Ref/api/get";
|
16
|
+
import * as tsplus_module_15 from "@fncts/io/Ref/api/modify";
|
17
|
+
import * as tsplus_module_16 from "@fncts/io/IO/api/forkScoped";
|
18
|
+
import * as tsplus_module_17 from "@fncts/io/Channel/api/runScoped";
|
19
|
+
import * as tsplus_module_18 from "@fncts/base/data/Either/constructors";
|
20
|
+
import * as tsplus_module_19 from "@fncts/base/collection/immutable/Conc/constructors";
|
21
|
+
import * as tsplus_module_20 from "@fncts/base/data/Maybe/destructors";
|
22
|
+
import * as tsplus_module_21 from "@fncts/io/Stream/internal/SinkEndReason";
|
23
|
+
import * as tsplus_module_22 from "@fncts/io/Fiber/api/join";
|
24
|
+
import * as tsplus_module_23 from "@fncts/io/Fiber/api/interrupt";
|
25
|
+
import * as tsplus_module_24 from "@fncts/io/IO/api/core-scope";
|
26
|
+
import * as tsplus_module_25 from "@fncts/base/data/Cause/api";
|
27
|
+
import * as tsplus_module_26 from "@fncts/io/Stream/internal/Take";
|
28
|
+
import * as tsplus_module_27 from "@fncts/io/Queue/api/operations";
|
29
|
+
import * as tsplus_module_28 from "@fncts/io/IO/runtime";
|
30
|
+
import * as tsplus_module_29 from "@fncts/io/Queue/constructors";
|
31
|
+
import * as tsplus_module_30 from "@fncts/io/IO/api/acquireRelease";
|
32
|
+
import * as tsplus_module_31 from "@fncts/io/IO/api/acquireReleaseExit";
|
33
|
+
import * as tsplus_module_32 from "@fncts/io/Hub/api";
|
34
|
+
import * as tsplus_module_33 from "@fncts/base/collection/immutable/Conc/api/replicate";
|
35
|
+
import * as tsplus_module_34 from "@fncts/base/data/Exit/api";
|
36
|
+
import * as tsplus_module_35 from "@fncts/io/Future/api";
|
37
|
+
import * as tsplus_module_36 from "@fncts/io/Future/constructors";
|
38
|
+
import * as tsplus_module_37 from "@fncts/base/data/Maybe/api";
|
39
|
+
import * as tsplus_module_38 from "@fncts/base/collection/Iterable/constructors";
|
40
|
+
import * as tsplus_module_39 from "@fncts/base/data/Exit/constructors";
|
41
|
+
import * as tsplus_module_40 from "@fncts/io/Stream/internal/DebounceState";
|
42
|
+
import * as tsplus_module_41 from "@fncts/io/Clock/api";
|
43
|
+
import * as tsplus_module_42 from "@fncts/base/collection/immutable/HashMap/api";
|
44
|
+
import * as tsplus_module_43 from "@fncts/io/TSemaphore/api";
|
45
|
+
import * as tsplus_module_44 from "@fncts/io/STM/api";
|
46
|
+
import * as tsplus_module_45 from "@fncts/io/TSemaphore/constructors";
|
47
|
+
import * as tsplus_module_46 from "@fncts/io/Sink/api";
|
48
|
+
import * as tsplus_module_47 from "@fncts/base/data/Predicate/api";
|
49
|
+
import * as tsplus_module_48 from "@fncts/io/Fiber/api/poll";
|
50
|
+
import * as tsplus_module_49 from "@fncts/io/IO/api/environment";
|
51
|
+
import * as tsplus_module_50 from "@fncts/io/collection/immutable/Conc/findIO";
|
52
|
+
import * as tsplus_module_51 from "@fncts/base/data/Exit/definition";
|
53
|
+
import * as tsplus_module_52 from "@fncts/io/Stream/internal/Pull";
|
54
|
+
import * as tsplus_module_53 from "@fncts/io/Queue/api/takeBetween";
|
55
|
+
import * as tsplus_module_54 from "@fncts/io/Channel/api/interruptWhen";
|
56
56
|
import * as tsplus_module_55 from "@fncts/io/Channel/api/mapOutIOC";
|
57
57
|
import * as tsplus_module_56 from "@fncts/io/Channel/api/mergeMap";
|
58
58
|
import * as tsplus_module_57 from "@fncts/io/Channel/internal/MergeDecision";
|
@@ -61,8 +61,7 @@ import * as tsplus_module_59 from "@fncts/io/Layer/MemoMap";
|
|
61
61
|
import * as tsplus_module_60 from "@fncts/io/Layer/api";
|
62
62
|
import * as tsplus_module_61 from "@fncts/io/Channel/api/runDrain";
|
63
63
|
import * as tsplus_module_62 from "@fncts/base/data/exceptions";
|
64
|
-
import * as tsplus_module_63 from "@fncts/io/
|
65
|
-
import * as tsplus_module_64 from "@fncts/io/Channel/api/toPull";
|
64
|
+
import * as tsplus_module_63 from "@fncts/io/Channel/api/toPull";
|
66
65
|
export const aggregateAsyncWithin_ = aggregateAsyncWithin_1;
|
67
66
|
export const aggregateAsyncWithinEither_ = aggregateAsyncWithinEither_1;
|
68
67
|
export const apSecond_ = apSecond_1;
|
@@ -98,9 +97,6 @@ export const fromQueue_ = fromQueue_1;
|
|
98
97
|
export const fromQueueWithShutdown = fromQueueWithShutdown_1;
|
99
98
|
export const halt = halt_1;
|
100
99
|
export const interleaveWith_ = interleaveWith_1;
|
101
|
-
export const loopOnChunks_ = loopOnChunks_1;
|
102
|
-
export const loopOnPartialChunks_ = loopOnPartialChunks_1;
|
103
|
-
export const loopOnPartialChunksElements_ = loopOnPartialChunksElements_1;
|
104
100
|
export const map_ = map_1;
|
105
101
|
export const mapAccumIO_ = mapAccumIO_1;
|
106
102
|
export const mapChunks_ = mapChunks_1;
|
@@ -138,7 +134,7 @@ export const unwrap = unwrap_1;
|
|
138
134
|
export const unwrapScoped = unwrapScoped_1;
|
139
135
|
import { constVoid, identity, tuple } from "@fncts/base/data/function";
|
140
136
|
import { DEFAULT_CHUNK_SIZE, Stream } from "./definition.mjs";
|
141
|
-
import { ScheduleEnd,
|
137
|
+
import { ScheduleEnd, UpstreamEnd } from "./internal/SinkEndReason.mjs";
|
142
138
|
/**
|
143
139
|
* Submerges the error case of an `Either` into the `Stream`.
|
144
140
|
*
|
@@ -146,7 +142,7 @@ import { ScheduleEnd, ScheduleTimeout, SinkEnd, UpstreamEnd } from "./internal/S
|
|
146
142
|
*/
|
147
143
|
|
148
144
|
export function absolve(self) {
|
149
|
-
return mapIO_1(self, either => tsplus_module_1.fromEither(() => either, fileName_1 + ":
|
145
|
+
return mapIO_1(self, either => tsplus_module_1.fromEither(() => either, fileName_1 + ":25:46"));
|
150
146
|
}
|
151
147
|
/**
|
152
148
|
* Aggregates elements of this stream using the provided sink for as long
|
@@ -192,44 +188,56 @@ function aggregateAsyncWithin_1(stream, sink, schedule) {
|
|
192
188
|
|
193
189
|
|
194
190
|
function aggregateAsyncWithinEither_1(stream, sink, schedule) {
|
195
|
-
const deps = tsplus_module_9.sequenceT(tsplus_module_5.make(), tsplus_module_6.make(() => new
|
196
|
-
return flatMap_1(fromIO_1(deps), ([handoff, sinkEndReason, sinkLeftovers, scheduleDriver]) => {
|
197
|
-
const handoffProducer = tsplus_module_10.readWithCause(_in => tsplus_module_11.apSecond_(tsplus_module_10.fromIO(tsplus_module_5.offer(handoff, tsplus_module_5.emit(_in))), handoffProducer), cause => tsplus_module_10.fromIO(tsplus_module_5.offer(handoff, tsplus_module_5.halt(cause))), _ => tsplus_module_10.fromIO(tsplus_module_5.offer(handoff, tsplus_module_5.end(new UpstreamEnd()))));
|
198
|
-
const handoffConsumer = tsplus_module_10.unwrap(tsplus_module_1.flatMap_(
|
199
|
-
if (tsplus_module_12.
|
200
|
-
return tsplus_module_1.succeedNow(tsplus_module_11.apSecond_(tsplus_module_10.writeNow(leftovers), handoffConsumer), fileName_1 + ":
|
191
|
+
const deps = tsplus_module_9.sequenceT(tsplus_module_5.make(), tsplus_module_6.make(() => new ScheduleEnd()), tsplus_module_6.make(() => tsplus_module_7.empty()), tsplus_module_8.driver(schedule), tsplus_module_6.make(() => false));
|
192
|
+
return flatMap_1(fromIO_1(deps), ([handoff, sinkEndReason, sinkLeftovers, scheduleDriver, consumed]) => {
|
193
|
+
const handoffProducer = tsplus_module_10.readWithCause(_in => tsplus_module_11.apSecond_(tsplus_module_10.fromIO(() => tsplus_module_5.offer(handoff, tsplus_module_5.emit(_in))), handoffProducer), cause => tsplus_module_10.fromIO(() => tsplus_module_5.offer(handoff, tsplus_module_5.halt(cause))), _ => tsplus_module_10.fromIO(() => tsplus_module_5.offer(handoff, tsplus_module_5.end(new UpstreamEnd()))));
|
194
|
+
const handoffConsumer = tsplus_module_10.unwrap(() => tsplus_module_1.flatMap_(tsplus_module_15.getAndSet_(sinkLeftovers, tsplus_module_7.empty()), leftovers => {
|
195
|
+
if (tsplus_module_12.isNonEmpty(leftovers)) {
|
196
|
+
return tsplus_module_1.apSecond_(tsplus_module_13.set_(consumed, true), tsplus_module_1.succeedNow(tsplus_module_11.apSecond_(tsplus_module_10.writeNow(leftovers), handoffConsumer), fileName_1 + ":101:52"), fileName_1 + ":101:38");
|
201
197
|
} else {
|
202
198
|
return tsplus_module_1.map_(tsplus_module_5.take(handoff), signal => tsplus_module_5.matchSignal_(signal, {
|
203
199
|
Emit: ({
|
204
200
|
els
|
205
|
-
}) => tsplus_module_11.apSecond_(tsplus_module_10.writeNow(els), handoffConsumer),
|
201
|
+
}) => tsplus_module_11.apSecond_(tsplus_module_11.apSecond_(tsplus_module_10.fromIO(() => tsplus_module_13.set_(consumed, true)), tsplus_module_10.writeNow(els)), handoffConsumer),
|
206
202
|
Halt: ({
|
207
203
|
error
|
208
204
|
}) => tsplus_module_11.failCause(() => error),
|
209
205
|
End: ({
|
210
206
|
reason
|
211
|
-
}) =>
|
212
|
-
|
207
|
+
}) => {
|
208
|
+
if (reason._tag === "ScheduleEnd"
|
209
|
+
/* SinkEndReasonTag.ScheduleEnd */
|
210
|
+
) {
|
211
|
+
return tsplus_module_10.unwrap(() => tsplus_module_1.map_(tsplus_module_14.get(consumed), p => p ? tsplus_module_10.fromIO(() => tsplus_module_13.set_(sinkEndReason, new ScheduleEnd())) : tsplus_module_11.apSecond_(tsplus_module_10.fromIO(() => tsplus_module_13.set_(sinkEndReason, new ScheduleEnd())), handoffConsumer), fileName_1 + ":110:37"));
|
212
|
+
} else {
|
213
|
+
return tsplus_module_10.fromIO(() => tsplus_module_13.set_(sinkEndReason, reason));
|
214
|
+
}
|
215
|
+
}
|
216
|
+
}), fileName_1 + ":103:34");
|
213
217
|
}
|
214
|
-
}, fileName_1 + ":
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
218
|
+
}, fileName_1 + ":99:55"));
|
219
|
+
|
220
|
+
function timeout(lastB) {
|
221
|
+
return scheduleDriver.next(lastB, fileName_1 + ":127:33");
|
222
|
+
}
|
223
|
+
|
224
|
+
const scheduledAggregator = (sinkFiber, scheduleFiber) => {
|
225
|
+
const forkSink = tsplus_module_1.apSecond_(tsplus_module_13.set_(consumed, false), tsplus_module_16.forkScoped(tsplus_module_17.runScoped(tsplus_module_10.doneCollect(tsplus_module_10.pipeToOrFail_(handoffConsumer, sink.channel)))), fileName_1 + ":135:30");
|
226
|
+
|
227
|
+
function handleSide(leftovers, b, c) {
|
228
|
+
return tsplus_module_10.unwrap(() => tsplus_module_1.apSecond_(tsplus_module_13.set_(sinkLeftovers, tsplus_module_12.flatten(leftovers)), tsplus_module_1.map_(tsplus_module_14.get(sinkEndReason), reason => tsplus_module_21.matchSinkEndReason_(reason, {
|
229
|
+
ScheduleEnd: () => tsplus_module_10.unwrapScoped(tsplus_module_1.flatMap_(tsplus_module_14.get(consumed), consumed_ => tsplus_module_1.flatMap_(forkSink, sinkFiber => tsplus_module_1.map_(tsplus_module_16.forkScoped(timeout(tsplus_module_3.just(b))), scheduleFiber => {
|
230
|
+
const toWrite = tsplus_module_20.match_(c, () => tsplus_module_19.make(tsplus_module_18.right(b)), c => tsplus_module_19.make(tsplus_module_18.right(b), tsplus_module_18.left(c)));
|
231
|
+
return consumed_ ? tsplus_module_11.apSecond_(tsplus_module_10.write(() => toWrite), scheduledAggregator(sinkFiber, scheduleFiber)) : scheduledAggregator(sinkFiber, scheduleFiber);
|
232
|
+
}, fileName_1 + ":147:46"), fileName_1 + ":146:46"), fileName_1 + ":145:46")),
|
233
|
+
UpstreamEnd: () => tsplus_module_10.unwrap(() => tsplus_module_1.map_(tsplus_module_14.get(consumed), p => p ? tsplus_module_10.write(() => tsplus_module_19.make(tsplus_module_18.right(b))) : tsplus_module_10.unit, fileName_1 + ":158:50"))
|
234
|
+
}), fileName_1 + ":140:34"), fileName_1 + ":139:49"));
|
235
|
+
}
|
236
|
+
|
237
|
+
return tsplus_module_10.unwrap(() => tsplus_module_24.raceWith_(tsplus_module_22.join(sinkFiber), () => tsplus_module_22.join(scheduleFiber), (sinkExit, scheduleFiber) => tsplus_module_1.apSecond_(tsplus_module_23.interrupt(scheduleFiber), tsplus_module_1.map_(tsplus_module_1.fromExit(() => sinkExit, fileName_1 + ":169:24"), ([leftovers, b]) => handleSide(leftovers, b, tsplus_module_3.nothing()), fileName_1 + ":169:38"), fileName_1 + ":168:38"), (scheduleExit, sinkFiber) => tsplus_module_1.matchCauseIO_(tsplus_module_1.fromExit(() => scheduleExit, fileName_1 + ":171:24"), cause => tsplus_module_4.match_(tsplus_module_25.failureOrCause(cause), () => tsplus_module_1.apSecond_(tsplus_module_24.forkDaemon(tsplus_module_5.offer(handoff, tsplus_module_5.end(new ScheduleEnd()))), tsplus_module_1.map_(tsplus_module_22.join(sinkFiber), ([leftovers, b]) => handleSide(leftovers, b, tsplus_module_3.nothing()), fileName_1 + ":176:39"), fileName_1 + ":175:85"), cause => tsplus_module_1.apSecond_(tsplus_module_24.forkDaemon(tsplus_module_5.offer(handoff, tsplus_module_5.halt(cause))), tsplus_module_1.map_(tsplus_module_22.join(sinkFiber), ([leftovers, b]) => handleSide(leftovers, b, tsplus_module_3.nothing()), fileName_1 + ":179:39"), fileName_1 + ":178:74")), c => tsplus_module_1.apSecond_(tsplus_module_24.forkDaemon(tsplus_module_5.offer(handoff, tsplus_module_5.end(new ScheduleEnd()))), tsplus_module_1.map_(tsplus_module_22.join(sinkFiber), ([leftovers, b]) => handleSide(leftovers, b, tsplus_module_3.just(c)), fileName_1 + ":183:35"), fileName_1 + ":182:81"), fileName_1 + ":171:51"), fileName_1 + ":165:32"));
|
230
238
|
};
|
231
239
|
|
232
|
-
return
|
240
|
+
return unwrapScoped_1(tsplus_module_1.flatMap_(tsplus_module_16.forkScoped(tsplus_module_17.runScoped(tsplus_module_10.pipeTo_(stream.channel, handoffProducer))), () => tsplus_module_1.flatMap_(tsplus_module_16.forkScoped(tsplus_module_17.runScoped(tsplus_module_10.doneCollect(tsplus_module_10.pipeToOrFail_(handoffConsumer, sink.channel)))), sinkFiber => tsplus_module_1.map_(tsplus_module_16.forkScoped(timeout(tsplus_module_3.nothing())), scheduleFiber => new Stream(scheduledAggregator(sinkFiber, scheduleFiber)), fileName_1 + ":193:32"), fileName_1 + ":192:32"), fileName_1 + ":191:10"));
|
233
241
|
});
|
234
242
|
}
|
235
243
|
/**
|
@@ -270,13 +278,13 @@ export function as_(stream, b) {
|
|
270
278
|
*/
|
271
279
|
|
272
280
|
function asyncInterrupt_1(register, outputBuffer = 16) {
|
273
|
-
return unwrapScoped_1(tsplus_module_1.flatMap_(
|
274
|
-
const effect = tsplus_module_1.flatMap_(
|
275
|
-
return runtime.unsafeRunAsyncWith(effect, cb || constVoid, fileName_1 + ":
|
276
|
-
}), fileName_1 + ":
|
277
|
-
const loop = tsplus_module_10.unwrap(tsplus_module_1.match_(tsplus_module_1.flatMap_(
|
281
|
+
return unwrapScoped_1(tsplus_module_1.flatMap_(tsplus_module_30.acquireRelease(() => tsplus_module_29.makeBounded(outputBuffer), queue => tsplus_module_27.shutdown(queue)), output => tsplus_module_1.flatMap_(tsplus_module_28.runtime(fileName_1 + ":249:40"), runtime => tsplus_module_1.map_(tsplus_module_1.succeed(() => register((k, cb) => {
|
282
|
+
const effect = tsplus_module_1.flatMap_(tsplus_module_26.fromPull(k), a => tsplus_module_27.offer_(output, a), fileName_1 + ":253:52");
|
283
|
+
return runtime.unsafeRunAsyncWith(effect, cb || constVoid, fileName_1 + ":254:46");
|
284
|
+
}), fileName_1 + ":251:19"), eitherStream => tsplus_module_4.match_(eitherStream, canceler => {
|
285
|
+
const loop = tsplus_module_10.unwrap(() => tsplus_module_1.match_(tsplus_module_1.flatMap_(tsplus_module_27.take(output), take => tsplus_module_26.done(take), fileName_1 + ":262:23"), maybeError => tsplus_module_20.match_(maybeError, () => tsplus_module_11.endNow(undefined), tsplus_module_10.failNow), as => tsplus_module_11.apSecond_(tsplus_module_10.writeNow(as), loop), fileName_1 + ":263:21"));
|
278
286
|
return ensuring_1(new Stream(loop), canceler);
|
279
|
-
}, stream => unwrap_1(tsplus_module_1.as_(
|
287
|
+
}, stream => unwrap_1(tsplus_module_1.as_(tsplus_module_27.shutdown(output), () => stream))), fileName_1 + ":250:29"), fileName_1 + ":249:29"), fileName_1 + ":248:29"));
|
280
288
|
}
|
281
289
|
/**
|
282
290
|
* Creates a stream from an asynchronous callback that can be called multiple times.
|
@@ -289,7 +297,7 @@ function asyncInterrupt_1(register, outputBuffer = 16) {
|
|
289
297
|
|
290
298
|
|
291
299
|
function asyncMaybe_1(register, outputBuffer = 16) {
|
292
|
-
return asyncInterrupt_1(k =>
|
300
|
+
return asyncInterrupt_1(k => tsplus_module_20.match_(register(k), () => tsplus_module_18.left(tsplus_module_1.unit), tsplus_module_18.right), outputBuffer);
|
293
301
|
}
|
294
302
|
/**
|
295
303
|
* @tsplus static fncts.io.StreamOps async
|
@@ -307,10 +315,10 @@ export function async(register, outputBuffer = 16) {
|
|
307
315
|
*/
|
308
316
|
|
309
317
|
export function asyncIO(register, outputBuffer = 16) {
|
310
|
-
return new Stream(tsplus_module_10.unwrapScoped(tsplus_module_1.flatMap_(
|
311
|
-
const loop = tsplus_module_10.unwrap(tsplus_module_1.matchCauseIO_(tsplus_module_1.flatMap_(
|
318
|
+
return new Stream(tsplus_module_10.unwrapScoped(tsplus_module_1.flatMap_(tsplus_module_30.acquireRelease(() => tsplus_module_29.makeBounded(outputBuffer), _ => tsplus_module_27.shutdown(_)), output => tsplus_module_1.flatMap_(tsplus_module_28.runtime(fileName_1 + ":319:37"), runtime => tsplus_module_1.map_(register((k, cb) => runtime.unsafeRunAsyncWith(tsplus_module_1.flatMap_(tsplus_module_26.fromPull(k), a => tsplus_module_27.offer_(output, a), fileName_1 + ":323:39"), cb || constVoid, fileName_1 + ":322:39")), () => {
|
319
|
+
const loop = tsplus_module_10.unwrap(() => tsplus_module_1.matchCauseIO_(tsplus_module_1.flatMap_(tsplus_module_27.take(output), take => tsplus_module_26.done(take), fileName_1 + ":330:21"), cause => tsplus_module_1.as_(tsplus_module_27.shutdown(output), () => tsplus_module_4.match_(tsplus_module_25.failureOrCause(cause), maybeError => tsplus_module_20.match_(maybeError, () => tsplus_module_11.endNow(undefined), tsplus_module_10.failNow), tsplus_module_11.failCauseNow)), as => tsplus_module_1.succeed(() => tsplus_module_11.apSecond_(tsplus_module_10.writeNow(as), loop), fileName_1 + ":339:33"), fileName_1 + ":331:26"));
|
312
320
|
return loop;
|
313
|
-
}), fileName_1 + ":
|
321
|
+
}), fileName_1 + ":319:26"), fileName_1 + ":318:26")));
|
314
322
|
}
|
315
323
|
/**
|
316
324
|
* Returns a stream whose failure and success channels have been mapped by
|
@@ -328,7 +336,7 @@ export function bimap_(stream, f, g) {
|
|
328
336
|
*/
|
329
337
|
|
330
338
|
export function acquireRelease_(acquire, release) {
|
331
|
-
return scoped_1(
|
339
|
+
return scoped_1(tsplus_module_30.acquireRelease(() => acquire, release));
|
332
340
|
}
|
333
341
|
/**
|
334
342
|
* Creates a stream from a single value that will get cleaned up after the
|
@@ -338,7 +346,7 @@ export function acquireRelease_(acquire, release) {
|
|
338
346
|
*/
|
339
347
|
|
340
348
|
export function acquireReleaseExit_(acquire, release) {
|
341
|
-
return scoped_1(
|
349
|
+
return scoped_1(tsplus_module_31.acquireReleaseExit(() => acquire, release, fileName_1 + ":379:45"));
|
342
350
|
}
|
343
351
|
/**
|
344
352
|
* Fan out the stream, producing a list of streams that have the same elements as this stream.
|
@@ -349,7 +357,7 @@ export function acquireReleaseExit_(acquire, release) {
|
|
349
357
|
*/
|
350
358
|
|
351
359
|
export function broadcast_(stream, n, maximumLag) {
|
352
|
-
return tsplus_module_1.map_(broadcastedQueues_1(stream, n, maximumLag), c => tsplus_module_12.map_(c, hub => flattenTake_1(fromQueueWithShutdown_1(hub))), fileName_1 + ":
|
360
|
+
return tsplus_module_1.map_(broadcastedQueues_1(stream, n, maximumLag), c => tsplus_module_12.map_(c, hub => flattenTake_1(fromQueueWithShutdown_1(hub))), fileName_1 + ":396:9");
|
353
361
|
}
|
354
362
|
/**
|
355
363
|
* Fan out the stream, producing a dynamic number of streams that have the same elements as this stream.
|
@@ -360,7 +368,7 @@ export function broadcast_(stream, n, maximumLag) {
|
|
360
368
|
*/
|
361
369
|
|
362
370
|
export function broadcastDynamic_(stream, maximumLag) {
|
363
|
-
return tsplus_module_1.map_(broadcastedQueuesDynamic_1(stream, maximumLag), scoped => flattenTake_1(flatMap_1(scoped_1(scoped), fromQueue_1)), fileName_1 + ":
|
371
|
+
return tsplus_module_1.map_(broadcastedQueuesDynamic_1(stream, maximumLag), scoped => flattenTake_1(flatMap_1(scoped_1(scoped), fromQueue_1)), fileName_1 + ":412:9");
|
364
372
|
}
|
365
373
|
/**
|
366
374
|
* Converts the stream to a managed list of queues. Every value will be replicated to every queue with the
|
@@ -372,7 +380,7 @@ export function broadcastDynamic_(stream, maximumLag) {
|
|
372
380
|
*/
|
373
381
|
|
374
382
|
function broadcastedQueues_1(stream, n, maximumLag) {
|
375
|
-
return tsplus_module_1.flatMap_(
|
383
|
+
return tsplus_module_1.flatMap_(tsplus_module_32.makeBounded(maximumLag), hub => tsplus_module_1.flatMap_(tsplus_module_1.sequenceIterable(tsplus_module_33.replicate(n, tsplus_module_32.subscribe(hub))), queues => tsplus_module_1.map_(tsplus_module_1.fork(runIntoHubScoped_1(stream, hub)), () => queues), fileName_1 + ":430:21"), fileName_1 + ":429:21");
|
376
384
|
}
|
377
385
|
/**
|
378
386
|
* Converts the stream to a managed dynamic amount of queues. Every chunk will be replicated to every queue with the
|
@@ -385,7 +393,7 @@ function broadcastedQueues_1(stream, n, maximumLag) {
|
|
385
393
|
|
386
394
|
|
387
395
|
function broadcastedQueuesDynamic_1(stream, maximumLag) {
|
388
|
-
return tsplus_module_1.map_(toHub_1(stream, maximumLag), hub =>
|
396
|
+
return tsplus_module_1.map_(toHub_1(stream, maximumLag), hub => tsplus_module_32.subscribe(hub), fileName_1 + ":448:38");
|
389
397
|
}
|
390
398
|
/**
|
391
399
|
* Allows a faster producer to progress independently of a slower consumer by buffering
|
@@ -398,9 +406,9 @@ function broadcastedQueuesDynamic_1(stream, maximumLag) {
|
|
398
406
|
export function buffer_(stream, capacity) {
|
399
407
|
const queue = toQueueOfElements_1(stream, capacity);
|
400
408
|
return new Stream(tsplus_module_10.unwrapScoped(tsplus_module_1.map_(queue, queue => {
|
401
|
-
const process = tsplus_module_11.flatMap_(tsplus_module_10.fromIO(
|
409
|
+
const process = tsplus_module_11.flatMap_(tsplus_module_10.fromIO(() => tsplus_module_27.take(queue)), exit => tsplus_module_34.match_(exit, cause => tsplus_module_20.match_(tsplus_module_25.flipCauseOption(cause), () => tsplus_module_11.endNow(undefined), tsplus_module_11.failCauseNow), value => tsplus_module_11.apSecond_(tsplus_module_10.writeNow(tsplus_module_19.single(value)), process)));
|
402
410
|
return process;
|
403
|
-
}, fileName_1 + ":
|
411
|
+
}, fileName_1 + ":461:16")));
|
404
412
|
}
|
405
413
|
/**
|
406
414
|
* @tsplus fluent fncts.io.Stream bufferChunks
|
@@ -409,9 +417,9 @@ export function buffer_(stream, capacity) {
|
|
409
417
|
export function bufferChunks_(stream, capacity) {
|
410
418
|
const queue = toQueue_1(stream, capacity);
|
411
419
|
return new Stream(tsplus_module_10.unwrapScoped(tsplus_module_1.map_(queue, queue => {
|
412
|
-
const process = tsplus_module_11.flatMap_(tsplus_module_10.fromIO(
|
420
|
+
const process = tsplus_module_11.flatMap_(tsplus_module_10.fromIO(() => tsplus_module_27.take(queue)), take => tsplus_module_26.match_(take, tsplus_module_11.endNow(undefined), tsplus_module_11.failCauseNow, value => tsplus_module_11.apSecond_(tsplus_module_10.writeNow(value), process)));
|
413
421
|
return process;
|
414
|
-
}, fileName_1 + ":
|
422
|
+
}, fileName_1 + ":483:16")));
|
415
423
|
}
|
416
424
|
/**
|
417
425
|
* Allows a faster producer to progress independently of a slower consumer by buffering
|
@@ -423,19 +431,19 @@ export function bufferChunks_(stream, capacity) {
|
|
423
431
|
export function bufferUnbounded(stream) {
|
424
432
|
const queue = toQueueUnbounded_1(stream);
|
425
433
|
return new Stream(tsplus_module_10.unwrapScoped(tsplus_module_1.map_(queue, queue => {
|
426
|
-
const process = tsplus_module_11.flatMap_(tsplus_module_10.fromIO(
|
434
|
+
const process = tsplus_module_11.flatMap_(tsplus_module_10.fromIO(() => tsplus_module_27.take(queue)), take => tsplus_module_26.match_(take, tsplus_module_11.endNow(undefined), tsplus_module_11.failCauseNow, value => tsplus_module_11.apSecond_(tsplus_module_10.writeNow(value), process)));
|
427
435
|
return process;
|
428
|
-
}, fileName_1 + ":
|
436
|
+
}, fileName_1 + ":508:16")));
|
429
437
|
}
|
430
438
|
|
431
439
|
function bufferSignalProducer(queue, ref) {
|
432
|
-
const terminate = take => tsplus_module_10.fromIO(tsplus_module_1.flatMap_(
|
440
|
+
const terminate = take => tsplus_module_10.fromIO(() => tsplus_module_1.flatMap_(tsplus_module_14.get(ref), latch => tsplus_module_1.flatMap_(tsplus_module_35.wait(latch), () => tsplus_module_1.flatMap_(tsplus_module_36.make(), p => tsplus_module_1.flatMap_(tsplus_module_27.offer_(queue, tuple(take, p)), () => tsplus_module_1.flatMap_(tsplus_module_13.set_(ref, p), () => tsplus_module_1.map_(tsplus_module_35.wait(p), () => void 0), fileName_1 + ":534:10"), fileName_1 + ":533:10"), fileName_1 + ":532:20"), fileName_1 + ":531:10"), fileName_1 + ":530:24"));
|
433
441
|
|
434
|
-
return tsplus_module_10.readWith(inp => tsplus_module_11.apSecond_(tsplus_module_10.fromIO(tsplus_module_1.flatMap_(
|
442
|
+
return tsplus_module_10.readWith(inp => tsplus_module_11.apSecond_(tsplus_module_10.fromIO(() => tsplus_module_1.flatMap_(tsplus_module_36.make(), p => tsplus_module_1.flatMap_(tsplus_module_27.offer_(queue, tuple(tsplus_module_26.chunk(inp), p)), added => tsplus_module_1.map_(tsplus_module_1.when_(tsplus_module_13.set_(ref, p), () => added, fileName_1 + ":544:28"), () => void 0), fileName_1 + ":543:26"), fileName_1 + ":542:26")), bufferSignalProducer(queue, ref)), e => terminate(tsplus_module_26.fail(e)), () => terminate(tsplus_module_26.end));
|
435
443
|
}
|
436
444
|
|
437
445
|
function bufferSignalConsumer(queue) {
|
438
|
-
const process = tsplus_module_11.flatMap_(tsplus_module_10.fromIO(
|
446
|
+
const process = tsplus_module_11.flatMap_(tsplus_module_10.fromIO(() => tsplus_module_27.take(queue)), ([take, promise]) => tsplus_module_11.apSecond_(tsplus_module_10.fromIO(() => tsplus_module_35.succeed_(promise, undefined)), tsplus_module_26.match_(take, tsplus_module_11.endNow(undefined), tsplus_module_11.failCauseNow, value => tsplus_module_11.apSecond_(tsplus_module_10.writeNow(value), process))));
|
439
447
|
return process;
|
440
448
|
}
|
441
449
|
/**
|
@@ -447,7 +455,7 @@ function bufferSignalConsumer(queue) {
|
|
447
455
|
|
448
456
|
|
449
457
|
function catchAll_1(stream, f) {
|
450
|
-
return catchAllCause_1(stream, cause => tsplus_module_4.match_(
|
458
|
+
return catchAllCause_1(stream, cause => tsplus_module_4.match_(tsplus_module_25.failureOrCause(cause), f, failCauseNow_1));
|
451
459
|
}
|
452
460
|
/**
|
453
461
|
* Switches over to the stream produced by the provided function in case this one
|
@@ -471,7 +479,7 @@ function catchAllCause_1(stream, f) {
|
|
471
479
|
|
472
480
|
|
473
481
|
export function catchJust_(stream, pf) {
|
474
|
-
return catchAll_1(stream, e =>
|
482
|
+
return catchAll_1(stream, e => tsplus_module_37.getOrElse_(pf(e), () => failNow_1(e)));
|
475
483
|
}
|
476
484
|
/**
|
477
485
|
* Switches over to the stream produced by the provided function in case this one
|
@@ -482,7 +490,7 @@ export function catchJust_(stream, pf) {
|
|
482
490
|
*/
|
483
491
|
|
484
492
|
export function catchJustCause_(stream, pf) {
|
485
|
-
return catchAllCause_1(stream, cause =>
|
493
|
+
return catchAllCause_1(stream, cause => tsplus_module_37.getOrElse_(pf(cause), () => failCauseNow_1(cause)));
|
486
494
|
}
|
487
495
|
/**
|
488
496
|
* Returns a stream made of the concatenation in strict order of all the streams
|
@@ -502,12 +510,12 @@ function flatMap_1(stream, f) {
|
|
502
510
|
|
503
511
|
|
504
512
|
export function chunks(stream) {
|
505
|
-
return mapChunks_1(stream,
|
513
|
+
return mapChunks_1(stream, tsplus_module_19.single);
|
506
514
|
}
|
507
515
|
|
508
516
|
function changesWithWriter(f, last) {
|
509
517
|
return tsplus_module_10.readWithCause(chunk => {
|
510
|
-
const [newLast, newChunk] = tsplus_module_12.foldLeft_(chunk, [last, tsplus_module_7.empty()], ([maybeLast, os], o1) =>
|
518
|
+
const [newLast, newChunk] = tsplus_module_12.foldLeft_(chunk, [last, tsplus_module_7.empty()], ([maybeLast, os], o1) => tsplus_module_20.match_(maybeLast, () => [tsplus_module_3.just(o1), tsplus_module_12.append_(os, o1)], o => f(o, o1) ? [tsplus_module_3.just(o1), os] : [tsplus_module_3.just(o1), tsplus_module_12.append_(os, o1)]));
|
511
519
|
return tsplus_module_11.apSecond_(tsplus_module_10.writeNow(newChunk), changesWithWriter(f, newLast));
|
512
520
|
}, tsplus_module_11.failCauseNow, () => tsplus_module_10.unit);
|
513
521
|
}
|
@@ -546,23 +554,21 @@ export function collectWhile_(stream, pf) {
|
|
546
554
|
*/
|
547
555
|
|
548
556
|
export function collectWhileIO_(stream, pf) {
|
549
|
-
return
|
550
|
-
|
557
|
+
return new Stream(tsplus_module_10.pipeTo_(stream.channel, collectWhileIOLoop(tsplus_module_38.empty()[Symbol.iterator](), pf)));
|
558
|
+
}
|
551
559
|
|
552
|
-
|
553
|
-
|
554
|
-
return tsplus_module_1.succeedNow(true, fileName_1 + ":681:29");
|
555
|
-
} else {
|
556
|
-
return tsplus_module_1.flatMap_(pfJust(tsplus_module_12.unsafeHead(chunk)), cont => cont ? loop(tsplus_module_12.unsafeTail(chunk)) : tsplus_module_1.succeedNow(false, fileName_1 + ":683:105"), fileName_1 + ":683:48");
|
557
|
-
}
|
558
|
-
};
|
560
|
+
function collectWhileIOLoop(iterator, pf) {
|
561
|
+
const next = iterator.next();
|
559
562
|
|
560
|
-
|
561
|
-
|
563
|
+
if (next.done) {
|
564
|
+
return tsplus_module_10.readWithCause(elem => collectWhileIOLoop(elem[Symbol.iterator](), pf), tsplus_module_11.failCauseNow, tsplus_module_11.succeedNow);
|
565
|
+
} else {
|
566
|
+
return tsplus_module_10.unwrap(() => tsplus_module_20.match_(pf(next.value), () => tsplus_module_1.succeedNow(tsplus_module_10.unit, fileName_1 + ":730:28"), b => tsplus_module_1.map_(b, b => tsplus_module_11.apSecond_(tsplus_module_10.writeNow(tsplus_module_19.single(b)), collectWhileIOLoop(iterator, pf)), fileName_1 + ":731:21")));
|
567
|
+
}
|
562
568
|
}
|
563
569
|
|
564
570
|
function combineProducer(handoff, latch) {
|
565
|
-
return tsplus_module_11.apSecond_(tsplus_module_10.fromIO(tsplus_module_5.take(latch)), tsplus_module_10.readWithCause(value => tsplus_module_11.apSecond_(tsplus_module_10.fromIO(tsplus_module_5.offer(handoff,
|
571
|
+
return tsplus_module_11.apSecond_(tsplus_module_10.fromIO(() => tsplus_module_5.take(latch)), tsplus_module_10.readWithCause(value => tsplus_module_11.apSecond_(tsplus_module_10.fromIO(() => tsplus_module_5.offer(handoff, tsplus_module_39.succeed(value))), combineProducer(handoff, latch)), cause => tsplus_module_10.fromIO(() => tsplus_module_5.offer(handoff, tsplus_module_39.failCause(tsplus_module_25.map_(cause, tsplus_module_3.just)))), () => tsplus_module_11.apSecond_(tsplus_module_10.fromIO(() => tsplus_module_5.offer(handoff, tsplus_module_39.fail(tsplus_module_3.nothing()))), combineProducer(handoff, latch))));
|
566
572
|
}
|
567
573
|
/**
|
568
574
|
* Combines the elements from this stream and the specified stream by repeatedly applying the
|
@@ -577,15 +583,15 @@ function combineProducer(handoff, latch) {
|
|
577
583
|
|
578
584
|
|
579
585
|
export function combine_(stream, that, s, f) {
|
580
|
-
return new Stream(tsplus_module_10.unwrapScoped(tsplus_module_1.map_(tsplus_module_1.flatMap_(tsplus_module_5.make(), left => tsplus_module_1.flatMap_(tsplus_module_5.make(), right => tsplus_module_1.flatMap_(tsplus_module_5.make(), latchL => tsplus_module_1.flatMap_(tsplus_module_5.make(), latchR => tsplus_module_1.flatMap_(tsplus_module_1.fork(
|
581
|
-
const pullLeft = tsplus_module_1.flatMap_(tsplus_module_1.apSecond_(tsplus_module_5.offer(latchL, undefined), tsplus_module_5.take(left), fileName_1 + ":
|
582
|
-
const pullRight = tsplus_module_1.flatMap_(tsplus_module_1.apSecond_(tsplus_module_5.offer(latchR, undefined), tsplus_module_5.take(right), fileName_1 + ":
|
583
|
-
return unfoldIO_1(s, s => tsplus_module_1.flatMap_(f(s, pullLeft, pullRight), exit => tsplus_module_1.optional(tsplus_module_1.fromExitNow(exit, fileName_1 + ":
|
584
|
-
}, fileName_1 + ":
|
586
|
+
return new Stream(tsplus_module_10.unwrapScoped(tsplus_module_1.map_(tsplus_module_1.flatMap_(tsplus_module_5.make(), left => tsplus_module_1.flatMap_(tsplus_module_5.make(), right => tsplus_module_1.flatMap_(tsplus_module_5.make(), latchL => tsplus_module_1.flatMap_(tsplus_module_5.make(), latchR => tsplus_module_1.flatMap_(tsplus_module_1.fork(tsplus_module_17.runScoped(tsplus_module_10.pipeTo_(tsplus_module_10.concatMap_(stream.channel, tsplus_module_10.writeChunk), combineProducer(left, latchL)))), () => tsplus_module_1.map_(tsplus_module_1.fork(tsplus_module_17.runScoped(tsplus_module_10.pipeTo_(tsplus_module_10.concatMap_(that.channel, tsplus_module_10.writeChunk), combineProducer(right, latchR)))), () => tuple(left, right, latchL, latchR)), fileName_1 + ":777:10"), fileName_1 + ":776:25"), fileName_1 + ":775:25"), fileName_1 + ":774:25"), fileName_1 + ":773:25"), ([left, right, latchL, latchR]) => {
|
587
|
+
const pullLeft = tsplus_module_1.flatMap_(tsplus_module_1.apSecond_(tsplus_module_5.offer(latchL, undefined), tsplus_module_5.take(left), fileName_1 + ":781:59"), tsplus_module_1.fromExitNow, fileName_1 + ":781:78");
|
588
|
+
const pullRight = tsplus_module_1.flatMap_(tsplus_module_1.apSecond_(tsplus_module_5.offer(latchR, undefined), tsplus_module_5.take(right), fileName_1 + ":782:59"), tsplus_module_1.fromExitNow, fileName_1 + ":782:79");
|
589
|
+
return unfoldIO_1(s, s => tsplus_module_1.flatMap_(f(s, pullLeft, pullRight), exit => tsplus_module_1.optional(tsplus_module_1.fromExitNow(exit, fileName_1 + ":783:100")), fileName_1 + ":783:75")).channel;
|
590
|
+
}, fileName_1 + ":780:13")));
|
585
591
|
}
|
586
592
|
|
587
593
|
function combineChunksProducer(handoff, latch) {
|
588
|
-
return tsplus_module_11.apSecond_(tsplus_module_10.fromIO(tsplus_module_5.take(latch)), tsplus_module_10.readWithCause(chunk => tsplus_module_11.apSecond_(tsplus_module_10.fromIO(tsplus_module_5.offer(handoff,
|
594
|
+
return tsplus_module_11.apSecond_(tsplus_module_10.fromIO(() => tsplus_module_5.take(latch)), tsplus_module_10.readWithCause(chunk => tsplus_module_11.apSecond_(tsplus_module_10.fromIO(() => tsplus_module_5.offer(handoff, tsplus_module_26.chunk(chunk))), combineChunksProducer(handoff, latch)), cause => tsplus_module_10.fromIO(() => tsplus_module_5.offer(handoff, tsplus_module_26.failCause(cause))), () => tsplus_module_11.apSecond_(tsplus_module_10.fromIO(() => tsplus_module_5.offer(handoff, tsplus_module_26.end)), combineChunksProducer(handoff, latch))));
|
589
595
|
}
|
590
596
|
/**
|
591
597
|
* Combines the chunks from this stream and the specified stream by repeatedly applying the
|
@@ -598,11 +604,11 @@ function combineChunksProducer(handoff, latch) {
|
|
598
604
|
|
599
605
|
|
600
606
|
export function combineChunks_(stream, that, s, f) {
|
601
|
-
return new Stream(tsplus_module_10.unwrapScoped(tsplus_module_1.map_(tsplus_module_1.flatMap_(tsplus_module_5.make(), left => tsplus_module_1.flatMap_(tsplus_module_5.make(), right => tsplus_module_1.flatMap_(tsplus_module_5.make(), latchL => tsplus_module_1.flatMap_(tsplus_module_5.make(), latchR => tsplus_module_1.flatMap_(tsplus_module_1.fork(
|
602
|
-
const pullLeft = tsplus_module_1.flatMap_(tsplus_module_1.apSecond_(tsplus_module_5.offer(latchL, undefined), tsplus_module_5.take(left), fileName_1 + ":
|
603
|
-
const pullRight = tsplus_module_1.flatMap_(tsplus_module_1.apSecond_(tsplus_module_5.offer(latchR, undefined), tsplus_module_5.take(right), fileName_1 + ":
|
604
|
-
return unfoldChunkIO_1(s, s => tsplus_module_1.flatMap_(f(s, pullLeft, pullRight), exit => tsplus_module_1.optional(tsplus_module_1.fromExit(() => exit, fileName_1 + ":
|
605
|
-
}, fileName_1 + ":
|
607
|
+
return new Stream(tsplus_module_10.unwrapScoped(tsplus_module_1.map_(tsplus_module_1.flatMap_(tsplus_module_5.make(), left => tsplus_module_1.flatMap_(tsplus_module_5.make(), right => tsplus_module_1.flatMap_(tsplus_module_5.make(), latchL => tsplus_module_1.flatMap_(tsplus_module_5.make(), latchR => tsplus_module_1.flatMap_(tsplus_module_1.fork(tsplus_module_17.runScoped(tsplus_module_10.pipeTo_(stream.channel, combineChunksProducer(left, latchL)))), () => tsplus_module_1.map_(tsplus_module_1.fork(tsplus_module_17.runScoped(tsplus_module_10.pipeTo_(that.channel, combineChunksProducer(right, latchR)))), () => tuple(left, right, latchL, latchR)), fileName_1 + ":828:10"), fileName_1 + ":827:25"), fileName_1 + ":826:25"), fileName_1 + ":825:25"), fileName_1 + ":824:25"), ([left, right, latchL, latchR]) => {
|
608
|
+
const pullLeft = tsplus_module_1.flatMap_(tsplus_module_1.apSecond_(tsplus_module_5.offer(latchL, undefined), tsplus_module_5.take(left), fileName_1 + ":834:20"), take => tsplus_module_26.done(take), fileName_1 + ":835:19");
|
609
|
+
const pullRight = tsplus_module_1.flatMap_(tsplus_module_1.apSecond_(tsplus_module_5.offer(latchR, undefined), tsplus_module_5.take(right), fileName_1 + ":838:20"), take => tsplus_module_26.done(take), fileName_1 + ":839:19");
|
610
|
+
return unfoldChunkIO_1(s, s => tsplus_module_1.flatMap_(f(s, pullLeft, pullRight), exit => tsplus_module_1.optional(tsplus_module_1.fromExit(() => exit, fileName_1 + ":840:102")), fileName_1 + ":840:80")).channel;
|
611
|
+
}, fileName_1 + ":831:13")));
|
606
612
|
}
|
607
613
|
/**
|
608
614
|
* Concatenates the specified stream with this stream, resulting in a stream
|
@@ -652,51 +658,51 @@ export function contramapEnvironment_(ra, f) {
|
|
652
658
|
*/
|
653
659
|
|
654
660
|
export function debounce_(stream, duration) {
|
655
|
-
return unwrap_1(
|
661
|
+
return unwrap_1(tsplus_module_24.transplant(grafter => tsplus_module_1.map_(tsplus_module_5.make(), handoff => {
|
656
662
|
function enqueue(last) {
|
657
|
-
return tsplus_module_1.map_(grafter(tsplus_module_1.fork(tsplus_module_1.as_(
|
663
|
+
return tsplus_module_1.map_(grafter(tsplus_module_1.fork(tsplus_module_1.as_(tsplus_module_41.sleep(duration, fileName_1 + ":912:37"), () => last))), f => consumer(tsplus_module_40.previous(f)), fileName_1 + ":912:66");
|
658
664
|
}
|
659
665
|
|
660
|
-
const producer = tsplus_module_10.readWithCause(inp =>
|
666
|
+
const producer = tsplus_module_10.readWithCause(inp => tsplus_module_20.match_(tsplus_module_12.last(inp), () => producer, last => tsplus_module_11.apSecond_(tsplus_module_10.fromIO(() => tsplus_module_5.offer(handoff, tsplus_module_5.emit(tsplus_module_19.single(last)))), producer)), cause => tsplus_module_10.fromIO(() => tsplus_module_5.offer(handoff, tsplus_module_5.halt(cause))), () => tsplus_module_10.fromIO(() => tsplus_module_5.offer(handoff, tsplus_module_5.end(new UpstreamEnd()))));
|
661
667
|
|
662
668
|
function consumer(state) {
|
663
|
-
return tsplus_module_10.unwrap(
|
669
|
+
return tsplus_module_10.unwrap(() => tsplus_module_40.match_(state, {
|
664
670
|
NotStarted: () => tsplus_module_1.map_(tsplus_module_5.take(handoff), signal => tsplus_module_5.matchSignal_(signal, {
|
665
671
|
Emit: ({
|
666
672
|
els
|
667
|
-
}) => tsplus_module_10.unwrap(enqueue(els)),
|
673
|
+
}) => tsplus_module_10.unwrap(() => enqueue(els)),
|
668
674
|
Halt: ({
|
669
675
|
error
|
670
676
|
}) => tsplus_module_11.failCauseNow(error),
|
671
677
|
End: () => tsplus_module_10.unit
|
672
|
-
}), fileName_1 + ":
|
678
|
+
}), fileName_1 + ":927:33"),
|
673
679
|
Current: ({
|
674
680
|
fiber
|
675
|
-
}) => tsplus_module_1.map_(
|
681
|
+
}) => tsplus_module_1.map_(tsplus_module_22.join(fiber), signal => tsplus_module_5.matchSignal_(signal, {
|
676
682
|
Emit: ({
|
677
683
|
els
|
678
|
-
}) => tsplus_module_10.unwrap(enqueue(els)),
|
684
|
+
}) => tsplus_module_10.unwrap(() => enqueue(els)),
|
679
685
|
Halt: ({
|
680
686
|
error
|
681
687
|
}) => tsplus_module_11.failCauseNow(error),
|
682
688
|
End: () => tsplus_module_10.unit
|
683
|
-
}), fileName_1 + ":
|
689
|
+
}), fileName_1 + ":935:31"),
|
684
690
|
Previous: ({
|
685
691
|
fiber
|
686
|
-
}) =>
|
692
|
+
}) => tsplus_module_24.raceWith_(tsplus_module_22.join(fiber), () => tsplus_module_5.take(handoff), (ex, current) => tsplus_module_34.match_(ex, cause => tsplus_module_1.as_(tsplus_module_23.interrupt(current), () => tsplus_module_11.failCauseNow(cause)), chunk => tsplus_module_1.succeedNow(tsplus_module_11.apSecond_(tsplus_module_10.writeNow(chunk), consumer(tsplus_module_40.current(current))), fileName_1 + ":949:38")), (ex, previous) => tsplus_module_34.match_(ex, cause => tsplus_module_1.as_(tsplus_module_23.interrupt(previous), () => tsplus_module_11.failCauseNow(cause)), signal => tsplus_module_5.matchSignal_(signal, {
|
687
693
|
Emit: ({
|
688
694
|
els
|
689
|
-
}) => tsplus_module_1.apSecond_(
|
695
|
+
}) => tsplus_module_1.apSecond_(tsplus_module_23.interrupt(previous), enqueue(els), fileName_1 + ":956:73"),
|
690
696
|
Halt: ({
|
691
697
|
error
|
692
|
-
}) => tsplus_module_1.as_(
|
693
|
-
End: () => tsplus_module_1.map_(
|
694
|
-
})), fileName_1 + ":
|
698
|
+
}) => tsplus_module_1.as_(tsplus_module_23.interrupt(previous), () => tsplus_module_11.failCauseNow(error)),
|
699
|
+
End: () => tsplus_module_1.map_(tsplus_module_22.join(previous), chunk => tsplus_module_11.apSecond_(tsplus_module_10.writeNow(chunk), tsplus_module_10.unit), fileName_1 + ":958:55")
|
700
|
+
})), fileName_1 + ":943:36")
|
695
701
|
}));
|
696
702
|
}
|
697
703
|
|
698
|
-
return apSecond_1(scoped_1(tsplus_module_1.fork(
|
699
|
-
}, fileName_1 + ":
|
704
|
+
return apSecond_1(scoped_1(tsplus_module_1.fork(tsplus_module_17.runScoped(tsplus_module_10.pipeTo_(stream.channel, producer)))), new Stream(consumer(tsplus_module_40.notStarted)));
|
705
|
+
}, fileName_1 + ":910:26"), fileName_1 + ":908:18"));
|
700
706
|
}
|
701
707
|
|
702
708
|
function defaultIfEmptyWriter(fb) {
|
@@ -721,10 +727,10 @@ export function defaultIfEmpty_(fa, fb) {
|
|
721
727
|
*/
|
722
728
|
|
723
729
|
export function distributedWith_(self, n, maximumLag, decide) {
|
724
|
-
return tsplus_module_1.flatMap_(
|
725
|
-
const [mappings, queues] = tsplus_module_12.foldRight_(entries, [
|
726
|
-
return tsplus_module_1.as_(
|
727
|
-
}, fileName_1 + ":
|
730
|
+
return tsplus_module_1.flatMap_(tsplus_module_36.make(), p => tsplus_module_1.flatMap_(distributedWithDynamic_1(self, maximumLag, a => tsplus_module_1.flatMap_(tsplus_module_35.wait(p), f => f(a), fileName_1 + ":1014:31"), () => tsplus_module_1.unit), next => tsplus_module_1.flatMap_(tsplus_module_1.sequenceIterable(tsplus_module_12.map_(tsplus_module_19.range(0, n), id => tsplus_module_1.map_(next, ([key, queue]) => [[key, id], queue], fileName_1 + ":1019:48"))), entries => {
|
731
|
+
const [mappings, queues] = tsplus_module_12.foldRight_(entries, [tsplus_module_42.makeDefault(), tsplus_module_7.empty()], ([mapping, queue], [mappings, queues]) => [tsplus_module_42.set_(mappings, mapping[0], mapping[1]), tsplus_module_12.append_(queues, queue)]);
|
732
|
+
return tsplus_module_1.as_(tsplus_module_35.succeed_(p, a => tsplus_module_1.map_(decide(a), f => key => f(tsplus_module_37.toUndefined(tsplus_module_42.get_(mappings, key))), fileName_1 + ":1025:48")), () => queues);
|
733
|
+
}, fileName_1 + ":1020:18"), fileName_1 + ":1017:15"), fileName_1 + ":1010:77");
|
728
734
|
}
|
729
735
|
/**
|
730
736
|
* More powerful version of `ZStream#distributedWith`. This returns a function that will produce
|
@@ -738,22 +744,22 @@ export function distributedWith_(self, n, maximumLag, decide) {
|
|
738
744
|
*/
|
739
745
|
|
740
746
|
function distributedWithDynamic_1(self, maximumLag, decide, done = () => tsplus_module_1.unit) {
|
741
|
-
const offer = queuesRef => a => tsplus_module_1.flatMap_(decide(a), shouldProcess => tsplus_module_1.flatMap_(
|
747
|
+
const offer = queuesRef => a => tsplus_module_1.flatMap_(decide(a), shouldProcess => tsplus_module_1.flatMap_(tsplus_module_14.get(queuesRef), queues => tsplus_module_1.flatMap_(tsplus_module_1.foldLeft_(queues, tsplus_module_7.empty(), (b, [id, queue]) => {
|
742
748
|
if (shouldProcess(id)) {
|
743
|
-
return tsplus_module_1.matchCauseIO_(
|
749
|
+
return tsplus_module_1.matchCauseIO_(tsplus_module_27.offer_(queue, tsplus_module_39.succeed(a)), c => tsplus_module_25.interrupted(c) ? tsplus_module_1.succeedNow(tsplus_module_12.append_(b, id), fileName_1 + ":1055:52") : tsplus_module_1.failCauseNow(c, fileName_1 + ":1055:84"), () => tsplus_module_1.succeedNow(b, fileName_1 + ":1056:34"), fileName_1 + ":1054:61");
|
744
750
|
} else {
|
745
|
-
return tsplus_module_1.succeedNow(b, fileName_1 + ":
|
751
|
+
return tsplus_module_1.succeedNow(b, fileName_1 + ":1059:33");
|
746
752
|
}
|
747
|
-
}, fileName_1 + ":
|
753
|
+
}, fileName_1 + ":1052:20"), ids => tsplus_module_12.isNonEmpty(ids) ? tsplus_module_15.update_(queuesRef, map => tsplus_module_42.removeMany_(map, ids)) : tsplus_module_1.unit, fileName_1 + ":1061:19"), fileName_1 + ":1050:30"), fileName_1 + ":1049:30");
|
748
754
|
|
749
|
-
return tsplus_module_1.flatMap_(
|
750
|
-
const finalize = endTake =>
|
755
|
+
return tsplus_module_1.flatMap_(tsplus_module_30.acquireRelease(() => tsplus_module_6.make(() => tsplus_module_42.makeDefault()), ref => tsplus_module_1.flatMap_(tsplus_module_14.get(ref), qs => tsplus_module_1.foreach_(tsplus_module_42.values(qs), q => tsplus_module_27.shutdown(q), fileName_1 + ":1068:43"), fileName_1 + ":1068:24")), queuesRef => tsplus_module_1.map_(tsplus_module_1.flatMap_(tsplus_module_44.atomically(tsplus_module_45.make(1)), queuesLock => tsplus_module_1.flatMap_(tsplus_module_6.make(() => tsplus_module_1.flatMap_(tsplus_module_29.makeBounded(maximumLag), queue => tsplus_module_1.flatMap_(tsplus_module_1.succeed(() => Symbol(), fileName_1 + ":1079:41"), id => tsplus_module_1.map_(tsplus_module_15.update_(queuesRef, map => tsplus_module_42.set_(map, id, queue)), () => tuple(id, queue)), fileName_1 + ":1079:30"), fileName_1 + ":1078:30")), newQueue => {
|
756
|
+
const finalize = endTake => tsplus_module_43.withPermitSelf(queuesLock)(tsplus_module_1.asUnit(tsplus_module_1.flatMap_(tsplus_module_13.set_(newQueue, tsplus_module_1.flatMap_(tsplus_module_29.makeBounded(1), queue => tsplus_module_1.flatMap_(tsplus_module_27.offer_(queue, endTake), () => {
|
751
757
|
const id = Symbol();
|
752
|
-
return tsplus_module_1.map_(
|
753
|
-
}, fileName_1 + ":
|
758
|
+
return tsplus_module_1.map_(tsplus_module_15.update_(queuesRef, map => tsplus_module_42.set_(map, id, queue)), () => tuple(id, queue));
|
759
|
+
}, fileName_1 + ":1091:20"), fileName_1 + ":1090:34")), () => tsplus_module_1.flatMap_(tsplus_module_1.map_(tsplus_module_14.get(queuesRef), map => tsplus_module_42.values(map), fileName_1 + ":1099:53"), queues => tsplus_module_1.flatMap_(tsplus_module_1.foreach_(queues, queue => tsplus_module_1.catchJustCause_(tsplus_module_27.offer_(queue, endTake), c => tsplus_module_25.interrupted(c) ? tsplus_module_3.just(tsplus_module_1.unit) : tsplus_module_3.nothing()), fileName_1 + ":1101:31"), () => tsplus_module_1.map_(done(endTake), () => void 0), fileName_1 + ":1100:20"), fileName_1 + ":1099:35"), fileName_1 + ":1097:23")));
|
754
760
|
|
755
|
-
return tsplus_module_1.map_(tsplus_module_1.fork(tsplus_module_1.matchCauseIO_(runForeachScoped_1(self, offer(queuesRef)), cause => finalize(
|
756
|
-
}, fileName_1 + ":
|
761
|
+
return tsplus_module_1.map_(tsplus_module_1.fork(tsplus_module_1.matchCauseIO_(runForeachScoped_1(self, offer(queuesRef)), cause => finalize(tsplus_module_39.failCause(tsplus_module_25.map_(cause, tsplus_module_3.just))), () => finalize(tsplus_module_39.fail(tsplus_module_3.nothing())), fileName_1 + ":1113:63")), () => tsplus_module_43.withPermitSelf(queuesLock)(tsplus_module_1.flatten(tsplus_module_14.get(newQueue))));
|
762
|
+
}, fileName_1 + ":1075:29"), fileName_1 + ":1074:29"), add => add, fileName_1 + ":1072:18"), fileName_1 + ":1066:24");
|
757
763
|
}
|
758
764
|
/**
|
759
765
|
* Converts this stream to a stream that executes its effects but emits no
|
@@ -794,7 +800,7 @@ function drop_1(stream, n) {
|
|
794
800
|
|
795
801
|
|
796
802
|
function dropWhile_1(stream, p) {
|
797
|
-
return pipeThrough_1(stream,
|
803
|
+
return pipeThrough_1(stream, tsplus_module_46.dropWhile(p));
|
798
804
|
}
|
799
805
|
/**
|
800
806
|
* Drops all elements of the stream until the specified predicate evaluates
|
@@ -805,7 +811,7 @@ function dropWhile_1(stream, p) {
|
|
805
811
|
|
806
812
|
|
807
813
|
export function dropUntil_(stream, p) {
|
808
|
-
return drop_1(dropWhile_1(stream,
|
814
|
+
return drop_1(dropWhile_1(stream, tsplus_module_47.invert(p)), 1);
|
809
815
|
}
|
810
816
|
/**
|
811
817
|
* Returns a stream whose failures and successes have been lifted into an
|
@@ -818,7 +824,7 @@ export function dropUntil_(stream, p) {
|
|
818
824
|
*/
|
819
825
|
|
820
826
|
export function either(stream) {
|
821
|
-
return catchAll_1(map_1(stream,
|
827
|
+
return catchAll_1(map_1(stream, tsplus_module_18.right), e => succeedNow_1(tsplus_module_18.left(e)));
|
822
828
|
}
|
823
829
|
/**
|
824
830
|
* @tsplus static fncts.io.StreamOps empty
|
@@ -828,7 +834,7 @@ const empty_1 = /*#__PURE__*/fromChunkNow_1( /*#__PURE__*/tsplus_module_7.empty(
|
|
828
834
|
export const empty = empty_1;
|
829
835
|
|
830
836
|
function endWhenWriter(fiber) {
|
831
|
-
return tsplus_module_10.unwrap(tsplus_module_1.map_(
|
837
|
+
return tsplus_module_10.unwrap(() => tsplus_module_1.map_(tsplus_module_48.poll(fiber), maybeExit => tsplus_module_20.match_(maybeExit, () => tsplus_module_10.readWith(inp => tsplus_module_11.apSecond_(tsplus_module_10.writeNow(inp), endWhenWriter(fiber)), tsplus_module_10.failNow, () => tsplus_module_10.unit), exit => tsplus_module_34.match_(exit, tsplus_module_11.failCauseNow, () => tsplus_module_10.unit)), fileName_1 + ":1201:19"));
|
832
838
|
}
|
833
839
|
/**
|
834
840
|
* Halts the evaluation of this stream when the provided IO completes. The given IO
|
@@ -844,7 +850,7 @@ function endWhenWriter(fiber) {
|
|
844
850
|
|
845
851
|
|
846
852
|
export function endWhen_(stream, io) {
|
847
|
-
return new Stream(tsplus_module_10.unwrapScoped(tsplus_module_1.map_(
|
853
|
+
return new Stream(tsplus_module_10.unwrapScoped(tsplus_module_1.map_(tsplus_module_16.forkScoped(io), fiber => tsplus_module_10.pipeTo_(stream.channel, endWhenWriter(fiber)), fileName_1 + ":1227:59")));
|
848
854
|
}
|
849
855
|
/**
|
850
856
|
* @tsplus fluent fncts.io.Stream ensuring
|
@@ -859,7 +865,7 @@ function ensuring_1(self, finalizer) {
|
|
859
865
|
|
860
866
|
|
861
867
|
function environment_1() {
|
862
|
-
return fromIO_1(
|
868
|
+
return fromIO_1(tsplus_module_49.environment(fileName_1 + ":1241:38"));
|
863
869
|
}
|
864
870
|
/**
|
865
871
|
* Accesses the environment of the stream.
|
@@ -915,7 +921,7 @@ export function fail(error) {
|
|
915
921
|
*/
|
916
922
|
|
917
923
|
function failCauseNow_1(cause) {
|
918
|
-
return fromIO_1(tsplus_module_1.failCauseNow(cause, fileName_1 + ":
|
924
|
+
return fromIO_1(tsplus_module_1.failCauseNow(cause, fileName_1 + ":1295:39"));
|
919
925
|
}
|
920
926
|
/**
|
921
927
|
* The stream that always halts with `cause`.
|
@@ -925,7 +931,7 @@ function failCauseNow_1(cause) {
|
|
925
931
|
|
926
932
|
|
927
933
|
export function failCause(cause) {
|
928
|
-
return fromIO_1(tsplus_module_1.failCause(cause, fileName_1 + ":
|
934
|
+
return fromIO_1(tsplus_module_1.failCause(cause, fileName_1 + ":1304:36"));
|
929
935
|
}
|
930
936
|
export function filter_(fa, predicate) {
|
931
937
|
return mapChunks_1(fa, chunk => tsplus_module_12.filter_(chunk, predicate));
|
@@ -935,12 +941,23 @@ export function filter_(fa, predicate) {
|
|
935
941
|
*/
|
936
942
|
|
937
943
|
export function filterIO_(fa, f) {
|
938
|
-
return
|
944
|
+
return new Stream(tsplus_module_10.pipeTo_(fa.channel, filterIOLoop(tsplus_module_38.empty()[Symbol.iterator](), f)));
|
945
|
+
}
|
946
|
+
|
947
|
+
function filterIOLoop(iterator, f) {
|
948
|
+
const next = iterator.next();
|
949
|
+
|
950
|
+
if (next.done) {
|
951
|
+
return tsplus_module_10.readWithCause(elem => filterIOLoop(elem[Symbol.iterator](), f), tsplus_module_11.failCauseNow, tsplus_module_11.succeedNow);
|
952
|
+
} else {
|
953
|
+
return tsplus_module_10.unwrap(() => tsplus_module_1.map_(f(next.value), b => b ? tsplus_module_11.apSecond_(tsplus_module_10.writeNow(tsplus_module_19.single(next.value)), filterIOLoop(iterator, f)) : filterIOLoop(iterator, f), fileName_1 + ":1339:24"));
|
954
|
+
}
|
939
955
|
}
|
940
956
|
/**
|
941
957
|
* @tsplus fluent fncts.io.Stream filterMap
|
942
958
|
*/
|
943
959
|
|
960
|
+
|
944
961
|
function filterMap_1(fa, f) {
|
945
962
|
return mapChunks_1(fa, chunk => tsplus_module_12.filterMap_(chunk, f));
|
946
963
|
}
|
@@ -950,7 +967,17 @@ function filterMap_1(fa, f) {
|
|
950
967
|
|
951
968
|
|
952
969
|
export function filterMapIO_(fa, f) {
|
953
|
-
return
|
970
|
+
return new Stream(tsplus_module_10.pipeTo_(fa.channel, filterMapIOLoop(tsplus_module_38.empty()[Symbol.iterator](), f)));
|
971
|
+
}
|
972
|
+
|
973
|
+
function filterMapIOLoop(iterator, f) {
|
974
|
+
const next = iterator.next();
|
975
|
+
|
976
|
+
if (next.done) {
|
977
|
+
return tsplus_module_10.readWithCause(elem => filterMapIOLoop(elem[Symbol.iterator](), f), tsplus_module_11.failCauseNow, tsplus_module_11.succeedNow);
|
978
|
+
} else {
|
979
|
+
return tsplus_module_10.unwrap(() => tsplus_module_1.map_(f(next.value), b => tsplus_module_20.match_(b, () => filterMapIOLoop(iterator, f), b => tsplus_module_11.apSecond_(tsplus_module_10.writeNow(tsplus_module_19.single(b)), filterMapIOLoop(iterator, f))), fileName_1 + ":1378:24"));
|
980
|
+
}
|
954
981
|
}
|
955
982
|
/**
|
956
983
|
* Finds the first element emitted by this stream that satisfies the provided predicate.
|
@@ -958,8 +985,9 @@ export function filterMapIO_(fa, f) {
|
|
958
985
|
* @tsplus fluent fncts.io.Stream find
|
959
986
|
*/
|
960
987
|
|
988
|
+
|
961
989
|
export function find_(stream, p) {
|
962
|
-
const loop = tsplus_module_10.readWith(inp =>
|
990
|
+
const loop = tsplus_module_10.readWith(inp => tsplus_module_20.match_(tsplus_module_12.find_(inp, p), () => loop, a => tsplus_module_10.writeNow(tsplus_module_19.single(a))), tsplus_module_10.failNow, () => tsplus_module_10.unit);
|
963
991
|
return new Stream(tsplus_module_10.pipeTo_(stream.channel, loop));
|
964
992
|
}
|
965
993
|
/**
|
@@ -969,7 +997,7 @@ export function find_(stream, p) {
|
|
969
997
|
*/
|
970
998
|
|
971
999
|
export function findIO_(stream, f) {
|
972
|
-
const loop = tsplus_module_10.readWith(inp => tsplus_module_10.unwrap(tsplus_module_1.map_(
|
1000
|
+
const loop = tsplus_module_10.readWith(inp => tsplus_module_10.unwrap(() => tsplus_module_1.map_(tsplus_module_50.findIO_(inp, f), maybeA => tsplus_module_20.match_(maybeA, () => loop, a => tsplus_module_10.writeNow(tsplus_module_19.single(a))), fileName_1 + ":1418:26")), tsplus_module_10.failNow, () => tsplus_module_10.unit);
|
973
1001
|
return new Stream(tsplus_module_10.pipeTo_(stream.channel, loop));
|
974
1002
|
}
|
975
1003
|
/**
|
@@ -993,9 +1021,9 @@ function flatten_1(self) {
|
|
993
1021
|
|
994
1022
|
function flattenExitOption_1(stream) {
|
995
1023
|
const processChunk = (chunk, cont) => {
|
996
|
-
const [toEmit, rest] = tsplus_module_12.splitWhere_(chunk, _ => !
|
997
|
-
const next =
|
998
|
-
return tsplus_module_11.apSecond_(tsplus_module_10.writeNow(tsplus_module_12.filterMap_(toEmit, exit =>
|
1024
|
+
const [toEmit, rest] = tsplus_module_12.splitWhere_(chunk, _ => !tsplus_module_51.isSuccess(_));
|
1025
|
+
const next = tsplus_module_20.match_(tsplus_module_12.head(rest), () => cont, exit => tsplus_module_34.match_(exit, cause => tsplus_module_20.match_(tsplus_module_25.flipCauseOption(cause), () => tsplus_module_11.endNow(undefined), tsplus_module_11.failCauseNow), () => tsplus_module_11.endNow(undefined)));
|
1026
|
+
return tsplus_module_11.apSecond_(tsplus_module_10.writeNow(tsplus_module_12.filterMap_(toEmit, exit => tsplus_module_34.match_(exit, () => tsplus_module_3.nothing(), tsplus_module_3.just))), next);
|
999
1027
|
};
|
1000
1028
|
|
1001
1029
|
const process = tsplus_module_10.readWithCause(chunk => processChunk(chunk, process), tsplus_module_11.failCauseNow, _ => tsplus_module_11.endNow(undefined));
|
@@ -1050,7 +1078,7 @@ function fromChunkNow_1(c) {
|
|
1050
1078
|
|
1051
1079
|
|
1052
1080
|
function fromChunk_1(c) {
|
1053
|
-
return new Stream(tsplus_module_10.unwrap(tsplus_module_1.succeedNow(tsplus_module_10.write(c), fileName_1 + ":
|
1081
|
+
return new Stream(tsplus_module_10.unwrap(() => tsplus_module_1.succeedNow(tsplus_module_10.write(c), fileName_1 + ":1518:49")));
|
1054
1082
|
}
|
1055
1083
|
/**
|
1056
1084
|
* Creates a single-valued stream from a managed resource
|
@@ -1060,7 +1088,7 @@ function fromChunk_1(c) {
|
|
1060
1088
|
|
1061
1089
|
|
1062
1090
|
function scoped_1(stream) {
|
1063
|
-
return new Stream(tsplus_module_10.scoped(() => tsplus_module_1.map_(stream,
|
1091
|
+
return new Stream(tsplus_module_10.scoped(() => tsplus_module_1.map_(stream, tsplus_module_19.single, fileName_1 + ":1527:46")));
|
1064
1092
|
}
|
1065
1093
|
/**
|
1066
1094
|
* Creates a stream from an effect producing a value of type `A`
|
@@ -1070,7 +1098,7 @@ function scoped_1(stream) {
|
|
1070
1098
|
|
1071
1099
|
|
1072
1100
|
function fromIO_1(fa) {
|
1073
|
-
return fromIOMaybe_1(tsplus_module_1.mapError_(fa, tsplus_module_3.just, fileName_1 + ":
|
1101
|
+
return fromIOMaybe_1(tsplus_module_1.mapError_(fa, tsplus_module_3.just, fileName_1 + ":1536:40"));
|
1074
1102
|
}
|
1075
1103
|
/**
|
1076
1104
|
* Creates a stream from an effect producing a value of type `A` or an empty Stream
|
@@ -1080,12 +1108,12 @@ function fromIO_1(fa) {
|
|
1080
1108
|
|
1081
1109
|
|
1082
1110
|
function fromIOMaybe_1(fa) {
|
1083
|
-
return new Stream(tsplus_module_10.unwrap(tsplus_module_1.match_(fa, maybeError =>
|
1111
|
+
return new Stream(tsplus_module_10.unwrap(() => tsplus_module_1.match_(fa, maybeError => tsplus_module_20.match_(maybeError, () => tsplus_module_10.unit, tsplus_module_10.failNow), a => tsplus_module_10.writeNow(tsplus_module_19.single(a)), fileName_1 + ":1547:15")));
|
1084
1112
|
}
|
1085
1113
|
|
1086
1114
|
function fromAsyncIterableLoop(iterator) {
|
1087
|
-
return tsplus_module_10.unwrap(tsplus_module_1.async(k => {
|
1088
|
-
iterator.next().then(result => result.done ? k(tsplus_module_1.succeedNow(tsplus_module_11.end(() => undefined), fileName_1 + ":
|
1115
|
+
return tsplus_module_10.unwrap(() => tsplus_module_1.async(k => {
|
1116
|
+
iterator.next().then(result => result.done ? k(tsplus_module_1.succeedNow(tsplus_module_11.end(() => undefined), fileName_1 + ":1564:30")) : k(tsplus_module_1.succeedNow(tsplus_module_11.apSecond_(tsplus_module_10.writeNow(tsplus_module_19.single(result.value)), fromAsyncIterableLoop(iterator)), fileName_1 + ":1565:30")));
|
1089
1117
|
}));
|
1090
1118
|
}
|
1091
1119
|
/**
|
@@ -1102,7 +1130,7 @@ export function fromAsyncIterable(iterable) {
|
|
1102
1130
|
|
1103
1131
|
export function fromIterable(iterable, maxChunkSize = DEFAULT_CHUNK_SIZE) {
|
1104
1132
|
return unwrap_1(tsplus_module_1.succeed(() => {
|
1105
|
-
const loop = iterator => tsplus_module_10.unwrap(tsplus_module_1.succeed(() => {
|
1133
|
+
const loop = iterator => tsplus_module_10.unwrap(() => tsplus_module_1.succeed(() => {
|
1106
1134
|
let result = iterator.next();
|
1107
1135
|
|
1108
1136
|
if (result.done) {
|
@@ -1110,7 +1138,7 @@ export function fromIterable(iterable, maxChunkSize = DEFAULT_CHUNK_SIZE) {
|
|
1110
1138
|
}
|
1111
1139
|
|
1112
1140
|
if (maxChunkSize === 1) {
|
1113
|
-
return tsplus_module_11.apSecond_(tsplus_module_10.writeNow(
|
1141
|
+
return tsplus_module_11.apSecond_(tsplus_module_10.writeNow(tsplus_module_19.single(result.value)), loop(iterator));
|
1114
1142
|
} else {
|
1115
1143
|
const out = Array(maxChunkSize);
|
1116
1144
|
out[0] = result.value;
|
@@ -1121,34 +1149,34 @@ export function fromIterable(iterable, maxChunkSize = DEFAULT_CHUNK_SIZE) {
|
|
1121
1149
|
count++;
|
1122
1150
|
}
|
1123
1151
|
|
1124
|
-
return tsplus_module_11.apSecond_(tsplus_module_10.writeNow(
|
1152
|
+
return tsplus_module_11.apSecond_(tsplus_module_10.writeNow(tsplus_module_19.from(out)), loop(iterator));
|
1125
1153
|
}
|
1126
|
-
}, fileName_1 + ":
|
1154
|
+
}, fileName_1 + ":1586:21"));
|
1127
1155
|
|
1128
1156
|
return new Stream(loop(iterable[Symbol.iterator]()));
|
1129
|
-
}, fileName_1 + ":
|
1157
|
+
}, fileName_1 + ":1583:15"));
|
1130
1158
|
}
|
1131
1159
|
/**
|
1132
1160
|
* @tsplus static fncts.io.StreamOps fromIterableSingle
|
1133
1161
|
*/
|
1134
1162
|
|
1135
1163
|
export function fromIterableSingle(iterable) {
|
1136
|
-
return flatMap_1(fromIO_1(tsplus_module_1.succeed(() => iterable[Symbol.iterator](), fileName_1 + ":
|
1164
|
+
return flatMap_1(fromIO_1(tsplus_module_1.succeed(() => iterable[Symbol.iterator](), fileName_1 + ":1614:34")), iterator => repeatIOMaybe_1(tsplus_module_1.defer(() => {
|
1137
1165
|
const value = iterator.next();
|
1138
1166
|
|
1139
1167
|
if (value.done) {
|
1140
|
-
return tsplus_module_1.failNow(tsplus_module_3.nothing(), fileName_1 + ":
|
1168
|
+
return tsplus_module_1.failNow(tsplus_module_3.nothing(), fileName_1 + ":1619:28");
|
1141
1169
|
} else {
|
1142
|
-
return tsplus_module_1.succeedNow(value.value, fileName_1 + ":
|
1170
|
+
return tsplus_module_1.succeedNow(value.value, fileName_1 + ":1621:31");
|
1143
1171
|
}
|
1144
|
-
}, fileName_1 + ":
|
1172
|
+
}, fileName_1 + ":1616:15")));
|
1145
1173
|
}
|
1146
1174
|
/**
|
1147
1175
|
* @tsplus static fncts.io.StreamOps fromPull
|
1148
1176
|
*/
|
1149
1177
|
|
1150
1178
|
function fromPull_1(scopedPull) {
|
1151
|
-
return unwrapScoped_1(tsplus_module_1.map_(scopedPull, pull => repeatIOChunkMaybe_1(pull), fileName_1 + ":
|
1179
|
+
return unwrapScoped_1(tsplus_module_1.map_(scopedPull, pull => repeatIOChunkMaybe_1(pull), fileName_1 + ":1632:44"));
|
1152
1180
|
}
|
1153
1181
|
/**
|
1154
1182
|
* Creates a stream from a `Queue` of values
|
@@ -1158,13 +1186,13 @@ function fromPull_1(scopedPull) {
|
|
1158
1186
|
|
1159
1187
|
|
1160
1188
|
function fromQueue_1(queue, maxChunkSize = DEFAULT_CHUNK_SIZE) {
|
1161
|
-
return repeatIOChunkMaybe_1(tsplus_module_1.catchAllCause_(tsplus_module_1.map_(
|
1162
|
-
if (down &&
|
1163
|
-
return
|
1189
|
+
return repeatIOChunkMaybe_1(tsplus_module_1.catchAllCause_(tsplus_module_1.map_(tsplus_module_53.takeBetween_(queue, 1, maxChunkSize), tsplus_module_19.from, fileName_1 + ":1647:11"), c => tsplus_module_1.flatMap_(tsplus_module_27.isShutdown(queue), down => {
|
1190
|
+
if (down && tsplus_module_25.interrupted(c)) {
|
1191
|
+
return tsplus_module_52.end;
|
1164
1192
|
} else {
|
1165
|
-
return
|
1193
|
+
return tsplus_module_52.failCause(c);
|
1166
1194
|
}
|
1167
|
-
}, fileName_1 + ":
|
1195
|
+
}, fileName_1 + ":1649:33"), fileName_1 + ":1648:21"));
|
1168
1196
|
}
|
1169
1197
|
/**
|
1170
1198
|
* @tsplus static fncts.io.StreamOps fromQueueWithShutdown
|
@@ -1172,7 +1200,7 @@ function fromQueue_1(queue, maxChunkSize = DEFAULT_CHUNK_SIZE) {
|
|
1172
1200
|
|
1173
1201
|
|
1174
1202
|
function fromQueueWithShutdown_1(queue, maxChunkSize = DEFAULT_CHUNK_SIZE) {
|
1175
|
-
return ensuring_1(fromQueue_1(queue, maxChunkSize),
|
1203
|
+
return ensuring_1(fromQueue_1(queue, maxChunkSize), tsplus_module_27.shutdown(queue));
|
1176
1204
|
}
|
1177
1205
|
/**
|
1178
1206
|
* Halt a stream with the specified exception
|
@@ -1195,7 +1223,7 @@ function halt_1(u) {
|
|
1195
1223
|
}
|
1196
1224
|
|
1197
1225
|
function haltWhenWriter(fiber) {
|
1198
|
-
return tsplus_module_10.unwrap(tsplus_module_1.map_(
|
1226
|
+
return tsplus_module_10.unwrap(() => tsplus_module_1.map_(tsplus_module_48.poll(fiber), maybeExit => tsplus_module_20.match_(maybeExit, () => tsplus_module_10.readWith(i => tsplus_module_11.apSecond_(tsplus_module_10.writeNow(i), haltWhenWriter(fiber)), tsplus_module_10.failNow, () => tsplus_module_10.unit), exit => tsplus_module_34.match_(exit, tsplus_module_11.failCauseNow, () => tsplus_module_10.unit)), fileName_1 + ":1692:19"));
|
1199
1227
|
}
|
1200
1228
|
/**
|
1201
1229
|
* Halts the evaluation of this stream when the provided IO completes. The
|
@@ -1212,11 +1240,11 @@ function haltWhenWriter(fiber) {
|
|
1212
1240
|
|
1213
1241
|
|
1214
1242
|
export function haltWhen_(fa, io) {
|
1215
|
-
return new Stream(tsplus_module_10.unwrapScoped(tsplus_module_1.map_(
|
1243
|
+
return new Stream(tsplus_module_10.unwrapScoped(tsplus_module_1.map_(tsplus_module_16.forkScoped(io), fiber => tsplus_module_10.pipeTo_(fa.channel, haltWhenWriter(fiber)), fileName_1 + ":1719:59")));
|
1216
1244
|
}
|
1217
1245
|
|
1218
1246
|
function haltWhenFutureWriter(future) {
|
1219
|
-
return tsplus_module_10.unwrap(tsplus_module_1.map_(
|
1247
|
+
return tsplus_module_10.unwrap(() => tsplus_module_1.map_(tsplus_module_35.poll(future), maybeIO => tsplus_module_20.match_(maybeIO, () => tsplus_module_10.readWith(i => tsplus_module_11.apSecond_(tsplus_module_10.writeNow(i), haltWhenFutureWriter(future)), tsplus_module_10.failNow, () => tsplus_module_10.unit), io => tsplus_module_10.unwrap(() => tsplus_module_1.match_(io, tsplus_module_10.failNow, () => tsplus_module_10.unit, fileName_1 + ":1734:40"))), fileName_1 + ":1726:20"));
|
1220
1248
|
}
|
1221
1249
|
/**
|
1222
1250
|
* Halts the evaluation of this stream when the provided promise resolves.
|
@@ -1235,11 +1263,11 @@ export function haltWhenFuture_(fa, future) {
|
|
1235
1263
|
*/
|
1236
1264
|
|
1237
1265
|
export function interleave_(sa, sb) {
|
1238
|
-
return interleaveWith_1(sa, sb, forever_1(fromChunk_1(() =>
|
1266
|
+
return interleaveWith_1(sa, sb, forever_1(fromChunk_1(() => tsplus_module_19.make(true, false))));
|
1239
1267
|
}
|
1240
1268
|
|
1241
1269
|
function interleaveWithProducer(handoff) {
|
1242
|
-
return tsplus_module_10.readWithCause(value => tsplus_module_11.apSecond_(tsplus_module_10.fromIO(tsplus_module_5.offer(handoff,
|
1270
|
+
return tsplus_module_10.readWithCause(value => tsplus_module_11.apSecond_(tsplus_module_10.fromIO(() => tsplus_module_5.offer(handoff, tsplus_module_26.single(value))), interleaveWithProducer(handoff)), cause => tsplus_module_10.fromIO(() => tsplus_module_5.offer(handoff, tsplus_module_26.failCause(cause))), () => tsplus_module_10.fromIO(() => tsplus_module_5.offer(handoff, tsplus_module_26.end)));
|
1243
1271
|
}
|
1244
1272
|
/**
|
1245
1273
|
* Combines this stream and the specified stream deterministically using the
|
@@ -1254,21 +1282,21 @@ function interleaveWithProducer(handoff) {
|
|
1254
1282
|
|
1255
1283
|
|
1256
1284
|
function interleaveWith_1(sa, sb, b) {
|
1257
|
-
return new Stream(tsplus_module_10.unwrapScoped(tsplus_module_1.map_(tsplus_module_1.flatMap_(tsplus_module_5.make(), left => tsplus_module_1.flatMap_(tsplus_module_5.make(), right => tsplus_module_1.flatMap_(tsplus_module_1.fork(
|
1285
|
+
return new Stream(tsplus_module_10.unwrapScoped(tsplus_module_1.map_(tsplus_module_1.flatMap_(tsplus_module_5.make(), left => tsplus_module_1.flatMap_(tsplus_module_5.make(), right => tsplus_module_1.flatMap_(tsplus_module_1.fork(tsplus_module_17.runScoped(tsplus_module_10.pipeTo_(tsplus_module_10.concatMap_(sa.channel, tsplus_module_10.writeChunk), interleaveWithProducer(left)))), () => tsplus_module_1.map_(tsplus_module_1.fork(tsplus_module_17.runScoped(tsplus_module_10.pipeTo_(tsplus_module_10.concatMap_(sb.channel, tsplus_module_10.writeChunk), interleaveWithProducer(right)))), () => tuple(left, right)), fileName_1 + ":1789:10"), fileName_1 + ":1788:24"), fileName_1 + ":1787:24"), ([left, right]) => {
|
1258
1286
|
const process = (leftDone, rightDone) => tsplus_module_10.readWithCause(b => {
|
1259
1287
|
if (b && !leftDone) {
|
1260
|
-
return tsplus_module_11.flatMap_(tsplus_module_10.fromIO(tsplus_module_5.take(left)), take =>
|
1288
|
+
return tsplus_module_11.flatMap_(tsplus_module_10.fromIO(() => tsplus_module_5.take(left)), take => tsplus_module_26.match_(take, rightDone ? tsplus_module_10.unit : process(true, rightDone), tsplus_module_11.failCauseNow, chunk => tsplus_module_11.apSecond_(tsplus_module_10.writeNow(chunk), process(leftDone, rightDone))));
|
1261
1289
|
}
|
1262
1290
|
|
1263
1291
|
if (!b && !rightDone) {
|
1264
|
-
return tsplus_module_11.flatMap_(tsplus_module_10.fromIO(tsplus_module_5.take(right)), take =>
|
1292
|
+
return tsplus_module_11.flatMap_(tsplus_module_10.fromIO(() => tsplus_module_5.take(right)), take => tsplus_module_26.match_(take, leftDone ? tsplus_module_10.unit : process(leftDone, true), tsplus_module_11.failCauseNow, chunk => tsplus_module_11.apSecond_(tsplus_module_10.writeNow(chunk), process(leftDone, rightDone))));
|
1265
1293
|
}
|
1266
1294
|
|
1267
1295
|
return process(leftDone, rightDone);
|
1268
1296
|
}, tsplus_module_11.failCauseNow, () => tsplus_module_10.unit);
|
1269
1297
|
|
1270
1298
|
return tsplus_module_10.pipeTo_(tsplus_module_10.concatMap_(b.channel, tsplus_module_10.writeChunk), process(false, false));
|
1271
|
-
}, fileName_1 + ":
|
1299
|
+
}, fileName_1 + ":1792:13")));
|
1272
1300
|
}
|
1273
1301
|
|
1274
1302
|
function intersperseWriter(middle, isFirst) {
|
@@ -1307,55 +1335,14 @@ export function intersperse_(stream, middle) {
|
|
1307
1335
|
*/
|
1308
1336
|
|
1309
1337
|
export function interruptWhen_(stream, io) {
|
1310
|
-
return new Stream(
|
1338
|
+
return new Stream(tsplus_module_54.interruptWhen_(stream.channel, io));
|
1311
1339
|
}
|
1312
1340
|
/**
|
1313
1341
|
* @tsplus fluent fncts.io.Stream interruptWhen
|
1314
1342
|
*/
|
1315
1343
|
|
1316
1344
|
export function interruptWhenFuture_(fa, future) {
|
1317
|
-
return new Stream(
|
1318
|
-
}
|
1319
|
-
/**
|
1320
|
-
* Loops over the stream chunks concatenating the result of f
|
1321
|
-
*
|
1322
|
-
* @tsplus fluent fncts.io.Stream loopOnChunks
|
1323
|
-
*/
|
1324
|
-
|
1325
|
-
function loopOnChunks_1(stream, f) {
|
1326
|
-
const loop = tsplus_module_10.readWithCause(chunk => tsplus_module_11.flatMap_(f(chunk), cont => cont ? loop : tsplus_module_11.endNow(false)), tsplus_module_11.failCauseNow, _ => tsplus_module_11.succeedNow(false));
|
1327
|
-
return new Stream(tsplus_module_10.pipeTo_(stream.channel, loop));
|
1328
|
-
}
|
1329
|
-
/**
|
1330
|
-
* Loops on chunks emitting partially
|
1331
|
-
*
|
1332
|
-
* @tsplus fluent fncts.io.Stream loopOnPartialChunks
|
1333
|
-
*/
|
1334
|
-
|
1335
|
-
|
1336
|
-
function loopOnPartialChunks_1(stream, f) {
|
1337
|
-
return loopOnChunks_1(stream, chunk => tsplus_module_10.unwrap(tsplus_module_1.defer(() => {
|
1338
|
-
let outputChunk = tsplus_module_7.empty();
|
1339
|
-
return tsplus_module_1.catchAll_(tsplus_module_1.map_(f(chunk, a => tsplus_module_1.succeed(() => {
|
1340
|
-
outputChunk = tsplus_module_12.append_(outputChunk, a);
|
1341
|
-
}, fileName_1 + ":1822:21")), cont => tsplus_module_11.apSecond_(tsplus_module_10.write(() => outputChunk), tsplus_module_11.endNow(cont)), fileName_1 + ":1826:15"), failure => tsplus_module_1.succeed(() => {
|
1342
|
-
if (tsplus_module_12.isEmpty(outputChunk)) {
|
1343
|
-
return tsplus_module_10.failNow(failure);
|
1344
|
-
} else {
|
1345
|
-
return tsplus_module_11.apSecond_(tsplus_module_10.writeNow(outputChunk), tsplus_module_10.failNow(failure));
|
1346
|
-
}
|
1347
|
-
}, fileName_1 + ":1828:23"), fileName_1 + ":1827:20");
|
1348
|
-
}, fileName_1 + ":1819:15")));
|
1349
|
-
}
|
1350
|
-
/**
|
1351
|
-
* Loops on chunks elements emitting partially
|
1352
|
-
*
|
1353
|
-
* @tsplus fluent fncts.io.Stream loopOnPartialChunksElements
|
1354
|
-
*/
|
1355
|
-
|
1356
|
-
|
1357
|
-
function loopOnPartialChunksElements_1(stream, f) {
|
1358
|
-
return loopOnPartialChunks_1(stream, (as, emit) => tsplus_module_1.as_(tsplus_module_54.mapIO_(as, a => f(a, emit)), () => true));
|
1345
|
+
return new Stream(tsplus_module_54.interruptWhenFuture_(fa.channel, future));
|
1359
1346
|
}
|
1360
1347
|
/**
|
1361
1348
|
* Transforms the elements of this stream using the supplied function.
|
@@ -1363,14 +1350,13 @@ function loopOnPartialChunksElements_1(stream, f) {
|
|
1363
1350
|
* @tsplus fluent fncts.io.Stream map
|
1364
1351
|
*/
|
1365
1352
|
|
1366
|
-
|
1367
1353
|
function map_1(stream, f) {
|
1368
1354
|
return new Stream(tsplus_module_10.mapOut_(stream.channel, as => tsplus_module_12.map_(as, f)));
|
1369
1355
|
}
|
1370
1356
|
|
1371
1357
|
function mapAccumAccumulator(currS, f) {
|
1372
1358
|
return tsplus_module_10.readWith(inp => {
|
1373
|
-
const [
|
1359
|
+
const [nextS, bs] = tsplus_module_12.mapAccum_(inp, currS, f);
|
1374
1360
|
return tsplus_module_11.apSecond_(tsplus_module_10.writeNow(bs), mapAccumAccumulator(nextS, f));
|
1375
1361
|
}, tsplus_module_10.failNow, () => tsplus_module_10.unit);
|
1376
1362
|
}
|
@@ -1386,18 +1372,18 @@ export function mapAccum_(stream, s, f) {
|
|
1386
1372
|
}
|
1387
1373
|
|
1388
1374
|
function mapAccumIOAccumulator(s, f) {
|
1389
|
-
return tsplus_module_10.readWith(inp => tsplus_module_10.unwrap(tsplus_module_1.defer(() => {
|
1375
|
+
return tsplus_module_10.readWith(inp => tsplus_module_10.unwrap(() => tsplus_module_1.defer(() => {
|
1390
1376
|
const outputChunk = tsplus_module_12.builder();
|
1391
1377
|
|
1392
1378
|
const emit = b => tsplus_module_1.succeed(() => {
|
1393
1379
|
outputChunk.append(b);
|
1394
|
-
}, fileName_1 + ":
|
1380
|
+
}, fileName_1 + ":1928:23");
|
1395
1381
|
|
1396
|
-
return tsplus_module_1.match_(tsplus_module_1.foldLeft_(inp, s, (s1, a) => tsplus_module_1.flatMap_(f(s1, a), ([b, s2]) => tsplus_module_1.as_(emit(b), () => s2), fileName_1 + ":
|
1382
|
+
return tsplus_module_1.match_(tsplus_module_1.foldLeft_(inp, s, (s1, a) => tsplus_module_1.flatMap_(f(s1, a), ([b, s2]) => tsplus_module_1.as_(emit(b), () => s2), fileName_1 + ":1931:65"), fileName_1 + ":1931:29"), e => {
|
1397
1383
|
const partialResult = outputChunk.result();
|
1398
1384
|
return tsplus_module_12.isNonEmpty(partialResult) ? tsplus_module_11.apSecond_(tsplus_module_10.writeNow(partialResult), tsplus_module_10.failNow(e)) : tsplus_module_10.failNow(e);
|
1399
|
-
}, s => tsplus_module_11.apSecond_(tsplus_module_10.writeNow(outputChunk.result()), mapAccumIOAccumulator(s, f)), fileName_1 + ":
|
1400
|
-
}, fileName_1 + ":
|
1385
|
+
}, s => tsplus_module_11.apSecond_(tsplus_module_10.writeNow(outputChunk.result()), mapAccumIOAccumulator(s, f)), fileName_1 + ":1931:101");
|
1386
|
+
}, fileName_1 + ":1925:17")), tsplus_module_10.failNow, () => tsplus_module_10.unit);
|
1401
1387
|
}
|
1402
1388
|
/**
|
1403
1389
|
* Statefully and effectfully maps over the elements of this stream to produce
|
@@ -1438,7 +1424,7 @@ export function mapChunksIO_(stream, f) {
|
|
1438
1424
|
*/
|
1439
1425
|
|
1440
1426
|
export function mapConcat_(stream, f) {
|
1441
|
-
return mapConcatChunk_1(stream, a =>
|
1427
|
+
return mapConcatChunk_1(stream, a => tsplus_module_19.from(f(a)));
|
1442
1428
|
}
|
1443
1429
|
/**
|
1444
1430
|
* Maps each element to a chunk, and flattens the chunks into the output of
|
@@ -1469,7 +1455,7 @@ export function mapConcatChunkIO_(stream, f) {
|
|
1469
1455
|
*/
|
1470
1456
|
|
1471
1457
|
export function mapConcatIO_(stream, f) {
|
1472
|
-
return mapConcatChunk_1(mapIO_1(stream, a => tsplus_module_1.map_(f(a),
|
1458
|
+
return mapConcatChunk_1(mapIO_1(stream, a => tsplus_module_1.map_(f(a), tsplus_module_19.from, fileName_1 + ":2025:38")), identity);
|
1473
1459
|
}
|
1474
1460
|
/**
|
1475
1461
|
* Transforms the errors emitted by this stream using `f`.
|
@@ -1497,7 +1483,17 @@ export function mapErrorCause_(fa, f) {
|
|
1497
1483
|
*/
|
1498
1484
|
|
1499
1485
|
function mapIO_1(stream, f) {
|
1500
|
-
return
|
1486
|
+
return new Stream(tsplus_module_10.pipeTo_(stream.channel, mapIOLoop(tsplus_module_38.empty()[Symbol.iterator](), f)));
|
1487
|
+
}
|
1488
|
+
|
1489
|
+
function mapIOLoop(iterator, f) {
|
1490
|
+
const next = iterator.next();
|
1491
|
+
|
1492
|
+
if (next.done) {
|
1493
|
+
return tsplus_module_10.readWithCause(elem => mapIOLoop(elem[Symbol.iterator](), f), tsplus_module_11.failCauseNow, tsplus_module_11.succeedNow);
|
1494
|
+
} else {
|
1495
|
+
return tsplus_module_10.unwrap(() => tsplus_module_1.map_(f(next.value), b => tsplus_module_11.apSecond_(tsplus_module_10.writeNow(tsplus_module_19.single(b)), mapIOLoop(iterator, f)), fileName_1 + ":2071:24"));
|
1496
|
+
}
|
1501
1497
|
}
|
1502
1498
|
/**
|
1503
1499
|
* Maps over elements of the stream with the specified effectful function,
|
@@ -1511,7 +1507,7 @@ function mapIO_1(stream, f) {
|
|
1511
1507
|
|
1512
1508
|
|
1513
1509
|
export function mapIOC_(stream, n, f) {
|
1514
|
-
return new Stream(tsplus_module_10.mapOut_(tsplus_module_55.mapOutIOC_(tsplus_module_10.concatMap_(stream.channel, tsplus_module_10.writeChunk), n, f),
|
1510
|
+
return new Stream(tsplus_module_10.mapOut_(tsplus_module_55.mapOutIOC_(tsplus_module_10.concatMap_(stream.channel, tsplus_module_10.writeChunk), n, f), tsplus_module_19.single));
|
1515
1511
|
}
|
1516
1512
|
/**
|
1517
1513
|
* Maps each element of this stream to another stream and returns the
|
@@ -1542,11 +1538,11 @@ export function mergeMapIO_(stream, f, n, bufferSize = 16) {
|
|
1542
1538
|
*/
|
1543
1539
|
|
1544
1540
|
function mergeEither_1(fa, fb) {
|
1545
|
-
return mergeWith_1(fa, fb,
|
1541
|
+
return mergeWith_1(fa, fb, tsplus_module_18.left, tsplus_module_18.right);
|
1546
1542
|
}
|
1547
1543
|
|
1548
1544
|
export function mergeWithHandler(terminate) {
|
1549
|
-
return exit => terminate || !
|
1545
|
+
return exit => terminate || !tsplus_module_51.isSuccess(exit) ? tsplus_module_57.done(tsplus_module_1.fromExitNow(exit, fileName_1 + ":2140:71")) : tsplus_module_57.wait(tsplus_module_1.fromExitNow);
|
1550
1546
|
}
|
1551
1547
|
/**
|
1552
1548
|
* @tsplus fluent fncts.io.Stream mergeWith
|
@@ -1565,7 +1561,7 @@ function mergeWith_1(sa, sb, l, r, strategy = "Both") {
|
|
1565
1561
|
|
1566
1562
|
|
1567
1563
|
export function onError_(stream, cleanup) {
|
1568
|
-
return catchAllCause_1(stream, cause => fromIO_1(tsplus_module_1.apSecond_(cleanup(cause), tsplus_module_1.failCauseNow(cause, fileName_1 + ":
|
1564
|
+
return catchAllCause_1(stream, cause => fromIO_1(tsplus_module_1.apSecond_(cleanup(cause), tsplus_module_1.failCauseNow(cause, fileName_1 + ":2177:88"), fileName_1 + ":2177:72")));
|
1569
1565
|
}
|
1570
1566
|
/**
|
1571
1567
|
* Switches to the provided stream in case this one fails with a typed error.
|
@@ -1588,7 +1584,7 @@ function orElse_1(stream, that) {
|
|
1588
1584
|
|
1589
1585
|
|
1590
1586
|
export function orElseEither_(stream, that) {
|
1591
|
-
return orElse_1(map_1(stream,
|
1587
|
+
return orElse_1(map_1(stream, tsplus_module_18.left), () => map_1(that(), tsplus_module_18.right));
|
1592
1588
|
}
|
1593
1589
|
/**
|
1594
1590
|
* Fails with given error in case this one fails with a typed error.
|
@@ -1608,7 +1604,7 @@ export function orElseFail_(stream, e) {
|
|
1608
1604
|
*/
|
1609
1605
|
|
1610
1606
|
export function orElseOptional_(stream, that) {
|
1611
|
-
return catchAll_1(stream, maybeError =>
|
1607
|
+
return catchAll_1(stream, maybeError => tsplus_module_20.match_(maybeError, () => that(), e => failNow_1(tsplus_module_3.just(e))));
|
1612
1608
|
}
|
1613
1609
|
/**
|
1614
1610
|
* Succeeds with the specified value if this one fails with a typed error.
|
@@ -1670,7 +1666,7 @@ class Rechunker {
|
|
1670
1666
|
const result = this.builder;
|
1671
1667
|
this.builder = [];
|
1672
1668
|
this.pos = 0;
|
1673
|
-
return
|
1669
|
+
return tsplus_module_19.from(result);
|
1674
1670
|
}
|
1675
1671
|
|
1676
1672
|
return null;
|
@@ -1678,7 +1674,7 @@ class Rechunker {
|
|
1678
1674
|
|
1679
1675
|
emitOfNotEmpty() {
|
1680
1676
|
if (this.pos !== 0) {
|
1681
|
-
return tsplus_module_10.writeNow(
|
1677
|
+
return tsplus_module_10.writeNow(tsplus_module_19.from(this.builder));
|
1682
1678
|
} else {
|
1683
1679
|
return tsplus_module_10.unit;
|
1684
1680
|
}
|
@@ -1736,7 +1732,7 @@ export function rechunk_(stream, n) {
|
|
1736
1732
|
*/
|
1737
1733
|
|
1738
1734
|
export function repeatValue(a) {
|
1739
|
-
return new Stream(tsplus_module_10.repeated(tsplus_module_10.writeNow(
|
1735
|
+
return new Stream(tsplus_module_10.repeated(tsplus_module_10.writeNow(tsplus_module_19.single(a))));
|
1740
1736
|
}
|
1741
1737
|
/**
|
1742
1738
|
* Creates a stream from an effect producing a value of type `A` which repeats forever.
|
@@ -1745,7 +1741,7 @@ export function repeatValue(a) {
|
|
1745
1741
|
*/
|
1746
1742
|
|
1747
1743
|
export function repeatIO(fa) {
|
1748
|
-
return repeatIOMaybe_1(tsplus_module_1.mapError_(fa, tsplus_module_3.just, fileName_1 + ":
|
1744
|
+
return repeatIOMaybe_1(tsplus_module_1.mapError_(fa, tsplus_module_3.just, fileName_1 + ":2382:42"));
|
1749
1745
|
}
|
1750
1746
|
/**
|
1751
1747
|
* Creates a stream from an effect producing values of type `A` until it fails with None.
|
@@ -1754,7 +1750,7 @@ export function repeatIO(fa) {
|
|
1754
1750
|
*/
|
1755
1751
|
|
1756
1752
|
function repeatIOMaybe_1(fa) {
|
1757
|
-
return repeatIOChunkMaybe_1(tsplus_module_1.map_(fa,
|
1753
|
+
return repeatIOChunkMaybe_1(tsplus_module_1.map_(fa, tsplus_module_19.single, fileName_1 + ":2391:35"));
|
1758
1754
|
}
|
1759
1755
|
/**
|
1760
1756
|
* Creates a stream from an effect producing chunks of `A` values which repeats forever.
|
@@ -1764,7 +1760,7 @@ function repeatIOMaybe_1(fa) {
|
|
1764
1760
|
|
1765
1761
|
|
1766
1762
|
export function repeatIOChunk(fa) {
|
1767
|
-
return repeatIOChunkMaybe_1(tsplus_module_1.mapError_(fa, tsplus_module_3.just, fileName_1 + ":
|
1763
|
+
return repeatIOChunkMaybe_1(tsplus_module_1.mapError_(fa, tsplus_module_3.just, fileName_1 + ":2400:40"));
|
1768
1764
|
}
|
1769
1765
|
/**
|
1770
1766
|
* Creates a stream from an effect producing chunks of `A` values until it fails with None.
|
@@ -1773,7 +1769,7 @@ export function repeatIOChunk(fa) {
|
|
1773
1769
|
*/
|
1774
1770
|
|
1775
1771
|
function repeatIOChunkMaybe_1(fa) {
|
1776
|
-
return unfoldChunkIO_1(undefined, _ => tsplus_module_1.catchAll_(tsplus_module_1.map_(fa, chunk => tsplus_module_3.just(tuple(chunk, undefined)), fileName_1 + ":
|
1772
|
+
return unfoldChunkIO_1(undefined, _ => tsplus_module_1.catchAll_(tsplus_module_1.map_(fa, chunk => tsplus_module_3.just(tuple(chunk, undefined)), fileName_1 + ":2411:11"), maybeError => tsplus_module_20.match_(maybeError, () => tsplus_module_1.succeedNow(tsplus_module_3.nothing(), fileName_1 + ":2412:69"), tsplus_module_1.failNow), fileName_1 + ":2412:16"));
|
1777
1773
|
}
|
1778
1774
|
/**
|
1779
1775
|
* Runs the sink on the stream to produce either the sink's result or an error.
|
@@ -1793,7 +1789,7 @@ function run_1(stream, sink) {
|
|
1793
1789
|
|
1794
1790
|
|
1795
1791
|
export function runCollect(stream) {
|
1796
|
-
return run_1(stream,
|
1792
|
+
return run_1(stream, tsplus_module_46.collectAll());
|
1797
1793
|
}
|
1798
1794
|
/**
|
1799
1795
|
* Runs the stream and collects ignore its elements.
|
@@ -1802,14 +1798,14 @@ export function runCollect(stream) {
|
|
1802
1798
|
*/
|
1803
1799
|
|
1804
1800
|
export function runDrain(stream) {
|
1805
|
-
return run_1(stream,
|
1801
|
+
return run_1(stream, tsplus_module_46.drain);
|
1806
1802
|
}
|
1807
1803
|
/**
|
1808
1804
|
* @tsplus fluent fncts.io.Stream runForeachScoped
|
1809
1805
|
*/
|
1810
1806
|
|
1811
1807
|
function runForeachScoped_1(self, f) {
|
1812
|
-
return runScoped_1(self,
|
1808
|
+
return runScoped_1(self, tsplus_module_46.foreach(f));
|
1813
1809
|
}
|
1814
1810
|
/**
|
1815
1811
|
* Like `into`, but provides the result as a `Managed` to allow for scope
|
@@ -1820,8 +1816,8 @@ function runForeachScoped_1(self, f) {
|
|
1820
1816
|
|
1821
1817
|
|
1822
1818
|
function runIntoElementsScoped_1(stream, queue) {
|
1823
|
-
const writer = tsplus_module_10.readWith(inp => tsplus_module_11.apSecond_(tsplus_module_12.foldLeft_(inp, tsplus_module_10.unit, (channel, a) => tsplus_module_11.apSecond_(channel, tsplus_module_10.writeNow(
|
1824
|
-
return tsplus_module_1.asUnit(
|
1819
|
+
const writer = tsplus_module_10.readWith(inp => tsplus_module_11.apSecond_(tsplus_module_12.foldLeft_(inp, tsplus_module_10.unit, (channel, a) => tsplus_module_11.apSecond_(channel, tsplus_module_10.writeNow(tsplus_module_39.succeed(a)))), writer), err => tsplus_module_10.writeNow(tsplus_module_39.fail(tsplus_module_3.just(err))), () => tsplus_module_10.writeNow(tsplus_module_39.fail(tsplus_module_3.nothing())));
|
1820
|
+
return tsplus_module_1.asUnit(tsplus_module_17.runScoped(tsplus_module_10.drain(tsplus_module_10.mapOutIO_(tsplus_module_10.pipeTo_(stream.channel, writer), exit => tsplus_module_27.offer_(queue, exit)))));
|
1825
1821
|
}
|
1826
1822
|
/**
|
1827
1823
|
* Like `Stream#into`, but provides the result as a `Managed` to allow for scope
|
@@ -1832,8 +1828,8 @@ function runIntoElementsScoped_1(stream, queue) {
|
|
1832
1828
|
|
1833
1829
|
|
1834
1830
|
function runIntoQueueScoped_1(stream, queue) {
|
1835
|
-
const writer = tsplus_module_10.readWithCause(inp => tsplus_module_11.apSecond_(tsplus_module_10.writeNow(
|
1836
|
-
return tsplus_module_1.asUnit(
|
1831
|
+
const writer = tsplus_module_10.readWithCause(inp => tsplus_module_11.apSecond_(tsplus_module_10.writeNow(tsplus_module_26.chunk(inp)), writer), cause => tsplus_module_10.writeNow(tsplus_module_26.failCause(cause)), _ => tsplus_module_10.writeNow(tsplus_module_26.end));
|
1832
|
+
return tsplus_module_1.asUnit(tsplus_module_17.runScoped(tsplus_module_10.drain(tsplus_module_10.mapOutIO_(tsplus_module_10.pipeTo_(stream.channel, writer), take => tsplus_module_27.offer_(queue, take)))));
|
1837
1833
|
}
|
1838
1834
|
/**
|
1839
1835
|
* Like `Stream#runIntoHub`, but provides the result as a `Managed` to allow for scope
|
@@ -1844,7 +1840,7 @@ function runIntoQueueScoped_1(stream, queue) {
|
|
1844
1840
|
|
1845
1841
|
|
1846
1842
|
function runIntoHubScoped_1(stream, hub) {
|
1847
|
-
return runIntoQueueScoped_1(stream,
|
1843
|
+
return runIntoQueueScoped_1(stream, tsplus_module_32.toQueue(hub));
|
1848
1844
|
}
|
1849
1845
|
/**
|
1850
1846
|
* Runs the sink on the stream to produce either the sink's result or an error.
|
@@ -1854,7 +1850,7 @@ function runIntoHubScoped_1(stream, hub) {
|
|
1854
1850
|
|
1855
1851
|
|
1856
1852
|
function runScoped_1(stream, sink) {
|
1857
|
-
return
|
1853
|
+
return tsplus_module_17.runScoped(tsplus_module_10.drain(tsplus_module_10.pipeToOrFail_(stream.channel, sink.channel)));
|
1858
1854
|
}
|
1859
1855
|
/**
|
1860
1856
|
* Statefully maps over the elements of this stream to produce all intermediate results
|
@@ -1865,7 +1861,7 @@ function runScoped_1(stream, sink) {
|
|
1865
1861
|
|
1866
1862
|
|
1867
1863
|
export function scan_(sa, b, f) {
|
1868
|
-
return scanIO_1(sa, b, (b, a) => tsplus_module_1.succeedNow(f(b, a), fileName_1 + ":
|
1864
|
+
return scanIO_1(sa, b, (b, a) => tsplus_module_1.succeedNow(f(b, a), fileName_1 + ":2531:46"));
|
1869
1865
|
}
|
1870
1866
|
/**
|
1871
1867
|
* Statefully and effectfully maps over the elements of this stream to produce all
|
@@ -1875,7 +1871,7 @@ export function scan_(sa, b, f) {
|
|
1875
1871
|
*/
|
1876
1872
|
|
1877
1873
|
function scanIO_1(sa, b, f) {
|
1878
|
-
return concat_1(succeedNow_1(b), mapAccumIO_1(sa, b, (b, a) => tsplus_module_1.map_(f(b, a), b => [b, b], fileName_1 + ":
|
1874
|
+
return concat_1(succeedNow_1(b), mapAccumIO_1(sa, b, (b, a) => tsplus_module_1.map_(f(b, a), b => [b, b], fileName_1 + ":2545:76")));
|
1879
1875
|
}
|
1880
1876
|
/**
|
1881
1877
|
* Statefully maps over the elements of this stream to produce all
|
@@ -1886,7 +1882,7 @@ function scanIO_1(sa, b, f) {
|
|
1886
1882
|
|
1887
1883
|
|
1888
1884
|
export function scanReduce_(fa, f) {
|
1889
|
-
return scanReduceIO_1(fa, (b, a) => tsplus_module_1.succeedNow(f(b, a), fileName_1 + ":
|
1885
|
+
return scanReduceIO_1(fa, (b, a) => tsplus_module_1.succeedNow(f(b, a), fileName_1 + ":2555:49"));
|
1890
1886
|
}
|
1891
1887
|
/**
|
1892
1888
|
* Statefully and effectfully maps over the elements of this stream to produce
|
@@ -1896,7 +1892,7 @@ export function scanReduce_(fa, f) {
|
|
1896
1892
|
*/
|
1897
1893
|
|
1898
1894
|
function scanReduceIO_1(fa, f) {
|
1899
|
-
return mapAccumIO_1(fa, tsplus_module_3.nothing(), (s, a) =>
|
1895
|
+
return mapAccumIO_1(fa, tsplus_module_3.nothing(), (s, a) => tsplus_module_20.match_(s, () => tsplus_module_1.succeedNow([a, tsplus_module_3.just(a)], fileName_1 + ":2570:26"), b => tsplus_module_1.map_(f(b, a), b => [b, tsplus_module_3.just(b)], fileName_1 + ":2571:25")));
|
1900
1896
|
}
|
1901
1897
|
/**
|
1902
1898
|
* Creates a single-valued pure stream
|
@@ -1906,7 +1902,7 @@ function scanReduceIO_1(fa, f) {
|
|
1906
1902
|
|
1907
1903
|
|
1908
1904
|
function succeedNow_1(o) {
|
1909
|
-
return fromChunkNow_1(
|
1905
|
+
return fromChunkNow_1(tsplus_module_19.single(o));
|
1910
1906
|
}
|
1911
1907
|
/**
|
1912
1908
|
* Creates a single-valued pure stream
|
@@ -1916,7 +1912,7 @@ function succeedNow_1(o) {
|
|
1916
1912
|
|
1917
1913
|
|
1918
1914
|
export function succeed(a) {
|
1919
|
-
return fromChunk_1(() =>
|
1915
|
+
return fromChunk_1(() => tsplus_module_19.single(a()));
|
1920
1916
|
}
|
1921
1917
|
|
1922
1918
|
function takeLoop(n) {
|
@@ -1954,12 +1950,22 @@ export function take_(stream, n) {
|
|
1954
1950
|
*/
|
1955
1951
|
|
1956
1952
|
export function takeUntilIO_(ma, f) {
|
1957
|
-
return
|
1953
|
+
return new Stream(tsplus_module_10.pipeTo_(ma.channel, takeUntilIOLoop(tsplus_module_38.empty()[Symbol.iterator](), f)));
|
1954
|
+
}
|
1955
|
+
|
1956
|
+
function takeUntilIOLoop(iterator, f) {
|
1957
|
+
const next = iterator.next();
|
1958
|
+
|
1959
|
+
if (next.done) {
|
1960
|
+
return tsplus_module_10.readWithCause(elem => takeUntilIOLoop(elem[Symbol.iterator](), f), tsplus_module_11.failCauseNow, tsplus_module_11.succeedNow);
|
1961
|
+
} else {
|
1962
|
+
return tsplus_module_10.unwrap(() => tsplus_module_1.map_(f(next.value), b => b ? tsplus_module_10.writeNow(tsplus_module_19.single(next.value)) : tsplus_module_11.apSecond_(tsplus_module_10.writeNow(tsplus_module_19.single(next.value)), takeUntilIOLoop(iterator, f)), fileName_1 + ":2648:24"));
|
1963
|
+
}
|
1958
1964
|
}
|
1959
1965
|
|
1960
1966
|
function takeUntilLoop(p) {
|
1961
1967
|
return tsplus_module_10.readWith(chunk => {
|
1962
|
-
const taken = tsplus_module_12.takeWhile_(chunk,
|
1968
|
+
const taken = tsplus_module_12.takeWhile_(chunk, tsplus_module_47.invert(p));
|
1963
1969
|
const last = tsplus_module_12.take_(tsplus_module_12.drop_(chunk, taken.length), 1);
|
1964
1970
|
|
1965
1971
|
if (tsplus_module_12.isEmpty(last)) {
|
@@ -1997,11 +2003,11 @@ export function tap_(ma, f) {
|
|
1997
2003
|
*/
|
1998
2004
|
|
1999
2005
|
export function throttleEnforce_(sa, costFn, units, duration, burst = 0) {
|
2000
|
-
return throttleEnforceIO_1(sa, chunk => tsplus_module_1.succeedNow(costFn(chunk), fileName_1 + ":
|
2006
|
+
return throttleEnforceIO_1(sa, chunk => tsplus_module_1.succeedNow(costFn(chunk), fileName_1 + ":2705:55"), units, duration, burst);
|
2001
2007
|
}
|
2002
2008
|
|
2003
2009
|
function throttleEnforceIOLoop(costFn, units, duration, burst, tokens, timestamp) {
|
2004
|
-
return tsplus_module_10.readWith(inp => tsplus_module_10.unwrap(tsplus_module_1.zipWith_(costFn(inp),
|
2010
|
+
return tsplus_module_10.readWith(inp => tsplus_module_10.unwrap(() => tsplus_module_1.zipWith_(costFn(inp), tsplus_module_41.currentTime, (weight, current) => {
|
2005
2011
|
const elapsed = current - timestamp;
|
2006
2012
|
const cycles = elapsed / duration;
|
2007
2013
|
|
@@ -2025,7 +2031,7 @@ function throttleEnforceIOLoop(costFn, units, duration, burst, tokens, timestamp
|
|
2025
2031
|
|
2026
2032
|
|
2027
2033
|
function throttleEnforceIO_1(sa, costFn, units, duration, burst = 0) {
|
2028
|
-
return new Stream(tsplus_module_11.flatMap_(tsplus_module_10.fromIO(
|
2034
|
+
return new Stream(tsplus_module_11.flatMap_(tsplus_module_10.fromIO(() => tsplus_module_41.currentTime), current => tsplus_module_10.pipeTo_(sa.channel, throttleEnforceIOLoop(costFn, units, duration, burst, units, current))));
|
2029
2035
|
}
|
2030
2036
|
/**
|
2031
2037
|
* Converts the stream to a managed hub of chunks. After the managed hub is used,
|
@@ -2036,7 +2042,7 @@ function throttleEnforceIO_1(sa, costFn, units, duration, burst = 0) {
|
|
2036
2042
|
|
2037
2043
|
|
2038
2044
|
function toHub_1(stream, capacity) {
|
2039
|
-
return tsplus_module_1.flatMap_(
|
2045
|
+
return tsplus_module_1.flatMap_(tsplus_module_30.acquireRelease(() => tsplus_module_32.makeBounded(capacity), _ => tsplus_module_32.shutdown(_)), hub => tsplus_module_1.map_(tsplus_module_1.fork(runIntoHubScoped_1(stream, hub)), () => hub), fileName_1 + ":2771:18");
|
2040
2046
|
}
|
2041
2047
|
/**
|
2042
2048
|
* Interpret the stream as a managed pull
|
@@ -2046,7 +2052,7 @@ function toHub_1(stream, capacity) {
|
|
2046
2052
|
|
2047
2053
|
|
2048
2054
|
function toPull_1(stream) {
|
2049
|
-
return tsplus_module_1.map_(
|
2055
|
+
return tsplus_module_1.map_(tsplus_module_63.toPull(stream.channel), io => tsplus_module_1.flatMap_(tsplus_module_1.mapError_(io, tsplus_module_3.just, fileName_1 + ":2784:16"), r => tsplus_module_4.match_(r, () => tsplus_module_1.failNow(tsplus_module_3.nothing(), fileName_1 + ":2784:68"), tsplus_module_1.succeedNow), fileName_1 + ":2784:36"), fileName_1 + ":2783:35");
|
2050
2056
|
}
|
2051
2057
|
/**
|
2052
2058
|
* Converts the stream to a managed queue of chunks. After the managed queue is used,
|
@@ -2057,7 +2063,7 @@ function toPull_1(stream) {
|
|
2057
2063
|
|
2058
2064
|
|
2059
2065
|
function toQueue_1(stream, capacity = 2) {
|
2060
|
-
return tsplus_module_1.flatMap_(
|
2066
|
+
return tsplus_module_1.flatMap_(tsplus_module_30.acquireRelease(() => tsplus_module_29.makeBounded(capacity), _ => tsplus_module_27.shutdown(_)), queue => tsplus_module_1.map_(tsplus_module_1.fork(runIntoQueueScoped_1(stream, queue)), () => queue), fileName_1 + ":2796:20");
|
2061
2067
|
}
|
2062
2068
|
/**
|
2063
2069
|
* @tsplus fluent fncts.io.Stream toQueueDropping
|
@@ -2065,14 +2071,14 @@ function toQueue_1(stream, capacity = 2) {
|
|
2065
2071
|
|
2066
2072
|
|
2067
2073
|
export function toQueueDropping_(stream, capacity = 2) {
|
2068
|
-
return tsplus_module_1.flatMap_(
|
2074
|
+
return tsplus_module_1.flatMap_(tsplus_module_30.acquireRelease(() => tsplus_module_29.makeDropping(capacity), _ => tsplus_module_27.shutdown(_)), queue => tsplus_module_1.map_(tsplus_module_1.fork(runIntoQueueScoped_1(stream, queue)), () => queue), fileName_1 + ":2810:20");
|
2069
2075
|
}
|
2070
2076
|
/**
|
2071
2077
|
* @tsplus fluent fncts.io.Stream toQueueOfElements
|
2072
2078
|
*/
|
2073
2079
|
|
2074
2080
|
function toQueueOfElements_1(stream, capacity = 2) {
|
2075
|
-
return tsplus_module_1.flatMap_(
|
2081
|
+
return tsplus_module_1.flatMap_(tsplus_module_30.acquireRelease(() => tsplus_module_29.makeBounded(capacity), _ => tsplus_module_27.shutdown(_)), queue => tsplus_module_1.map_(tsplus_module_1.fork(runIntoElementsScoped_1(stream, queue)), () => queue), fileName_1 + ":2824:20");
|
2076
2082
|
}
|
2077
2083
|
/**
|
2078
2084
|
* @tsplus fluent fncts.io.Stream toQueueSliding
|
@@ -2080,7 +2086,7 @@ function toQueueOfElements_1(stream, capacity = 2) {
|
|
2080
2086
|
|
2081
2087
|
|
2082
2088
|
export function toQueueSliding_(stream, capacity = 2) {
|
2083
|
-
return tsplus_module_1.flatMap_(
|
2089
|
+
return tsplus_module_1.flatMap_(tsplus_module_30.acquireRelease(() => tsplus_module_29.makeSliding(capacity), _ => tsplus_module_27.shutdown(_)), queue => tsplus_module_1.map_(tsplus_module_1.fork(runIntoQueueScoped_1(stream, queue)), () => queue), fileName_1 + ":2838:20");
|
2084
2090
|
}
|
2085
2091
|
/**
|
2086
2092
|
* Converts the stream into an unbounded managed queue. After the managed queue
|
@@ -2090,11 +2096,11 @@ export function toQueueSliding_(stream, capacity = 2) {
|
|
2090
2096
|
*/
|
2091
2097
|
|
2092
2098
|
function toQueueUnbounded_1(stream) {
|
2093
|
-
return tsplus_module_1.flatMap_(
|
2099
|
+
return tsplus_module_1.flatMap_(tsplus_module_30.acquireRelease(() => tsplus_module_29.makeUnbounded(), _ => tsplus_module_27.shutdown(_)), queue => tsplus_module_1.map_(tsplus_module_1.fork(runIntoQueueScoped_1(stream, queue)), () => queue), fileName_1 + ":2852:20");
|
2094
2100
|
}
|
2095
2101
|
|
2096
2102
|
function unfoldChunkIOLoop(s, f) {
|
2097
|
-
return tsplus_module_10.unwrap(tsplus_module_1.map_(f(s), m =>
|
2103
|
+
return tsplus_module_10.unwrap(() => tsplus_module_1.map_(f(s), m => tsplus_module_20.match_(m, () => tsplus_module_10.unit, ([as, s]) => tsplus_module_11.flatMap_(tsplus_module_10.writeNow(as), () => unfoldChunkIOLoop(s, f))), fileName_1 + ":2863:13"));
|
2098
2104
|
}
|
2099
2105
|
/**
|
2100
2106
|
* Creates a stream by effectfully peeling off the "layers" of a value of type `S`
|
@@ -2114,11 +2120,11 @@ function unfoldChunkIO_1(s, f) {
|
|
2114
2120
|
|
2115
2121
|
|
2116
2122
|
function unfoldIO_1(s, f) {
|
2117
|
-
return unfoldChunkIO_1(s, _ => tsplus_module_1.map_(f(_), m =>
|
2123
|
+
return unfoldChunkIO_1(s, _ => tsplus_module_1.map_(f(_), m => tsplus_module_37.map_(m, ([a, s]) => tuple(tsplus_module_19.single(a), s)), fileName_1 + ":2887:42"));
|
2118
2124
|
}
|
2119
2125
|
|
2120
2126
|
function unfoldChunkLoop(s, f) {
|
2121
|
-
return
|
2127
|
+
return tsplus_module_20.match_(f(s), () => tsplus_module_10.unit, ([as, s]) => tsplus_module_11.flatMap_(tsplus_module_10.writeNow(as), () => unfoldChunkLoop(s, f)));
|
2122
2128
|
}
|
2123
2129
|
/**
|
2124
2130
|
* @tsplus static fncts.io.StreamOps unfoldChunk
|
@@ -2134,7 +2140,7 @@ function unfoldChunk_1(s, f) {
|
|
2134
2140
|
|
2135
2141
|
|
2136
2142
|
export function unfold(s, f) {
|
2137
|
-
return unfoldChunk_1(s, s =>
|
2143
|
+
return unfoldChunk_1(s, s => tsplus_module_37.map_(f(s), ([a, s]) => tuple(tsplus_module_19.single(a), s)));
|
2138
2144
|
}
|
2139
2145
|
/**
|
2140
2146
|
* Creates a stream produced from an IO
|
@@ -2170,9 +2176,9 @@ function unwrapScoped_1(stream) {
|
|
2170
2176
|
|
2171
2177
|
export function zipWithLatest_(fa, fb, f) {
|
2172
2178
|
function pullNonEmpty(pull) {
|
2173
|
-
return tsplus_module_1.flatMap_(pull, chunk => tsplus_module_12.isNonEmpty(chunk) ? pullNonEmpty(pull) : tsplus_module_1.succeedNow(chunk, fileName_1 + ":
|
2179
|
+
return tsplus_module_1.flatMap_(pull, chunk => tsplus_module_12.isNonEmpty(chunk) ? pullNonEmpty(pull) : tsplus_module_1.succeedNow(chunk, fileName_1 + ":2951:90"), fileName_1 + ":2951:24");
|
2174
2180
|
}
|
2175
2181
|
|
2176
|
-
return fromPull_1(tsplus_module_1.flatMap_(tsplus_module_1.map_(toPull_1(fa), pullNonEmpty, fileName_1 + ":
|
2182
|
+
return fromPull_1(tsplus_module_1.flatMap_(tsplus_module_1.map_(toPull_1(fa), pullNonEmpty, fileName_1 + ":2955:36"), left => tsplus_module_1.flatMap_(tsplus_module_1.map_(toPull_1(fb), pullNonEmpty, fileName_1 + ":2956:36"), right => toPull_1(flatMap_1(fromIOMaybe_1(tsplus_module_24.raceWith_(left, () => right, (leftDone, rightFiber) => tsplus_module_1.zipWith_(tsplus_module_1.fromExitNow(leftDone, fileName_1 + ":2961:53"), tsplus_module_22.join(rightFiber), (l, r) => tuple(l, r, true)), (rightDone, leftFiber) => tsplus_module_1.zipWith_(tsplus_module_1.fromExitNow(rightDone, fileName_1 + ":2962:53"), tsplus_module_22.join(leftFiber), (r, l) => tuple(l, r, false)), fileName_1 + ":2959:24")), ([l, r, leftFirst]) => flatMap_1(fromIO_1(tsplus_module_6.make(() => tuple(tsplus_module_12.unsafeGet_(l, l.length - 1), tsplus_module_12.unsafeGet_(r, r.length - 1)))), latest => concat_1(fromChunk_1(() => leftFirst ? tsplus_module_12.map_(r, b => f(tsplus_module_12.unsafeGet_(l, l.length - 1), b)) : tsplus_module_12.map_(l, a => f(a, tsplus_module_12.unsafeGet_(r, r.length - 1)))), flatMap_1(mapIO_1(mergeEither_1(repeatIOMaybe_1(left), repeatIOMaybe_1(right)), ab => tsplus_module_4.match_(ab, leftChunk => tsplus_module_15.modify_(latest, ([_, rightLatest]) => tuple(tsplus_module_12.map_(leftChunk, a => f(a, rightLatest)), tuple(tsplus_module_12.unsafeGet_(leftChunk, leftChunk.length - 1), rightLatest))), rightChunk => tsplus_module_15.modify_(latest, ([leftLatest, _]) => tuple(tsplus_module_12.map_(rightChunk, b => f(leftLatest, b)), tuple(leftLatest, tsplus_module_12.unsafeGet_(rightChunk, rightChunk.length - 1)))))), fromChunkNow_1))))), fileName_1 + ":2956:22"), fileName_1 + ":2955:22"));
|
2177
2183
|
}
|
2178
2184
|
//# sourceMappingURL=api.mjs.map
|