@fncts/io 0.0.8 → 0.0.11
Sign up to get free protection for your applications and to get access to all the features.
- package/Channel/api.d.ts +27 -4
- package/Channel/internal/MergeDecision.d.ts +14 -0
- package/IO/api/onTermination.d.ts +9 -0
- package/IO.d.ts +1 -0
- package/STM/api.d.ts +7 -0
- package/Sink/api.d.ts +637 -8
- package/TReentrantLock/api.d.ts +97 -0
- package/TReentrantLock/definition.d.ts +65 -0
- package/TReentrantLock.d.ts +2 -0
- package/_cjs/Cached/api.cjs +5 -5
- package/_cjs/Cached/api.cjs.map +1 -1
- package/_cjs/Channel/api/mapOutIOC.cjs +9 -9
- package/_cjs/Channel/api/mapOutIOC.cjs.map +1 -1
- package/_cjs/Channel/api/mergeAllWith.cjs +18 -18
- package/_cjs/Channel/api/mergeAllWith.cjs.map +1 -1
- package/_cjs/Channel/api/mergeWith.cjs +5 -5
- package/_cjs/Channel/api/mergeWith.cjs.map +1 -1
- package/_cjs/Channel/api/run.cjs +3 -3
- package/_cjs/Channel/api/runCollect.cjs +3 -3
- package/_cjs/Channel/api/runDrain.cjs +3 -3
- package/_cjs/Channel/api.cjs +90 -35
- package/_cjs/Channel/api.cjs.map +1 -1
- package/_cjs/Channel/internal/ChannelExecutor.cjs +16 -16
- package/_cjs/Channel/internal/ChannelExecutor.cjs.map +1 -1
- package/_cjs/Channel/internal/MergeDecision.cjs +11 -2
- package/_cjs/Channel/internal/MergeDecision.cjs.map +1 -1
- package/_cjs/Channel/internal/SingleProducerAsyncInput.cjs +20 -20
- package/_cjs/Channel/internal/SingleProducerAsyncInput.cjs.map +1 -1
- package/_cjs/Fiber/api/awaitAll.cjs +1 -1
- package/_cjs/Fiber/api/awaitAll.cjs.map +1 -1
- package/_cjs/Fiber/api/fromIO.cjs +1 -1
- package/_cjs/Fiber/api/fromIO.cjs.map +1 -1
- package/_cjs/Fiber/api/interruptFork.cjs +3 -3
- package/_cjs/Fiber/api/interruptFork.cjs.map +1 -1
- package/_cjs/Fiber/api/zipWith.cjs +1 -1
- package/_cjs/Fiber/api/zipWith.cjs.map +1 -1
- package/_cjs/FiberRef/api/locallyScoped.cjs +3 -3
- package/_cjs/FiberRef/api/locallyScoped.cjs.map +1 -1
- package/_cjs/FiberRef/constructors.cjs +1 -1
- package/_cjs/FiberRef/constructors.cjs.map +1 -1
- package/_cjs/Future/api.cjs +1 -1
- package/_cjs/Future/api.cjs.map +1 -1
- package/_cjs/Hub/internal.cjs +1 -1
- package/_cjs/Hub/internal.cjs.map +1 -1
- package/_cjs/IO/api/asyncIO.cjs +4 -4
- package/_cjs/IO/api/asyncIO.cjs.map +1 -1
- package/_cjs/IO/api/bracketExit.cjs +1 -1
- package/_cjs/IO/api/bracketExit.cjs.map +1 -1
- package/_cjs/IO/api/environment.cjs +5 -5
- package/_cjs/IO/api/environment.cjs.map +1 -1
- package/_cjs/IO/api/foreachC.cjs +3 -3
- package/_cjs/IO/api/foreachC.cjs.map +1 -1
- package/_cjs/IO/api/foreachExec.cjs +3 -3
- package/_cjs/IO/api/foreachExec.cjs.map +1 -1
- package/_cjs/IO/api/forkAll.cjs +1 -1
- package/_cjs/IO/api/forkAll.cjs.map +1 -1
- package/_cjs/IO/api/forkIn.cjs +1 -1
- package/_cjs/IO/api/forkIn.cjs.map +1 -1
- package/_cjs/IO/api/forkScoped.cjs +1 -1
- package/_cjs/IO/api/forkScoped.cjs.map +1 -1
- package/_cjs/IO/api/fulfill.cjs +1 -1
- package/_cjs/IO/api/fulfill.cjs.map +1 -1
- package/_cjs/IO/api/interrupt.cjs +4 -4
- package/_cjs/IO/api/interrupt.cjs.map +1 -1
- package/_cjs/IO/api/memoize.cjs +4 -4
- package/_cjs/IO/api/memoize.cjs.map +1 -1
- package/_cjs/IO/api/onTermination.cjs +28 -0
- package/_cjs/IO/api/onTermination.cjs.map +1 -0
- package/_cjs/IO/api/raceFirst.cjs +1 -1
- package/_cjs/IO/api/raceFirst.cjs.map +1 -1
- package/_cjs/IO/api/repeat.cjs +2 -2
- package/_cjs/IO/api/repeat.cjs.map +1 -1
- package/_cjs/IO/api/retry.cjs +2 -2
- package/_cjs/IO/api/retry.cjs.map +1 -1
- package/_cjs/IO/api/schedule.cjs +2 -2
- package/_cjs/IO/api/schedule.cjs.map +1 -1
- package/_cjs/IO/api/timeout.cjs +3 -3
- package/_cjs/IO/api/timeout.cjs.map +1 -1
- package/_cjs/IO/api/zipC.cjs +5 -5
- package/_cjs/IO/api/zipC.cjs.map +1 -1
- package/_cjs/IO/api.cjs +4 -4
- package/_cjs/IO/api.cjs.map +1 -1
- package/_cjs/IO.cjs +13 -0
- package/_cjs/IO.cjs.map +1 -1
- package/_cjs/Layer/MemoMap.cjs +24 -24
- package/_cjs/Layer/MemoMap.cjs.map +1 -1
- package/_cjs/Layer/api.cjs +4 -4
- package/_cjs/Layer/api.cjs.map +1 -1
- package/_cjs/Ref/DerivedAll.cjs +1 -1
- package/_cjs/Ref/DerivedAll.cjs.map +1 -1
- package/_cjs/Ref/Synchronized/api.cjs +3 -3
- package/_cjs/Ref/Synchronized/api.cjs.map +1 -1
- package/_cjs/Ref/Synchronized/constructors.cjs +3 -3
- package/_cjs/Ref/Synchronized/constructors.cjs.map +1 -1
- package/_cjs/Ref/Synchronized/definition.cjs +3 -3
- package/_cjs/Ref/Synchronized/definition.cjs.map +1 -1
- package/_cjs/Ref/api/modify.cjs +10 -10
- package/_cjs/Ref/api/modify.cjs.map +1 -1
- package/_cjs/STM/api.cjs +15 -6
- package/_cjs/STM/api.cjs.map +1 -1
- package/_cjs/Scope/ReleaseMap/api/releaseAll.cjs +1 -1
- package/_cjs/Scope/ReleaseMap/api/releaseAll.cjs.map +1 -1
- package/_cjs/Scope/ReleaseMap/api.cjs +13 -13
- package/_cjs/Scope/ReleaseMap/api.cjs.map +1 -1
- package/_cjs/ScopedRef/api.cjs +1 -1
- package/_cjs/ScopedRef/api.cjs.map +1 -1
- package/_cjs/Sink/api.cjs +1475 -42
- package/_cjs/Sink/api.cjs.map +1 -1
- package/_cjs/Stream/api.cjs +42 -42
- package/_cjs/Stream/api.cjs.map +1 -1
- package/_cjs/TReentrantLock/api.cjs +297 -0
- package/_cjs/TReentrantLock/api.cjs.map +1 -0
- package/_cjs/TReentrantLock/definition.cjs +125 -0
- package/_cjs/TReentrantLock/definition.cjs.map +1 -0
- package/_cjs/TReentrantLock.cjs +32 -0
- package/_cjs/TReentrantLock.cjs.map +1 -0
- package/_cjs/TRef/api.cjs +7 -7
- package/_cjs/TRef/api.cjs.map +1 -1
- package/_cjs/collection/immutable/Conc/dropUntilIO.cjs +38 -0
- package/_cjs/collection/immutable/Conc/dropUntilIO.cjs.map +1 -0
- package/_cjs/collection/immutable/Conc/dropWhileIO.cjs +38 -0
- package/_cjs/collection/immutable/Conc/dropWhileIO.cjs.map +1 -0
- package/_cjs/collection/immutable/Conc/filterIO.cjs +35 -0
- package/_cjs/collection/immutable/Conc/filterIO.cjs.map +1 -0
- package/_cjs/collection/immutable/Conc.cjs +13 -0
- package/_cjs/collection/immutable/Conc.cjs.map +1 -1
- package/_cjs/data/Exit/foreachIO.cjs +1 -1
- package/_cjs/data/Exit/foreachIO.cjs.map +1 -1
- package/_mjs/Cached/api.mjs +5 -5
- package/_mjs/Cached/api.mjs.map +1 -1
- package/_mjs/Channel/api/mapOutIOC.mjs +9 -9
- package/_mjs/Channel/api/mapOutIOC.mjs.map +1 -1
- package/_mjs/Channel/api/mergeAllWith.mjs +18 -18
- package/_mjs/Channel/api/mergeAllWith.mjs.map +1 -1
- package/_mjs/Channel/api/mergeWith.mjs +5 -5
- package/_mjs/Channel/api/mergeWith.mjs.map +1 -1
- package/_mjs/Channel/api/run.mjs +3 -3
- package/_mjs/Channel/api/runCollect.mjs +3 -3
- package/_mjs/Channel/api/runDrain.mjs +3 -3
- package/_mjs/Channel/api.mjs +78 -33
- package/_mjs/Channel/api.mjs.map +1 -1
- package/_mjs/Channel/internal/ChannelExecutor.mjs +16 -16
- package/_mjs/Channel/internal/ChannelExecutor.mjs.map +1 -1
- package/_mjs/Channel/internal/MergeDecision.mjs +7 -0
- package/_mjs/Channel/internal/MergeDecision.mjs.map +1 -1
- package/_mjs/Channel/internal/SingleProducerAsyncInput.mjs +20 -20
- package/_mjs/Channel/internal/SingleProducerAsyncInput.mjs.map +1 -1
- package/_mjs/Fiber/api/awaitAll.mjs +1 -1
- package/_mjs/Fiber/api/awaitAll.mjs.map +1 -1
- package/_mjs/Fiber/api/fromIO.mjs +1 -1
- package/_mjs/Fiber/api/fromIO.mjs.map +1 -1
- package/_mjs/Fiber/api/interruptFork.mjs +3 -3
- package/_mjs/Fiber/api/interruptFork.mjs.map +1 -1
- package/_mjs/Fiber/api/zipWith.mjs +1 -1
- package/_mjs/Fiber/api/zipWith.mjs.map +1 -1
- package/_mjs/FiberRef/api/locallyScoped.mjs +3 -3
- package/_mjs/FiberRef/api/locallyScoped.mjs.map +1 -1
- package/_mjs/FiberRef/constructors.mjs +1 -1
- package/_mjs/FiberRef/constructors.mjs.map +1 -1
- package/_mjs/Future/api.mjs +1 -1
- package/_mjs/Future/api.mjs.map +1 -1
- package/_mjs/Hub/internal.mjs +1 -1
- package/_mjs/Hub/internal.mjs.map +1 -1
- package/_mjs/IO/api/asyncIO.mjs +4 -4
- package/_mjs/IO/api/asyncIO.mjs.map +1 -1
- package/_mjs/IO/api/bracketExit.mjs +1 -1
- package/_mjs/IO/api/bracketExit.mjs.map +1 -1
- package/_mjs/IO/api/environment.mjs +5 -5
- package/_mjs/IO/api/environment.mjs.map +1 -1
- package/_mjs/IO/api/foreachC.mjs +3 -3
- package/_mjs/IO/api/foreachC.mjs.map +1 -1
- package/_mjs/IO/api/foreachExec.mjs +3 -3
- package/_mjs/IO/api/foreachExec.mjs.map +1 -1
- package/_mjs/IO/api/forkAll.mjs +1 -1
- package/_mjs/IO/api/forkAll.mjs.map +1 -1
- package/_mjs/IO/api/forkIn.mjs +1 -1
- package/_mjs/IO/api/forkIn.mjs.map +1 -1
- package/_mjs/IO/api/forkScoped.mjs +1 -1
- package/_mjs/IO/api/forkScoped.mjs.map +1 -1
- package/_mjs/IO/api/fulfill.mjs +1 -1
- package/_mjs/IO/api/fulfill.mjs.map +1 -1
- package/_mjs/IO/api/interrupt.mjs +4 -4
- package/_mjs/IO/api/interrupt.mjs.map +1 -1
- package/_mjs/IO/api/memoize.mjs +4 -4
- package/_mjs/IO/api/memoize.mjs.map +1 -1
- package/_mjs/IO/api/onTermination.mjs +13 -0
- package/_mjs/IO/api/onTermination.mjs.map +1 -0
- package/_mjs/IO/api/raceFirst.mjs +1 -1
- package/_mjs/IO/api/raceFirst.mjs.map +1 -1
- package/_mjs/IO/api/repeat.mjs +2 -2
- package/_mjs/IO/api/repeat.mjs.map +1 -1
- package/_mjs/IO/api/retry.mjs +2 -2
- package/_mjs/IO/api/retry.mjs.map +1 -1
- package/_mjs/IO/api/schedule.mjs +2 -2
- package/_mjs/IO/api/schedule.mjs.map +1 -1
- package/_mjs/IO/api/timeout.mjs +3 -3
- package/_mjs/IO/api/timeout.mjs.map +1 -1
- package/_mjs/IO/api/zipC.mjs +5 -5
- package/_mjs/IO/api/zipC.mjs.map +1 -1
- package/_mjs/IO/api.mjs +4 -4
- package/_mjs/IO/api.mjs.map +1 -1
- package/_mjs/IO.mjs +1 -0
- package/_mjs/IO.mjs.map +1 -1
- package/_mjs/Layer/MemoMap.mjs +24 -24
- package/_mjs/Layer/MemoMap.mjs.map +1 -1
- package/_mjs/Layer/api.mjs +4 -4
- package/_mjs/Layer/api.mjs.map +1 -1
- package/_mjs/Ref/DerivedAll.mjs +1 -1
- package/_mjs/Ref/DerivedAll.mjs.map +1 -1
- package/_mjs/Ref/Synchronized/api.mjs +3 -3
- package/_mjs/Ref/Synchronized/api.mjs.map +1 -1
- package/_mjs/Ref/Synchronized/constructors.mjs +3 -3
- package/_mjs/Ref/Synchronized/constructors.mjs.map +1 -1
- package/_mjs/Ref/Synchronized/definition.mjs +3 -3
- package/_mjs/Ref/Synchronized/definition.mjs.map +1 -1
- package/_mjs/Ref/api/modify.mjs +10 -10
- package/_mjs/Ref/api/modify.mjs.map +1 -1
- package/_mjs/STM/api.mjs +13 -6
- package/_mjs/STM/api.mjs.map +1 -1
- package/_mjs/Scope/ReleaseMap/api/releaseAll.mjs +1 -1
- package/_mjs/Scope/ReleaseMap/api/releaseAll.mjs.map +1 -1
- package/_mjs/Scope/ReleaseMap/api.mjs +13 -13
- package/_mjs/Scope/ReleaseMap/api.mjs.map +1 -1
- package/_mjs/ScopedRef/api.mjs +1 -1
- package/_mjs/ScopedRef/api.mjs.map +1 -1
- package/_mjs/Sink/api.mjs +1287 -37
- package/_mjs/Sink/api.mjs.map +1 -1
- package/_mjs/Stream/api.mjs +42 -42
- package/_mjs/Stream/api.mjs.map +1 -1
- package/_mjs/TReentrantLock/api.mjs +243 -0
- package/_mjs/TReentrantLock/api.mjs.map +1 -0
- package/_mjs/TReentrantLock/definition.mjs +102 -0
- package/_mjs/TReentrantLock/definition.mjs.map +1 -0
- package/_mjs/TReentrantLock.mjs +4 -0
- package/_mjs/TReentrantLock.mjs.map +1 -0
- package/_mjs/TRef/api.mjs +7 -7
- package/_mjs/TRef/api.mjs.map +1 -1
- package/_mjs/collection/immutable/Conc/dropUntilIO.mjs +26 -0
- package/_mjs/collection/immutable/Conc/dropUntilIO.mjs.map +1 -0
- package/_mjs/collection/immutable/Conc/dropWhileIO.mjs +26 -0
- package/_mjs/collection/immutable/Conc/dropWhileIO.mjs.map +1 -0
- package/_mjs/collection/immutable/Conc/filterIO.mjs +22 -0
- package/_mjs/collection/immutable/Conc/filterIO.mjs.map +1 -0
- package/_mjs/collection/immutable/Conc.mjs +1 -0
- package/_mjs/collection/immutable/Conc.mjs.map +1 -1
- package/_mjs/data/Exit/foreachIO.mjs +1 -1
- package/_mjs/data/Exit/foreachIO.mjs.map +1 -1
- package/_src/Channel/api.ts +98 -11
- package/_src/Channel/internal/MergeDecision.ts +15 -0
- package/_src/IO/api/onTermination.ts +17 -0
- package/_src/IO/api.ts +1 -1
- package/_src/IO.ts +1 -0
- package/_src/STM/api.ts +9 -0
- package/_src/Sink/api.ts +1725 -36
- package/_src/TFuture/definition.ts +1 -1
- package/_src/TReentrantLock/api.ts +193 -0
- package/_src/TReentrantLock/definition.ts +86 -0
- package/_src/TReentrantLock.ts +4 -0
- package/_src/collection/immutable/Conc/dropUntilIO.ts +24 -0
- package/_src/collection/immutable/Conc/dropWhileIO.ts +26 -0
- package/_src/collection/immutable/Conc/filterIO.ts +16 -0
- package/_src/collection/immutable/Conc.ts +1 -0
- package/collection/immutable/Conc/dropUntilIO.d.ts +7 -0
- package/collection/immutable/Conc/dropWhileIO.d.ts +7 -0
- package/collection/immutable/Conc/filterIO.d.ts +7 -0
- package/collection/immutable/Conc.d.ts +1 -0
- package/package.json +3 -3
package/Sink/api.d.ts
CHANGED
@@ -1,14 +1,133 @@
|
|
1
|
-
import { Conc } from "@fncts/base/collection/immutable/Conc";
|
2
|
-
import { Channel } from "@fncts/io/Channel";
|
3
1
|
import { Sink } from "@fncts/io/Sink/definition";
|
2
|
+
import { Lazy } from "@fncts/base/data/function";
|
3
|
+
import { Conc, ConcBuilder } from "@fncts/base/collection/immutable/Conc";
|
4
4
|
import { Predicate } from "@fncts/base/data/Predicate";
|
5
|
+
import { Channel } from "@fncts/io/Channel";
|
5
6
|
import { IO } from "@fncts/io/IO/definition";
|
7
|
+
import { Environment } from "@fncts/base/data/Environment";
|
8
|
+
import { Cause } from "@fncts/base/data/Cause";
|
9
|
+
import { Maybe } from "@fncts/base/data/Maybe";
|
10
|
+
import { Has } from "@fncts/base/typeclass/Has";
|
11
|
+
import { Scope } from "@fncts/io/Scope/definition";
|
12
|
+
import { Either } from "@fncts/base/data/Either";
|
13
|
+
import { Queue } from "@fncts/io/Queue/definition";
|
14
|
+
import { Hub } from "@fncts/io/Hub/definition";
|
15
|
+
import { Exit } from "@fncts/base/data/Exit";
|
16
|
+
import { Tag } from "@fncts/base/data/Tag";
|
17
|
+
import { Ref } from "@fncts/io/Ref";
|
18
|
+
import { Duration } from "@fncts/base/data/Duration";
|
19
|
+
import { MergeDecision } from "../Channel/internal/MergeDecision.js";
|
6
20
|
/**
|
7
|
-
*
|
8
|
-
* @tsplus
|
21
|
+
* Like {@link zip }, but keeps only the result from this sink
|
22
|
+
* @tsplus fluent fncts.io.Sink apFirst
|
23
|
+
* @tsplus location "@fncts/io/Sink/api"
|
24
|
+
*/
|
25
|
+
export declare function apFirst<R, E, In, L, Z, R1, E1, In1 extends In, L1 extends L, Z1>(self: Sink<R, E, In, L, Z>, that: Lazy<Sink<R1, E1, In1, L1, Z1>>): Sink<R & R1, E | E1, In & In1, L | L1, Z>;
|
26
|
+
/**
|
27
|
+
* Like {@link zipC }, but keeps only the result from this sink
|
28
|
+
* @tsplus fluent fncts.io.Sink apFirstC
|
29
|
+
* @tsplus location "@fncts/io/Sink/api"
|
30
|
+
*/
|
31
|
+
export declare function apFirstC<R, E, In, L, Z, R1, E1, In1 extends In, L1 extends L, Z1>(self: Sink<R, E, In, L, Z>, that: Lazy<Sink<R1, E1, In1, L1, Z1>>): Sink<R & R1, E | E1, In & In1, L | L1, Z>;
|
32
|
+
/**
|
33
|
+
* Like {@link zip }, but keeps only the result from the `that` sink
|
34
|
+
* @tsplus fluent fncts.io.Sink apSecond
|
35
|
+
* @tsplus location "@fncts/io/Sink/api"
|
36
|
+
*/
|
37
|
+
export declare function apSecond<R, E, In, L, Z, R1, E1, In1 extends In, L1 extends L, Z1>(self: Sink<R, E, In, L, Z>, that: Lazy<Sink<R1, E1, In1, L1, Z1>>, __tsplusTrace?: string): Sink<R & R1, E | E1, In & In1, L | L1, Z1>;
|
38
|
+
/**
|
39
|
+
* Like {@link zipC }, but keeps only the result from the `that` sink
|
40
|
+
* @tsplus fluent fncts.io.Sink apSecondC
|
41
|
+
* @tsplus location "@fncts/io/Sink/api"
|
42
|
+
*/
|
43
|
+
export declare function apSecondC<R, E, In, L, Z, R1, E1, In1 extends In, L1 extends L, Z1>(self: Sink<R, E, In, L, Z>, that: Lazy<Sink<R1, E1, In1, L1, Z1>>, __tsplusTrace?: string): Sink<R & R1, E | E1, In & In1, L | L1, Z1>;
|
44
|
+
/**
|
45
|
+
* Replaces this sink's result with the provided value.
|
46
|
+
* @tsplus fluent fncts.io.Sink as
|
47
|
+
* @tsplus location "@fncts/io/Sink/api"
|
48
|
+
*/
|
49
|
+
export declare function as<R, E, In, L, Z, Z1>(self: Sink<R, E, In, L, Z>, z: Lazy<Z1>, __tsplusTrace?: string): Sink<R, E, In, L, Z1>;
|
50
|
+
/**
|
51
|
+
* Repeatedly runs the sink and accumulates its results into a chunk
|
52
|
+
* @tsplus fluent fncts.io.Sink collectAll
|
53
|
+
* @tsplus location "@fncts/io/Sink/api"
|
54
|
+
*/
|
55
|
+
export declare function collectAll<R, E, In extends L, L, Z>(self: Sink<R, E, In, L, Z>, __tsplusTrace?: string): Sink<R, E, In, L, Conc<Z>>;
|
56
|
+
/**
|
57
|
+
* Repeatedly runs the sink for as long as its results satisfy the predicate
|
58
|
+
* `p`. The sink's results will be accumulated using the stepping function
|
59
|
+
* `f`.
|
60
|
+
* @tsplus fluent fncts.io.Sink collectAllWhileWith
|
61
|
+
* @tsplus location "@fncts/io/Sink/api"
|
62
|
+
*/
|
63
|
+
export declare function collectAllWhileWith<R, E, In extends L, L, Z, S>(self: Sink<R, E, In, L, Z>, z: Lazy<S>, p: Predicate<Z>, f: (s: S, z: Z) => S, __tsplusTrace?: string): Sink<R, E, In, L, S>;
|
64
|
+
/**
|
65
|
+
* Collects the leftovers from the stream when the sink succeeds and returns
|
66
|
+
* them as part of the sink's result
|
67
|
+
* @tsplus getter fncts.io.Sink collectLeftover
|
68
|
+
* @tsplus location "@fncts/io/Sink/api"
|
69
|
+
*/
|
70
|
+
export declare function collectLeftover<R, E, In, L, Z>(self: Sink<R, E, In, L, Z>, __tsplusTrace?: string): Sink<R, E, In, never, readonly [Z, Conc<L>]>;
|
71
|
+
/**
|
72
|
+
* Transforms this sink's input elements.
|
73
|
+
* @tsplus fluent fncts.io.Sink contramap
|
74
|
+
* @tsplus location "@fncts/io/Sink/api"
|
75
|
+
*/
|
76
|
+
export declare function contramap<R, E, In, L, Z, In1>(self: Sink<R, E, In, L, Z>, f: (inp: In1) => In, __tsplusTrace?: string): Sink<R, E, In1, L, Z>;
|
77
|
+
/**
|
78
|
+
* Transforms this sink's input chunks. `f` must preserve chunking-invariance
|
79
|
+
* @tsplus fluent fncts.io.Sink contramapChunks
|
80
|
+
* @tsplus location "@fncts/io/Sink/api"
|
81
|
+
*/
|
82
|
+
export declare function contramapChunks<R, E, In, L, Z, In1>(self: Sink<R, E, In, L, Z>, f: (chunk: Conc<In1>) => Conc<In>, __tsplusTrace?: string): Sink<R, E, In1, L, Z>;
|
83
|
+
/**
|
84
|
+
* Effectfully transforms this sink's input chunks. `f` must preserve
|
85
|
+
* chunking-invariance
|
86
|
+
* @tsplus fluent fncts.io.Sink contramapChunksIO
|
9
87
|
* @tsplus location "@fncts/io/Sink/api"
|
10
88
|
*/
|
11
|
-
export declare function
|
89
|
+
export declare function contramapChunksIO<R, E, In, L, Z, R1, E1, In1>(self: Sink<R, E, In, L, Z>, f: (chunk: Conc<In1>) => IO<R1, E1, Conc<In>>, __tsplusTrace?: string): Sink<R & R1, E | E1, In1, L, Z>;
|
90
|
+
/**
|
91
|
+
* Effectfully transforms this sink's input elements.
|
92
|
+
* @tsplus fluent fncts.io.Sink contramapIO
|
93
|
+
* @tsplus location "@fncts/io/Sink/api"
|
94
|
+
*/
|
95
|
+
export declare function contramapIO<R, E, In, L, Z, R1, E1, In1>(self: Sink<R, E, In, L, Z>, f: (inp: In1) => IO<R1, E1, In>, __tsplusTrace?: string): Sink<R & R1, E | E1, In1, L, Z>;
|
96
|
+
/**
|
97
|
+
* Transforms both inputs and result of this sink using the provided
|
98
|
+
* functions.
|
99
|
+
* @tsplus fluent fncts.io.Sink dimap
|
100
|
+
* @tsplus location "@fncts/io/Sink/api"
|
101
|
+
*/
|
102
|
+
export declare function dimap<R, E, In, L, Z, In1, Z1>(self: Sink<R, E, In, L, Z>, f: (inp: In1) => In, g: (z: Z) => Z1, __tsplusTrace?: string): Sink<R, E, In1, L, Z1>;
|
103
|
+
/**
|
104
|
+
* Transforms both input chunks and result of this sink using the provided
|
105
|
+
* functions.
|
106
|
+
* @tsplus fluent fncts.io.Sink dimapChunks
|
107
|
+
* @tsplus location "@fncts/io/Sink/api"
|
108
|
+
*/
|
109
|
+
export declare function dimapChunks<R, E, In, L, Z, In1, Z1>(self: Sink<R, E, In, L, Z>, f: (chunk: Conc<In1>) => Conc<In>, g: (z: Z) => Z1, __tsplusTrace?: string): Sink<R, E, In1, L, Z1>;
|
110
|
+
/**
|
111
|
+
* Effectfully transforms both input chunks and result of this sink using the
|
112
|
+
* provided functions. `f` and `g` must preserve chunking-invariance
|
113
|
+
* @tsplus fluent fncts.io.Sink dimapChunksIO
|
114
|
+
* @tsplus location "@fncts/io/Sink/api"
|
115
|
+
*/
|
116
|
+
export declare function dimapChunksIO<R, E, In, L, Z, R1, E1, In1, R2, E2, Z1>(self: Sink<R, E, In, L, Z>, f: (chunk: Conc<In1>) => IO<R1, E1, Conc<In>>, g: (z: Z) => IO<R2, E2, Z1>, __tsplusTrace?: string): Sink<R & R1 & R2, E | E1 | E2, In1, L, Z1>;
|
117
|
+
/**
|
118
|
+
* Effectfully transforms both inputs and result of this sink using the
|
119
|
+
* provided functions.
|
120
|
+
* @tsplus fluent fncts.io.Sink dimapIO
|
121
|
+
* @tsplus location "@fncts/io/Sink/api"
|
122
|
+
*/
|
123
|
+
export declare function dimapIO<R, E, In, L, Z, R1, E1, In1, R2, E2, Z1>(self: Sink<R, E, In, L, Z>, f: (inp: In1) => IO<R1, E1, In>, g: (z: Z) => IO<R2, E2, Z1>, __tsplusTrace?: string): Sink<R & R1 & R2, E | E1 | E2, In1, L, Z1>;
|
124
|
+
/**
|
125
|
+
* Returns a lazily constructed sink that may require effects for its
|
126
|
+
* creation.
|
127
|
+
* @tsplus static fncts.io.SinkOps defer
|
128
|
+
* @tsplus location "@fncts/io/Sink/api"
|
129
|
+
*/
|
130
|
+
export declare function defer<R, E, In, L, Z>(sink: Lazy<Sink<R, E, In, L, Z>>, __tsplusTrace?: string): Sink<R, E, In, L, Z>;
|
12
131
|
/**
|
13
132
|
* A sink that ignores all of its inputs.
|
14
133
|
* @tsplus static fncts.io.SinkOps drain
|
@@ -16,20 +135,530 @@ export declare function collectAll<Err, A>(): Sink<unknown, Err, A, never, Conc<
|
|
16
135
|
*/
|
17
136
|
export declare const drain: Sink<unknown, never, unknown, never, void>;
|
18
137
|
/**
|
138
|
+
* Drops incoming elements until the predicate `p` is satisfied.
|
139
|
+
* @tsplus static fncts.io.SinkOps dropUntil
|
140
|
+
* @tsplus location "@fncts/io/Sink/api"
|
141
|
+
*/
|
142
|
+
export declare function makeDropUntil<In>(p: Predicate<In>, __tsplusTrace?: string): Sink<unknown, never, In, In, void>;
|
143
|
+
/**
|
144
|
+
* Drops incoming elements until the effectful predicate `p` is satisfied.
|
145
|
+
* @tsplus static fncts.io.SinkOps dropUntilIO
|
146
|
+
* @tsplus location "@fncts/io/Sink/api"
|
147
|
+
*/
|
148
|
+
export declare function makeDropUntilIO<R, E, In>(p: (inp: In) => IO<R, E, boolean>, __tsplusTrace?: string): Sink<R, E, In, In, void>;
|
149
|
+
/**
|
150
|
+
* Drops incoming elements as long as the predicate `p` is satisfied.
|
19
151
|
* @tsplus static fncts.io.SinkOps dropWhile
|
20
152
|
* @tsplus location "@fncts/io/Sink/api"
|
21
153
|
*/
|
22
|
-
export declare function
|
154
|
+
export declare function makeDropWhile<Err, In>(predicate: Predicate<In>, __tsplusTrace?: string): Sink<unknown, never, In, In, any>;
|
155
|
+
/**
|
156
|
+
* Drops incoming elements as long as the effectful predicate `p` is
|
157
|
+
* satisfied.
|
158
|
+
* @tsplus static fncts.io.SinkOps dropWhileIO
|
159
|
+
* @tsplus location "@fncts/io/Sink/api"
|
160
|
+
*/
|
161
|
+
export declare function dropWhileIO<R, E, In>(p: (inp: In) => IO<R, E, boolean>, __tsplusTrace?: string): Sink<R, E, In, In, void>;
|
162
|
+
/**
|
163
|
+
* Accesses the whole environment of the sink.
|
164
|
+
* @tsplus static fncts.io.SinkOps environment
|
165
|
+
* @tsplus location "@fncts/io/Sink/api"
|
166
|
+
*/
|
167
|
+
export declare function environment<R>(__tsplusTrace?: string): Sink<R, never, unknown, never, Environment<R>>;
|
168
|
+
/**
|
169
|
+
* Accesses the environment of the sink.
|
170
|
+
* @tsplus static fncts.io.SinkOps environmentWith
|
171
|
+
* @tsplus location "@fncts/io/Sink/api"
|
172
|
+
*/
|
173
|
+
export declare function environmentWith<R, Z>(f: (r: Environment<R>) => Z, __tsplusTrace?: string): Sink<R, never, unknown, never, Z>;
|
174
|
+
/**
|
175
|
+
* Accesses the environment of the sink in the context of an effect.
|
176
|
+
* @tsplus static fncts.io.SinkOps environmentWithIO
|
177
|
+
* @tsplus location "@fncts/io/Sink/api"
|
178
|
+
*/
|
179
|
+
export declare function environmentWithIO<R, R1, E, Z>(f: (r: Environment<R>) => IO<R1, E, Z>, __tsplusTrace?: string): Sink<R & R1, E, unknown, never, Z>;
|
180
|
+
/**
|
181
|
+
* Accesses the environment of the sink in the context of a sink.
|
182
|
+
* @tsplus static fncts.io.SinkOps environmentWithSink
|
183
|
+
* @tsplus location "@fncts/io/Sink/api"
|
184
|
+
*/
|
185
|
+
export declare function environmentWithSink<R, R1, E, In, L, Z>(f: (r: Environment<R>) => Sink<R1, E, In, L, Z>, __tsplusTrace?: string): Sink<R & R1, E, In, L, Z>;
|
186
|
+
/**
|
187
|
+
* A sink that always fails with the specified error.
|
188
|
+
* @tsplus static fncts.io.SinkOps fail
|
189
|
+
* @tsplus location "@fncts/io/Sink/api"
|
190
|
+
*/
|
191
|
+
export declare function fail<E>(e: Lazy<E>, __tsplusTrace?: string): Sink<unknown, E, unknown, never, never>;
|
192
|
+
/**
|
193
|
+
* Creates a sink halting with a specified cause.
|
194
|
+
* @tsplus static fncts.io.SinkOps failCause
|
195
|
+
* @tsplus location "@fncts/io/Sink/api"
|
196
|
+
*/
|
197
|
+
export declare function failCause<E>(cause: Lazy<Cause<E>>, __tsplusTrace?: string): Sink<unknown, E, unknown, never, never>;
|
198
|
+
/**
|
199
|
+
* Creates a sink halting with a specified cause.
|
200
|
+
* @tsplus static fncts.io.SinkOps failCauseNow
|
201
|
+
* @tsplus location "@fncts/io/Sink/api"
|
202
|
+
*/
|
203
|
+
export declare function failCauseNow<E>(cause: Cause<E>, __tsplusTrace?: string): Sink<unknown, E, unknown, never, never>;
|
204
|
+
/**
|
205
|
+
* A sink that always fails with the specified error.
|
206
|
+
* @tsplus static fncts.io.SinkOps failNow
|
207
|
+
* @tsplus location "@fncts/io/Sink/api"
|
208
|
+
*/
|
209
|
+
export declare function failNow<E>(e: E, __tsplusTrace?: string): Sink<unknown, E, unknown, never, never>;
|
210
|
+
/**
|
211
|
+
* Filters the sink's input with the given predicate
|
212
|
+
* @tsplus static fncts.io.SinkOps filterInput
|
213
|
+
* @tsplus location "@fncts/io/Sink/api"
|
214
|
+
*/
|
215
|
+
export declare function filterInput<R, E, In, L, Z>(self: Sink<R, E, In, L, Z>, p: Predicate<In>, __tsplusTrace?: string): Sink<R, E, In, L, Z>;
|
216
|
+
/**
|
217
|
+
* Filters the sink's input with the given IO predicate
|
218
|
+
* @tsplus static fncts.io.SinkOps filterInputIO
|
219
|
+
* @tsplus location "@fncts/io/Sink/api"
|
220
|
+
*/
|
221
|
+
export declare function filterInputIO<R, E, In, L, Z, R1, E1>(self: Sink<R, E, In, L, Z>, p: (inp: In) => IO<R1, E1, boolean>, __tsplusTrace?: string): Sink<R & R1, E | E1, In, L, Z>;
|
222
|
+
/**
|
223
|
+
* Creates a sink that produces values until one verifies the predicate `f`.
|
224
|
+
* @tsplus fluent fncts.io.Sink findIO
|
225
|
+
* @tsplus location "@fncts/io/Sink/api"
|
226
|
+
*/
|
227
|
+
export declare function findIO<R, E, In extends L, L, Z, R1, E1>(self: Sink<R, E, In, L, Z>, f: (z: Z) => IO<R1, E1, boolean>, __tsplusTrace?: string): Sink<R & R1, E | E1, In, L, Maybe<Z>>;
|
228
|
+
/**
|
229
|
+
* Runs this sink until it yields a result, then uses that result to create
|
230
|
+
* another sink from the provided function which will continue to run until it
|
231
|
+
* yields a result.
|
232
|
+
*
|
233
|
+
* This function essentially runs sinks in sequence.
|
234
|
+
* @tsplus fluent fncts.io.Sink flatMap
|
235
|
+
* @tsplus location "@fncts/io/Sink/api"
|
236
|
+
*/
|
237
|
+
export declare function flatMap<R, E, In, L, Z, R1, E1, In1 extends In, L1, Z1>(self: Sink<R, E, In, L, Z>, f: (z: Z) => Sink<R1, E1, In1, L1, Z1>, __tsplusTrace?: string): Sink<R & R1, E | E1, In1, L | L1, Z1>;
|
238
|
+
/**
|
239
|
+
* Creates a sink from a {@link Channel }
|
240
|
+
* @tsplus static fncts.io.SinkOps fromChannel
|
241
|
+
* @tsplus static fncts.io.SinkOps __call
|
242
|
+
* @tsplus location "@fncts/io/Sink/api"
|
243
|
+
*/
|
244
|
+
export declare function fromChannel<R, E, In, L, Z>(channel: Channel<R, never, Conc<In>, unknown, E, Conc<L>, Z>): Sink<R, E, In, L, Z>;
|
245
|
+
/**
|
246
|
+
* Creates a sink from a chunk processing function.
|
247
|
+
* @tsplus static fncts.io.SinkOps fromPush
|
248
|
+
* @tsplus location "@fncts/io/Sink/api"
|
249
|
+
*/
|
250
|
+
export declare function fromPush<R, E, In, L, Z, R1>(push: IO<Has<Scope> & R, never, (_: Maybe<Conc<In>>) => IO<R1, readonly [Either<E, Z>, Conc<L>], void>>, __tsplusTrace?: string): Sink<R & R1, E, In, L, Z>;
|
251
|
+
/**
|
252
|
+
* Create a sink which enqueues each element into the specified queue.
|
253
|
+
* @tsplus static fncts.io.SinkOps fromQueue
|
254
|
+
* @tsplus location "@fncts/io/Sink/api"
|
255
|
+
*/
|
256
|
+
export declare function fromQueue<In>(queue: Lazy<Queue.Enqueue<In>>, __tsplusTrace?: string): Sink<unknown, never, In, never, void>;
|
257
|
+
/**
|
258
|
+
* Create a sink which enqueues each element into the specified queue. The
|
259
|
+
* queue will be shutdown once the stream is closed.
|
260
|
+
* @tsplus static fncts.io.SinkOps fromQueueWithShutdown
|
261
|
+
* @tsplus location "@fncts/io/Sink/api"
|
262
|
+
*/
|
263
|
+
export declare function fromQueueWithShutdown<In>(queue: Lazy<Queue.Enqueue<In>>, __tsplusTrace?: string): Sink<unknown, never, In, never, void>;
|
264
|
+
/**
|
265
|
+
* Create a sink which publishes each element to the specified hub.
|
266
|
+
* @tsplus static fncts.io.SinkOps fromHub
|
267
|
+
* @tsplus location "@fncts/io/Sink/api"
|
268
|
+
*/
|
269
|
+
export declare function fromHub<In>(hub: Lazy<Hub<In>>, __tsplusTrace?: string): Sink<unknown, never, In, never, void>;
|
270
|
+
/**
|
271
|
+
* Create a sink which publishes each element to the specified hub. The hub
|
272
|
+
* will be shutdown once the stream is closed.
|
273
|
+
* @tsplus static fncts.io.SinkOps fromHubWithShutdown
|
274
|
+
* @tsplus location "@fncts/io/Sink/api"
|
275
|
+
*/
|
276
|
+
export declare function fromHubWithShutdown<In>(hub: Lazy<Hub<In>>, __tsplusTrace?: string): Sink<unknown, never, In, never, void>;
|
277
|
+
/**
|
278
|
+
* Creates a single-value sink produced from an effect
|
279
|
+
* @tsplus static fncts.io.SinkOps fromIO
|
280
|
+
* @tsplus location "@fncts/io/Sink/api"
|
281
|
+
*/
|
282
|
+
export declare function fromIO<R, E, Z>(b: Lazy<IO<R, E, Z>>, __tsplusTrace?: string): Sink<R, E, unknown, never, Z>;
|
283
|
+
/**
|
284
|
+
* Creates a sink halting with the specified unchecked value.
|
285
|
+
* @tsplus static fncts.io.SinkOps halt
|
286
|
+
* @tsplus location "@fncts/io/Sink/api"
|
287
|
+
*/
|
288
|
+
export declare function halt(defect: Lazy<unknown>, __tsplusTrace?: string): Sink<unknown, never, unknown, never, never>;
|
289
|
+
/**
|
290
|
+
* Creates a sink halting with the specified unchecked value.
|
291
|
+
* @tsplus static fncts.io.SinkOps haltNow
|
292
|
+
* @tsplus location "@fncts/io/Sink/api"
|
293
|
+
*/
|
294
|
+
export declare function haltNow(defect: unknown, __tsplusTrace?: string): Sink<unknown, never, unknown, never, never>;
|
295
|
+
/**
|
296
|
+
* Creates a sink containing the first value.
|
297
|
+
* @tsplus static fncts.io.SinkOps head
|
298
|
+
* @tsplus location "@fncts/io/Sink/api"
|
299
|
+
*/
|
300
|
+
export declare function head<In>(__tsplusTrace?: string): Sink<unknown, never, In, In, Maybe<In>>;
|
301
|
+
/**
|
302
|
+
* Drains the remaining elements from the stream after the sink finishes
|
303
|
+
* @tsplus getter fncts.io.Sink ignoreLeftover
|
304
|
+
* @tsplus location "@fncts/io/Sink/api"
|
305
|
+
*/
|
306
|
+
export declare function ignoreLeftover<R, E, In, L, Z>(self: Sink<R, E, In, L, Z>, __tsplusTrace?: string): Sink<R, E, In, never, Z>;
|
307
|
+
/**
|
308
|
+
* Creates a sink containing the last value.
|
309
|
+
* @tsplus static fncts.io.SinkOps last
|
310
|
+
* @tsplus location "@fncts/io/Sink/api"
|
311
|
+
*/
|
312
|
+
export declare function last<In>(__tsplusTrace?: string): Sink<unknown, never, In, In, Maybe<In>>;
|
313
|
+
/**
|
314
|
+
* Creates a sink that does not consume any input but provides the given chunk
|
315
|
+
* as its leftovers
|
316
|
+
* @tsplus static fncts.io.SinkOps leftover
|
317
|
+
* @tsplus location "@fncts/io/Sink/api"
|
318
|
+
*/
|
319
|
+
export declare function leftover<L>(c: Lazy<Conc<L>>, __tsplusTrace?: string): Sink<unknown, never, unknown, L, void>;
|
320
|
+
/**
|
321
|
+
* Logs the specified message at the current log level.
|
322
|
+
* @tsplus static fncts.io.SinkOps log
|
323
|
+
* @tsplus location "@fncts/io/Sink/api"
|
324
|
+
*/
|
325
|
+
export declare function log(message: Lazy<string>, __tsplusTrace?: string): Sink<unknown, never, unknown, never, void>;
|
326
|
+
/**
|
327
|
+
* A sink that collects all of its inputs into a chunk.
|
328
|
+
* @tsplus static fncts.io.SinkOps collectAll
|
329
|
+
* @tsplus location "@fncts/io/Sink/api"
|
330
|
+
*/
|
331
|
+
export declare function makeCollectAll<In>(): Sink<unknown, never, In, never, Conc<In>>;
|
332
|
+
/**
|
333
|
+
* A sink that collects first `n` elements into a chunk. Note that the chunk
|
334
|
+
* is preallocated and must fit in memory.
|
335
|
+
* @tsplus static fncts.io.SinkOps collectAllN
|
336
|
+
* @tsplus location "@fncts/io/Sink/api"
|
337
|
+
*/
|
338
|
+
export declare function makeCollectAllN<In>(n: Lazy<number>): Sink<unknown, never, In, In, Conc<In>>;
|
23
339
|
/**
|
24
340
|
* A sink that executes the provided effectful function for every element fed to it.
|
25
341
|
* @tsplus static fncts.io.SinkOps foreach
|
26
342
|
* @tsplus location "@fncts/io/Sink/api"
|
27
343
|
*/
|
28
|
-
export declare function
|
344
|
+
export declare function makeForeach<R, Err, In>(f: (inp: In) => IO<R, Err, any>, __tsplusTrace?: string): Sink<R, Err, In, In, void>;
|
345
|
+
/**
|
346
|
+
* A sink that executes the provided effectful function for every chunk fed to
|
347
|
+
* it.
|
348
|
+
* @tsplus static fncts.io.SinkOps foreachChunk
|
349
|
+
* @tsplus location "@fncts/io/Sink/api"
|
350
|
+
*/
|
351
|
+
export declare function makeForeachChunk<R, E, In>(f: (inp: Conc<In>) => IO<R, E, void>, __tsplusTrace?: string): Sink<R, E, In, never, void>;
|
29
352
|
/**
|
30
353
|
* A sink that executes the provided effectful function for every element fed to it
|
31
354
|
* until `f` evaluates to `false`.
|
32
355
|
* @tsplus static fncts.io.SinkOps foreachWhile
|
33
356
|
* @tsplus location "@fncts/io/Sink/api"
|
34
357
|
*/
|
35
|
-
export declare function
|
358
|
+
export declare function makeForeachWhile<R, Err, In>(f: (_: In) => IO<R, Err, boolean>, __tsplusTrace?: string): Sink<R, Err, In, In, void>;
|
359
|
+
/**
|
360
|
+
* A sink that executes the provided effectful function for every chunk fed to
|
361
|
+
* it until `f` evaluates to `false`.
|
362
|
+
* @tsplus static fncts.io.SinkOps foreachChunkWhile
|
363
|
+
* @tsplus location "@fncts/io/Sink/api"
|
364
|
+
*/
|
365
|
+
export declare function makeForeachChunkWhile<R, E, In>(f: (chunk: Conc<In>) => IO<R, E, boolean>, __tsplusTrace?: string): Sink<R, E, In, In, void>;
|
366
|
+
/**
|
367
|
+
* A sink that folds its inputs with the provided function, termination
|
368
|
+
* predicate and initial state.
|
369
|
+
* @tsplus static fncts.io.SinkOps fold
|
370
|
+
* @tsplus location "@fncts/io/Sink/api"
|
371
|
+
*/
|
372
|
+
export declare function makeFold<In, S>(z: Lazy<S>, contFn: Predicate<S>, f: (s: S, inp: In) => S, __tsplusTrace?: string): Sink<unknown, never, In, In, S>;
|
373
|
+
/**
|
374
|
+
* Creates a sink that folds elements of type `In` into a structure of type
|
375
|
+
* `S` until `max` elements have been folded.
|
376
|
+
*
|
377
|
+
* Like {@link foldWeighted }, but with a constant cost function of 1.
|
378
|
+
* @tsplus static fncts.io.SinkOps foldUntil
|
379
|
+
* @tsplus location "@fncts/io/Sink/api"
|
380
|
+
*/
|
381
|
+
export declare function makeFoldUntil<In, S>(z: Lazy<S>, max: Lazy<number>, f: (s: S, inp: In) => S, __tsplusTrace?: string): Sink<unknown, never, In, In, S>;
|
382
|
+
/**
|
383
|
+
* A sink that folds its input chunks with the provided function, termination
|
384
|
+
* predicate and initial state. `contFn` condition is checked only for the
|
385
|
+
* initial value and at the end of processing of each chunk. `f` and `contFn`
|
386
|
+
* must preserve chunking-invariance.
|
387
|
+
* @tsplus static fncts.io.SinkOps foldChunks
|
388
|
+
* @tsplus location "@fncts/io/Sink/api"
|
389
|
+
*/
|
390
|
+
export declare function makeFoldChunks<In, S>(z: Lazy<S>, contFn: Predicate<S>, f: (s: S, inp: Conc<In>) => S, __tsplusTrace?: string): Sink<unknown, never, In, never, S>;
|
391
|
+
/**
|
392
|
+
* A sink that effectfully folds its input chunks with the provided function,
|
393
|
+
* termination predicate and initial state. `contFn` condition is checked only
|
394
|
+
* for the initial value and at the end of processing of each chunk. `f` and
|
395
|
+
* `contFn` must preserve chunking-invariance.
|
396
|
+
* @tsplus static fncts.io.SinkOps foldChunksIO
|
397
|
+
* @tsplus location "@fncts/io/Sink/api"
|
398
|
+
*/
|
399
|
+
export declare function makeFoldChunksIO<Env, Err, In, S>(z: Lazy<S>, contFn: Predicate<S>, f: (s: S, inp: Conc<In>) => IO<Env, Err, S>, __tsplusTrace?: string): Sink<Env, Err, In, In, S>;
|
400
|
+
/**
|
401
|
+
* A sink that folds its inputs with the provided function and initial state.
|
402
|
+
* @tsplus static fncts.io.SinkOps foldLeft
|
403
|
+
* @tsplus location "@fncts/io/Sink/api"
|
404
|
+
*/
|
405
|
+
export declare function makeFoldLeft<In, S>(z: Lazy<S>, f: (s: S, inp: In) => S): Sink<unknown, never, In, never, S>;
|
406
|
+
/**
|
407
|
+
* A sink that folds its input chunks with the provided function and initial
|
408
|
+
* state. `f` must preserve chunking-invariance.
|
409
|
+
* @tsplus static fncts.io.SinkOps foldLeftChunks
|
410
|
+
* @tsplus location "@fncts/io/Sink/api"
|
411
|
+
*/
|
412
|
+
export declare function makeFoldLeftChunks<In, S>(z: Lazy<S>, f: (s: S, inp: Conc<In>) => S): Sink<unknown, never, In, never, S>;
|
413
|
+
/**
|
414
|
+
* A sink that effectfully folds its input chunks with the provided function
|
415
|
+
* and initial state. `f` must preserve chunking-invariance.
|
416
|
+
* @tsplus static fncts.io.SinkOps foldLeftChunksIO
|
417
|
+
* @tsplus location "@fncts/io/Sink/api"
|
418
|
+
*/
|
419
|
+
export declare function makeFoldLeftChunksIO<R, E, In, S>(z: Lazy<S>, f: (s: S, inp: Conc<In>) => IO<R, E, S>, __tsplusTrace?: string): Sink<R, E, In, In, S>;
|
420
|
+
/**
|
421
|
+
* A sink that effectfully folds its inputs with the provided function and
|
422
|
+
* initial state.
|
423
|
+
* @tsplus static fncts.io.SinkOps foldLeftIO
|
424
|
+
* @tsplus location "@fncts/io/Sink/api"
|
425
|
+
*/
|
426
|
+
export declare function makeFoldLeftIO<R, E, In, S>(z: Lazy<S>, f: (s: S, inp: In) => IO<R, E, S>, __tsplusTrace?: string): Sink<R, E, In, In, S>;
|
427
|
+
/**
|
428
|
+
* A sink that effectfully folds its inputs with the provided function,
|
429
|
+
* termination predicate and initial state.
|
430
|
+
* @tsplus static fncts.io.SinkOps foldIO
|
431
|
+
* @tsplus location "@fncts/io/Sink/api"
|
432
|
+
*/
|
433
|
+
export declare function makeFoldIO<R, E, In, S>(z: Lazy<S>, contFn: Predicate<S>, f: (s: S, inp: In) => IO<R, E, S>): Sink<R, E, In, In, S>;
|
434
|
+
/**
|
435
|
+
* Creates a sink that effectfully folds elements of type `In` into a
|
436
|
+
* structure of type `S` until `max` elements have been folded.
|
437
|
+
*
|
438
|
+
* Like {@link makeFoldWeightedIO }, but with a constant cost function of 1.
|
439
|
+
* @tsplus static fncts.io.SinkOps foldUntilIO
|
440
|
+
* @tsplus location "@fncts/io/Sink/api"
|
441
|
+
*/
|
442
|
+
export declare function makeFoldUntilIO<R, E, In, S>(z: Lazy<S>, max: Lazy<number>, f: (s: S, inp: In) => IO<R, E, S>, __tsplusTrace?: string): Sink<R, E, In, In, S>;
|
443
|
+
/**
|
444
|
+
* Creates a sink that folds elements of type `In` into a structure of type
|
445
|
+
* `S`, until `max` worth of elements (determined by the `costFn`) have been
|
446
|
+
* folded.
|
447
|
+
*
|
448
|
+
* The `decompose` function will be used for decomposing elements that cause
|
449
|
+
* an `S` aggregate to cross `max` into smaller elements.
|
450
|
+
*
|
451
|
+
*
|
452
|
+
* Be vigilant with this function, it has to generate "simpler" values or the
|
453
|
+
* fold may never end. A value is considered indivisible if `decompose` yields
|
454
|
+
* the empty chunk or a single-valued chunk. In these cases, there is no other
|
455
|
+
* choice than to yield a value that will cross the threshold.
|
456
|
+
*
|
457
|
+
* The {@link makeFoldWeightedDecomposeIO } allows the decompose function to return a
|
458
|
+
* `IO` value, and consequently it allows the sink to fail.
|
459
|
+
* @tsplus static fncts.io.SinkOps foldWeightedDecompose
|
460
|
+
* @tsplus location "@fncts/io/Sink/api"
|
461
|
+
*/
|
462
|
+
export declare function makeFoldWeightedDecompose<In, S>(z: Lazy<S>, costFn: (s: S, inp: In) => number, max: Lazy<number>, decompose: (inp: In) => Conc<In>, f: (s: S, inp: In) => S, __tsplusTrace?: string): Sink<unknown, never, In, In, S>;
|
463
|
+
/**
|
464
|
+
* Creates a sink that effectfully folds elements of type `In` into a
|
465
|
+
* structure of type `S`, until `max` worth of elements (determined by the
|
466
|
+
* `costFn`) have been folded.
|
467
|
+
*
|
468
|
+
* The `decompose` function will be used for decomposing elements that cause
|
469
|
+
* an `S` aggregate to cross `max` into smaller elements. Be vigilant with
|
470
|
+
* this function, it has to generate "simpler" values or the fold may never
|
471
|
+
* end. A value is considered indivisible if `decompose` yields the empty
|
472
|
+
* chunk or a single-valued chunk. In these cases, there is no other choice
|
473
|
+
* than to yield a value that will cross the threshold.
|
474
|
+
* @tsplus static fncts.io.SinkOps foldWeightedDecomposeIO
|
475
|
+
* @tsplus location "@fncts/io/Sink/api"
|
476
|
+
*/
|
477
|
+
export declare function makeFoldWeightedDecomposeIO<R, E, In, S, R1, E1, R2, E2>(z: Lazy<S>, costFn: (s: S, inp: In) => IO<R1, E1, number>, max: Lazy<number>, decompose: (inp: In) => IO<R2, E2, Conc<In>>, f: (s: S, inp: In) => IO<R, E, S>, __tsplusTrace?: string): Sink<R & R1 & R2, E | E1 | E2, In, In, S>;
|
478
|
+
/**
|
479
|
+
* Creates a sink that folds elements of type `In` into a structure of type
|
480
|
+
* `S`, until `max` worth of elements (determined by the `costFn`) have been
|
481
|
+
* folded.
|
482
|
+
* @note Elements that have an individual cost larger than `max` will force the
|
483
|
+
sink to cross the `max` cost. See {@link makeFoldWeightedDecompose } for a variant
|
484
|
+
that can handle these cases.
|
485
|
+
* @tsplus static fncts.io.SinkOps foldWeighted
|
486
|
+
* @tsplus location "@fncts/io/Sink/api"
|
487
|
+
*/
|
488
|
+
export declare function makeFoldWeighted<In, S>(z: Lazy<S>, costFn: (s: S, inp: In) => number, max: Lazy<number>, f: (s: S, inp: In) => S, __tsplusTrace?: string): Sink<unknown, never, In, In, S>;
|
489
|
+
/**
|
490
|
+
* Creates a sink that effectfully folds elements of type `In` into a
|
491
|
+
* structure of type `S`, until `max` worth of elements (determined by the
|
492
|
+
* `costFn`) have been folded.
|
493
|
+
* @note Elements that have an individual cost larger than `max` will force the
|
494
|
+
sink to cross the `max` cost. See {@link makeFoldWeightedDecomposeIO } for a
|
495
|
+
variant that can handle these cases.
|
496
|
+
* @tsplus static fncts.io.SinkOps foldWeightedIO
|
497
|
+
* @tsplus location "@fncts/io/Sink/api"
|
498
|
+
*/
|
499
|
+
export declare function makeFoldWeightedIO<R, E, In, S, R1, E1>(z: Lazy<S>, costFn: (s: S, inp: In) => IO<R, E, number>, max: Lazy<number>, f: (s: S, inp: In) => IO<R1, E1, S>, __tsplusTrace?: string): Sink<R & R1, E | E1, In, In, S>;
|
500
|
+
/**
|
501
|
+
* Transforms this sink's result.
|
502
|
+
* @tsplus fluent fncts.io.Sink map
|
503
|
+
* @tsplus location "@fncts/io/Sink/api"
|
504
|
+
*/
|
505
|
+
export declare function map_<R, E, In, L, Z, Z1>(self: Sink<R, E, In, L, Z>, f: (z: Z) => Z1, __tsplusTrace?: string): Sink<R, E, In, L, Z1>;
|
506
|
+
/**
|
507
|
+
* Transforms the errors emitted by this sink using `f`.
|
508
|
+
* @tsplus fluent fncts.io.Sink mapError
|
509
|
+
* @tsplus location "@fncts/io/Sink/api"
|
510
|
+
*/
|
511
|
+
export declare function mapError_<R, E, In, L, Z, E1>(self: Sink<R, E, In, L, Z>, f: (e: E) => E1, __tsplusTrace?: string): Sink<R, E1, In, L, Z>;
|
512
|
+
/**
|
513
|
+
* Effectfully transforms this sink's result.
|
514
|
+
* @tsplus fluent fncts.io.Sink mapIO
|
515
|
+
* @tsplus location "@fncts/io/Sink/api"
|
516
|
+
*/
|
517
|
+
export declare function mapIO_<R, E, In, L, Z, R1, E1, Z1>(self: Sink<R, E, In, L, Z>, f: (z: Z) => IO<R1, E1, Z1>, __tsplusTrace?: string): Sink<R & R1, E | E1, In, L, Z1>;
|
518
|
+
/**
|
519
|
+
* Runs this sink until it yields a result, then uses that result to create
|
520
|
+
* another sink from the provided function which will continue to run until it
|
521
|
+
* yields a result.
|
522
|
+
*
|
523
|
+
* This function essentially runs sinks in sequence.
|
524
|
+
* @tsplus fluent fncts.io.Sink matchSink
|
525
|
+
* @tsplus location "@fncts/io/Sink/api"
|
526
|
+
*/
|
527
|
+
export declare function matchSink_<R, E, In, L, Z, R1, E1, In1 extends In, L1, Z1, R2, E2, In2 extends In, L2, Z2>(self: Sink<R, E, In, L, Z>, onFailure: (e: E) => Sink<R1, E1, In1, L1, Z1>, onSuccess: (z: Z) => Sink<R2, E2, In2, L2, Z2>, __tsplusTrace?: string): Sink<R & R1 & R2, E1 | E2, In1 & In2, L | L1 | L2, Z1 | Z2>;
|
528
|
+
/**
|
529
|
+
* Switch to another sink in case of failure
|
530
|
+
* @tsplus fluent fncts.io.Sink orElse
|
531
|
+
* @tsplus location "@fncts/io/Sink/api"
|
532
|
+
*/
|
533
|
+
export declare function orElse<R, E, In, L, Z, R1, E1, In1, L1, Z1>(self: Sink<R, E, In, L, Z>, that: Lazy<Sink<R1, E1, In1, L1, Z1>>, __tsplusTrace?: string): Sink<R & R1, E | E1, In & In1, L | L1, Z | Z1>;
|
534
|
+
/**
|
535
|
+
* Provides the sink with its required environment, which eliminates its
|
536
|
+
* dependency on `R`.
|
537
|
+
* @tsplus fluent fncts.io.Sink provideEnvironment
|
538
|
+
* @tsplus location "@fncts/io/Sink/api"
|
539
|
+
*/
|
540
|
+
export declare function provideEnvironment<R, E, In, L, Z>(self: Sink<R, E, In, L, Z>, r: Lazy<Environment<R>>, __tsplusTrace?: string): Sink<unknown, E, In, L, Z>;
|
541
|
+
/**
|
542
|
+
* Runs both sinks in parallel on the input, returning the result or the
|
543
|
+
* error from the one that finishes first.
|
544
|
+
* @tsplus fluent fncts.io.Sink race
|
545
|
+
* @tsplus location "@fncts/io/Sink/api"
|
546
|
+
*/
|
547
|
+
export declare function race<R, E, In, L, Z, R1, E1, In1, L1, Z1>(self: Sink<R, E, In, L, Z>, that: Lazy<Sink<R1, E1, In1, L1, Z1>>, __tsplusTrace?: string): Sink<R & R1, E | E1, In & In1, L | L1, Z | Z1>;
|
548
|
+
/**
|
549
|
+
* Runs both sinks in parallel on the input, returning the result or the error
|
550
|
+
* from the one that finishes first.
|
551
|
+
* @tsplus fluent fncts.io.Sink raceBoth
|
552
|
+
* @tsplus location "@fncts/io/Sink/api"
|
553
|
+
*/
|
554
|
+
export declare function raceBoth<R, E, In, L, Z, R1, E1, In1, L1, Z1>(self: Sink<R, E, In, L, Z>, that: Lazy<Sink<R1, E1, In1, L1, Z1>>, capacity?: Lazy<number>, __tsplusTrace?: string): Sink<R & R1, E | E1, In & In1, L | L1, Either<Z, Z1>>;
|
555
|
+
/**
|
556
|
+
* Runs both sinks in parallel on the input, using the specified merge
|
557
|
+
* function as soon as one result or the other has been computed.
|
558
|
+
* @tsplus fluent fncts.io.Sink raceWith
|
559
|
+
* @tsplus location "@fncts/io/Sink/api"
|
560
|
+
*/
|
561
|
+
export declare function raceWith<R, E, In, L, Z, R1, E1, In1, L1, Z1, R2, E2, Z2, R3, E3, Z3>(self: Sink<R, E, In, L, Z>, that: Lazy<Sink<R1, E1, In1, L1, Z1>>, leftDone: (exit: Exit<E, Z>) => MergeDecision<R1, E1, Z1, E2, Z2>, rightDone: (exit: Exit<E1, Z1>) => MergeDecision<R, E, Z, E3, Z3>, capacity?: Lazy<number>, __tsplusTrace?: string): Sink<R & R1 & R2 & R3, E2 | E3, In & In1, L | L1, Z2 | Z3>;
|
562
|
+
/**
|
563
|
+
* Accesses the specified service in the environment of the effect.
|
564
|
+
* @tsplus static fncts.io.SinkOps service
|
565
|
+
* @tsplus location "@fncts/io/Sink/api"
|
566
|
+
*/
|
567
|
+
export declare function service<S>(/** @tsplus auto */ tag: Tag<S>): Sink<Has<S>, never, unknown, never, S>;
|
568
|
+
/**
|
569
|
+
* Accesses the specified service in the environment of the sink.
|
570
|
+
* @tsplus static fncts.io.SinkOps serviceWith
|
571
|
+
* @tsplus location "@fncts/io/Sink/api"
|
572
|
+
*/
|
573
|
+
export declare function serviceWith<S, Z>(f: (service: S) => Z,
|
574
|
+
/** @tsplus auto */ tag: Tag<S>): Sink<Has<S>, never, unknown, never, Z>;
|
575
|
+
/**
|
576
|
+
* Accesses the specified service in the environment of the sink in the
|
577
|
+
* context of an effect.
|
578
|
+
* @tsplus static fncts.io.SinkOps serviceWithIO
|
579
|
+
* @tsplus location "@fncts/io/Sink/api"
|
580
|
+
*/
|
581
|
+
export declare function serviceWithIO<S, R, E, Z>(f: (service: S) => IO<R, E, Z>,
|
582
|
+
/** @tsplus auto */ tag: Tag<S>): Sink<Has<S> & R, E, unknown, never, Z>;
|
583
|
+
/**
|
584
|
+
* Accesses the specified service in the environment of the sink in the
|
585
|
+
* context of a sink.
|
586
|
+
* @tsplus static fncts.io.SinkOps serviceWithSink
|
587
|
+
* @tsplus location "@fncts/io/Sink/api"
|
588
|
+
*/
|
589
|
+
export declare function serviceWithSink<S, R, E, In, L, Z>(f: (service: S) => Sink<R, E, In, L, Z>,
|
590
|
+
/** @tsplus auto */ tag: Tag<S>): Sink<Has<S> & R, E, In, L, Z>;
|
591
|
+
/**
|
592
|
+
* Splits the sink on the specified predicate, returning a new sink that
|
593
|
+
* consumes elements until an element after the first satisfies the specified
|
594
|
+
* predicate.
|
595
|
+
* @tsplus fluent fncts.io.Sink splitWhere
|
596
|
+
* @tsplus location "@fncts/io/Sink/api"
|
597
|
+
*/
|
598
|
+
export declare function splitWhere<R, E, In, L extends In, Z>(self: Sink<R, E, In, L, Z>, p: Predicate<In>, __tsplusTrace?: string): Sink<R, E, In, In, Z>;
|
599
|
+
/**
|
600
|
+
* A sink that immediately ends with the specified value.
|
601
|
+
* @tsplus static fncts.io.SinkOps succeed
|
602
|
+
* @tsplus location "@fncts/io/Sink/api"
|
603
|
+
*/
|
604
|
+
export declare function succeed<Z>(z: Lazy<Z>, __tsplusTrace?: string): Sink<unknown, never, unknown, never, Z>;
|
605
|
+
/**
|
606
|
+
* A sink that immediately ends with the specified value.
|
607
|
+
* @tsplus static fncts.io.SinkOps succeedNow
|
608
|
+
* @tsplus location "@fncts/io/Sink/api"
|
609
|
+
*/
|
610
|
+
export declare function succeedNow<Z>(z: Z, __tsplusTrace?: string): Sink<unknown, never, unknown, never, Z>;
|
611
|
+
/**
|
612
|
+
* Summarize a sink by running an effect when the sink starts and again when
|
613
|
+
* it completes
|
614
|
+
* @tsplus fluent fncts.io.Sink summarized
|
615
|
+
* @tsplus location "@fncts/io/Sink/api"
|
616
|
+
*/
|
617
|
+
export declare function summarized<R, E, In, L, Z, R1, E1, B, C>(self: Sink<R, E, In, L, Z>, summary: Lazy<IO<R1, E1, B>>, f: (b1: B, b2: B) => C, __tsplusTrace?: string): Sink<R & R1, E | E1, In, L, readonly [Z, C]>;
|
618
|
+
/**
|
619
|
+
* @tsplus getter fncts.io.Sink timed
|
620
|
+
* @tsplus location "@fncts/io/Sink/api"
|
621
|
+
*/
|
622
|
+
export declare function timed<R, E, In, L, Z>(self: Sink<R, E, In, L, Z>, __tsplusTrace?: string): Sink<R, E, In, L, readonly [Z, Duration]>;
|
623
|
+
/**
|
624
|
+
* Creates a sink produced from an effect.
|
625
|
+
* @tsplus static fncts.io.SinkOps unwrap
|
626
|
+
* @tsplus location "@fncts/io/Sink/api"
|
627
|
+
*/
|
628
|
+
export declare function unwrap<R, E, R1, E1, In, L, Z>(io: Lazy<IO<R, E, Sink<R1, E1, In, L, Z>>>): Sink<R & R1, E | E1, In, L, Z>;
|
629
|
+
/**
|
630
|
+
* Creates a sink produced from a scoped effect.
|
631
|
+
* @tsplus static fncts.io.SinkOps unwrapScoped
|
632
|
+
* @tsplus location "@fncts/io/Sink/api"
|
633
|
+
*/
|
634
|
+
export declare function unwrapScoped<R, E, R1, E1, In, L, Z>(scoped: Lazy<IO<Has<Scope> & R, E, Sink<R1, E1, In, L, Z>>>, __tsplusTrace?: string): Sink<R & R1, E | E1, In, L, Z>;
|
635
|
+
/**
|
636
|
+
* Feeds inputs to this sink until it yields a result, then switches over to
|
637
|
+
* the provided sink until it yields a result, finally combining the two
|
638
|
+
* results into a tuple.
|
639
|
+
* @tsplus fluent fncts.io.Sink zip
|
640
|
+
* @tsplus location "@fncts/io/Sink/api"
|
641
|
+
*/
|
642
|
+
export declare function zip<R, E, In, L, Z, R1, E1, In1 extends In, L1 extends L, Z1>(self: Sink<R, E, In, L, Z>, that: Lazy<Sink<R1, E1, In1, L1, Z1>>, __tsplusTrace?: string): Sink<R & R1, E | E1, In & In1, L | L1, readonly [Z, Z1]>;
|
643
|
+
/**
|
644
|
+
* Runs both sinks in parallel on the input and combines the results in a
|
645
|
+
* tuple.
|
646
|
+
* @tsplus fluent fncts.io.Sink zipC
|
647
|
+
* @tsplus location "@fncts/io/Sink/api"
|
648
|
+
*/
|
649
|
+
export declare function zipC<R, E, In, L, Z, R1, E1, In1 extends In, L1 extends L, Z1>(self: Sink<R, E, In, L, Z>, that: Lazy<Sink<R1, E1, In1, L1, Z1>>, __tsplusTrace?: string): Sink<R & R1, E | E1, In & In1, L | L1, readonly [Z, Z1]>;
|
650
|
+
/**
|
651
|
+
* Feeds inputs to this sink until it yields a result, then switches over to
|
652
|
+
* the provided sink until it yields a result, finally combining the two
|
653
|
+
* results with `f`.
|
654
|
+
* @tsplus fluent fncts.io.Sink zipWith
|
655
|
+
* @tsplus location "@fncts/io/Sink/api"
|
656
|
+
*/
|
657
|
+
export declare function zipWith<R, E, In, L, Z, R1, E1, In1 extends In, L1 extends L, Z1, Z2>(self: Lazy<Sink<R, E, In, L, Z>>, that: Lazy<Sink<R1, E1, In1, L1, Z1>>, f: (z: Z, z1: Z1) => Z2, __tsplusTrace?: string): Sink<R & R1, E | E1, In & In1, L | L1, Z2>;
|
658
|
+
/**
|
659
|
+
* Runs both sinks in parallel on the input and combines the results using the
|
660
|
+
* provided function.
|
661
|
+
* @tsplus fluent fncts.io.Sink zipWithC
|
662
|
+
* @tsplus location "@fncts/io/Sink/api"
|
663
|
+
*/
|
664
|
+
export declare function zipWithC<R, E, In, L, Z, R1, E1, In1, L1, Z1, Z2>(self: Lazy<Sink<R, E, In, L, Z>>, that: Lazy<Sink<R1, E1, In1, L1, Z1>>, f: (z: Z, z1: Z1) => Z2, __tsplusTrace?: string): Sink<R & R1, E | E1, In & In1, L | L1, Z2>;
|