@fncts/io 0.0.34 → 0.0.36
Sign up to get free protection for your applications and to get access to all the features.
- package/Fiber/FiberRuntime.d.ts +7 -7
- package/Fiber/constructors.d.ts +5 -0
- package/IO/api/all.d.ts +41 -0
- package/IO/api/concurrency.d.ts +11 -0
- package/IO/api/interrupt.d.ts +1 -1
- package/IO/api/raceWith.d.ts +2 -1
- package/IO/api.d.ts +7 -2
- package/IO/definition.d.ts +103 -127
- package/IO.d.ts +1 -0
- package/Push/api.d.ts +86 -36
- package/Push/definition.d.ts +28 -13
- package/Push/internal.d.ts +7 -11
- package/RefSubject/Atomic.d.ts +8 -11
- package/RefSubject/Synchronized/definition.d.ts +4 -6
- package/RefSubject/api.d.ts +0 -1
- package/RefSubject/definition.d.ts +6 -8
- package/STM/definition.d.ts +19 -2
- package/Sink/api.d.ts +24 -24
- package/Subject/Atomic.d.ts +4 -6
- package/Subject/definition.d.ts +2 -2
- package/_cjs/Channel/api/runScoped.cjs +1 -1
- package/_cjs/Channel/api/runScoped.cjs.map +1 -1
- package/_cjs/Channel/api.cjs +2 -2
- package/_cjs/Channel/api.cjs.map +1 -1
- package/_cjs/Fiber/FiberRuntime.cjs +110 -98
- package/_cjs/Fiber/FiberRuntime.cjs.map +1 -1
- package/_cjs/Fiber/constructors.cjs +10 -2
- package/_cjs/Fiber/constructors.cjs.map +1 -1
- package/_cjs/Future/api.cjs +1 -1
- package/_cjs/Future/api.cjs.map +1 -1
- package/_cjs/IO/api/all.cjs +33 -0
- package/_cjs/IO/api/all.cjs.map +1 -0
- package/_cjs/IO/api/asyncIO.cjs +1 -1
- 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/concurrency.cjs +25 -4
- package/_cjs/IO/api/concurrency.cjs.map +1 -1
- package/_cjs/IO/api/disconnect.cjs +1 -1
- package/_cjs/IO/api/disconnect.cjs.map +1 -1
- package/_cjs/IO/api/foreachConcurrent.cjs +1 -1
- package/_cjs/IO/api/foreachConcurrent.cjs.map +1 -1
- package/_cjs/IO/api/foreachExec.cjs +1 -1
- package/_cjs/IO/api/foreachExec.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 +18 -6
- package/_cjs/IO/api/interrupt.cjs.map +1 -1
- package/_cjs/IO/api/raceWith.cjs +4 -4
- package/_cjs/IO/api/raceWith.cjs.map +1 -1
- package/_cjs/IO/api/timeout.cjs +8 -5
- package/_cjs/IO/api/timeout.cjs.map +1 -1
- package/_cjs/IO/api/zipConcurrent.cjs +1 -1
- package/_cjs/IO/api/zipConcurrent.cjs.map +1 -1
- package/_cjs/IO/api.cjs +78 -20
- package/_cjs/IO/api.cjs.map +1 -1
- package/_cjs/IO/definition.cjs +14 -191
- package/_cjs/IO/definition.cjs.map +1 -1
- package/_cjs/IO.cjs +11 -0
- package/_cjs/IO.cjs.map +1 -1
- package/_cjs/Layer/MemoMap.cjs +1 -1
- package/_cjs/Layer/MemoMap.cjs.map +1 -1
- package/_cjs/Layer/api.cjs.map +1 -1
- package/_cjs/Push/api.cjs +238 -168
- package/_cjs/Push/api.cjs.map +1 -1
- package/_cjs/Push/definition.cjs +12 -13
- package/_cjs/Push/definition.cjs.map +1 -1
- package/_cjs/Push/internal.cjs +37 -29
- package/_cjs/Push/internal.cjs.map +1 -1
- package/_cjs/RefSubject/Atomic.cjs +15 -19
- package/_cjs/RefSubject/Atomic.cjs.map +1 -1
- package/_cjs/RefSubject/Synchronized/definition.cjs +9 -10
- package/_cjs/RefSubject/Synchronized/definition.cjs.map +1 -1
- package/_cjs/RefSubject/api.cjs +5 -6
- package/_cjs/RefSubject/api.cjs.map +1 -1
- package/_cjs/RefSubject/definition.cjs.map +1 -1
- package/_cjs/STM/api/atomically.cjs +1 -1
- package/_cjs/STM/api/atomically.cjs.map +1 -1
- package/_cjs/STM/api.cjs +2 -2
- package/_cjs/STM/api.cjs.map +1 -1
- package/_cjs/STM/definition.cjs +1 -1
- package/_cjs/STM/definition.cjs.map +1 -1
- package/_cjs/ScopedRef/api.cjs +2 -2
- package/_cjs/ScopedRef/api.cjs.map +1 -1
- package/_cjs/Semaphore.cjs +1 -1
- package/_cjs/Semaphore.cjs.map +1 -1
- package/_cjs/Sink/api.cjs +13 -13
- package/_cjs/Sink/api.cjs.map +1 -1
- package/_cjs/Subject/Atomic.cjs +4 -5
- package/_cjs/Subject/Atomic.cjs.map +1 -1
- package/_cjs/TReentrantLock/api.cjs +2 -2
- package/_cjs/TReentrantLock/api.cjs.map +1 -1
- package/_cjs/TSemaphore/api.cjs +1 -1
- package/_cjs/TSemaphore/api.cjs.map +1 -1
- package/_cjs/collection/immutable/Conc/dropUntilIO.cjs +12 -17
- package/_cjs/collection/immutable/Conc/dropUntilIO.cjs.map +1 -1
- package/_cjs/collection/immutable/Conc/dropWhileIO.cjs +12 -17
- package/_cjs/collection/immutable/Conc/dropWhileIO.cjs.map +1 -1
- package/_cjs/collection/immutable/Conc/filterIO.cjs +2 -12
- package/_cjs/collection/immutable/Conc/filterIO.cjs.map +1 -1
- package/_cjs/collection/immutable/Conc/mapIO.cjs +3 -9
- package/_cjs/collection/immutable/Conc/mapIO.cjs.map +1 -1
- package/_cjs/collection/immutable/Conc/takeWhileIO.cjs +11 -27
- package/_cjs/collection/immutable/Conc/takeWhileIO.cjs.map +1 -1
- package/_mjs/Channel/api/runScoped.mjs +1 -1
- package/_mjs/Channel/api/runScoped.mjs.map +1 -1
- package/_mjs/Channel/api.mjs +2 -2
- package/_mjs/Channel/api.mjs.map +1 -1
- package/_mjs/Fiber/FiberRuntime.mjs +111 -100
- package/_mjs/Fiber/FiberRuntime.mjs.map +1 -1
- package/_mjs/Fiber/constructors.mjs +7 -1
- package/_mjs/Fiber/constructors.mjs.map +1 -1
- package/_mjs/Future/api.mjs +1 -1
- package/_mjs/Future/api.mjs.map +1 -1
- package/_mjs/IO/api/all.mjs +24 -0
- package/_mjs/IO/api/all.mjs.map +1 -0
- package/_mjs/IO/api/asyncIO.mjs +1 -1
- 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/concurrency.mjs +19 -2
- package/_mjs/IO/api/concurrency.mjs.map +1 -1
- package/_mjs/IO/api/disconnect.mjs +1 -1
- package/_mjs/IO/api/disconnect.mjs.map +1 -1
- package/_mjs/IO/api/foreachConcurrent.mjs +1 -1
- package/_mjs/IO/api/foreachConcurrent.mjs.map +1 -1
- package/_mjs/IO/api/foreachExec.mjs +1 -1
- package/_mjs/IO/api/foreachExec.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 +19 -7
- package/_mjs/IO/api/interrupt.mjs.map +1 -1
- package/_mjs/IO/api/raceWith.mjs +4 -4
- package/_mjs/IO/api/raceWith.mjs.map +1 -1
- package/_mjs/IO/api/timeout.mjs +8 -5
- package/_mjs/IO/api/timeout.mjs.map +1 -1
- package/_mjs/IO/api/zipConcurrent.mjs +1 -1
- package/_mjs/IO/api/zipConcurrent.mjs.map +1 -1
- package/_mjs/IO/api.mjs +78 -23
- package/_mjs/IO/api.mjs.map +1 -1
- package/_mjs/IO/definition.mjs +12 -181
- package/_mjs/IO/definition.mjs.map +1 -1
- package/_mjs/IO.mjs +1 -0
- package/_mjs/IO.mjs.map +1 -1
- package/_mjs/Layer/MemoMap.mjs +1 -1
- package/_mjs/Layer/MemoMap.mjs.map +1 -1
- package/_mjs/Layer/api.mjs.map +1 -1
- package/_mjs/Push/api.mjs +223 -166
- package/_mjs/Push/api.mjs.map +1 -1
- package/_mjs/Push/definition.mjs +9 -10
- package/_mjs/Push/definition.mjs.map +1 -1
- package/_mjs/Push/internal.mjs +33 -22
- package/_mjs/Push/internal.mjs.map +1 -1
- package/_mjs/RefSubject/Atomic.mjs +15 -19
- package/_mjs/RefSubject/Atomic.mjs.map +1 -1
- package/_mjs/RefSubject/Synchronized/definition.mjs +9 -10
- package/_mjs/RefSubject/Synchronized/definition.mjs.map +1 -1
- package/_mjs/RefSubject/api.mjs +6 -7
- package/_mjs/RefSubject/api.mjs.map +1 -1
- package/_mjs/RefSubject/definition.mjs.map +1 -1
- package/_mjs/STM/api/atomically.mjs +1 -1
- package/_mjs/STM/api/atomically.mjs.map +1 -1
- package/_mjs/STM/api.mjs +2 -2
- package/_mjs/STM/api.mjs.map +1 -1
- package/_mjs/STM/definition.mjs +1 -1
- package/_mjs/STM/definition.mjs.map +1 -1
- package/_mjs/ScopedRef/api.mjs +2 -2
- package/_mjs/ScopedRef/api.mjs.map +1 -1
- package/_mjs/Semaphore.mjs +1 -1
- package/_mjs/Semaphore.mjs.map +1 -1
- package/_mjs/Sink/api.mjs +10 -10
- package/_mjs/Sink/api.mjs.map +1 -1
- package/_mjs/Subject/Atomic.mjs +4 -5
- package/_mjs/Subject/Atomic.mjs.map +1 -1
- package/_mjs/TReentrantLock/api.mjs +2 -2
- package/_mjs/TReentrantLock/api.mjs.map +1 -1
- package/_mjs/TSemaphore/api.mjs +1 -1
- package/_mjs/TSemaphore/api.mjs.map +1 -1
- package/_mjs/collection/immutable/Conc/dropUntilIO.mjs +12 -17
- package/_mjs/collection/immutable/Conc/dropUntilIO.mjs.map +1 -1
- package/_mjs/collection/immutable/Conc/dropWhileIO.mjs +12 -17
- package/_mjs/collection/immutable/Conc/dropWhileIO.mjs.map +1 -1
- package/_mjs/collection/immutable/Conc/filterIO.mjs +2 -12
- package/_mjs/collection/immutable/Conc/filterIO.mjs.map +1 -1
- package/_mjs/collection/immutable/Conc/mapIO.mjs +3 -9
- package/_mjs/collection/immutable/Conc/mapIO.mjs.map +1 -1
- package/_mjs/collection/immutable/Conc/takeWhileIO.mjs +11 -27
- package/_mjs/collection/immutable/Conc/takeWhileIO.mjs.map +1 -1
- package/_src/Channel/api.ts +3 -3
- package/_src/Fiber/FiberRuntime.ts +76 -75
- package/_src/Fiber/constructors.ts +5 -0
- package/_src/IO/api/all.ts +64 -0
- package/_src/IO/api/concurrency.ts +33 -0
- package/_src/IO/api/foreachExec.ts +2 -2
- package/_src/IO/api/interrupt.ts +20 -7
- package/_src/IO/api/raceWith.ts +4 -2
- package/_src/IO/api/timeout.ts +21 -1
- package/_src/IO/api.ts +79 -27
- package/_src/IO/definition.ts +155 -200
- package/_src/IO.ts +1 -0
- package/_src/Layer/api.ts +0 -1
- package/_src/Push/api.ts +305 -304
- package/_src/Push/definition.ts +19 -17
- package/_src/Push/internal.ts +63 -31
- package/_src/RefSubject/Atomic.ts +16 -22
- package/_src/RefSubject/Synchronized/definition.ts +6 -9
- package/_src/RefSubject/api.ts +9 -12
- package/_src/RefSubject/definition.ts +6 -8
- package/_src/STM/api.ts +0 -5
- package/_src/STM/definition.ts +8 -2
- package/_src/Sink/api.ts +9 -9
- package/_src/Subject/Atomic.ts +6 -8
- package/_src/Subject/definition.ts +2 -2
- package/_src/collection/immutable/Conc/dropUntilIO.ts +18 -15
- package/_src/collection/immutable/Conc/dropWhileIO.ts +18 -17
- package/_src/collection/immutable/Conc/filterIO.ts +1 -11
- package/_src/collection/immutable/Conc/mapIO.ts +2 -9
- package/_src/collection/immutable/Conc/takeWhileIO.ts +19 -28
- package/collection/immutable/Conc/filterIO.d.ts +1 -1
- package/collection/immutable/Conc/mapIO.d.ts +1 -1
- package/collection/immutable/Conc/takeWhileIO.d.ts +1 -1
- package/package.json +2 -2
package/Fiber/FiberRuntime.d.ts
CHANGED
@@ -18,24 +18,24 @@ import { LogLevel } from "@fncts/io/LogLevel";
|
|
18
18
|
import { Logger } from "@fncts/io/Logger/definition";
|
19
19
|
import type { FiberStatus } from "../FiberStatus.js";
|
20
20
|
import type { OnFailure, OnSuccess, OnSuccessAndFailure, UIO } from "../IO/definition.js";
|
21
|
+
import type { WhileLoop } from "../IO/definition.js";
|
21
22
|
import type { RuntimeFlags } from "../RuntimeFlags.js";
|
22
23
|
import { Trace } from "@fncts/base/data/Trace";
|
23
24
|
import { FiberTypeId, FiberVariance } from "@fncts/io/Fiber/definition";
|
24
|
-
import {
|
25
|
-
import { IOOpCode } from "../IO/definition.js";
|
25
|
+
import { IOTag } from "../IO/definition.js";
|
26
26
|
import { FiberMessage } from "./FiberMessage.js";
|
27
27
|
export declare class RevertFlags {
|
28
28
|
readonly patch: RuntimeFlags.Patch;
|
29
29
|
readonly trace?: string | undefined;
|
30
|
-
readonly _tag =
|
30
|
+
readonly _tag = IOTag.RevertFlags;
|
31
31
|
constructor(patch: RuntimeFlags.Patch, trace?: string | undefined);
|
32
32
|
}
|
33
33
|
export declare class UpdateTrace {
|
34
34
|
readonly trace?: string | undefined;
|
35
|
-
readonly _tag =
|
35
|
+
readonly _tag = IOTag.UpdateTrace;
|
36
36
|
constructor(trace?: string | undefined);
|
37
37
|
}
|
38
|
-
export type Continuation = OnSuccess
|
38
|
+
export type Continuation = OnSuccess | OnSuccessAndFailure | OnFailure | WhileLoop | UpdateTrace | RevertFlags;
|
39
39
|
/**
|
40
40
|
* @tsplus type fncts.io.Fiber
|
41
41
|
*/
|
@@ -108,7 +108,7 @@ export declare class FiberRuntime<E, A> implements Fiber.Runtime<E, A> {
|
|
108
108
|
location: string | undefined;
|
109
109
|
get status(): UIO<FiberStatus>;
|
110
110
|
get trace(): UIO<Trace>;
|
111
|
-
getNextSuccessCont(): OnSuccessAndFailure
|
112
|
-
getNextFailCont(): OnSuccessAndFailure
|
111
|
+
getNextSuccessCont(): OnSuccessAndFailure | OnSuccess | WhileLoop | RevertFlags | UpdateTrace | undefined;
|
112
|
+
getNextFailCont(): OnSuccessAndFailure | OnFailure | RevertFlags | UpdateTrace | undefined;
|
113
113
|
isFatal(t: unknown): boolean;
|
114
114
|
}
|
package/Fiber/constructors.d.ts
CHANGED
@@ -27,3 +27,8 @@ export declare function interrupted(id: FiberId, __tsplusTrace?: string): Fiber<
|
|
27
27
|
* @tsplus location "@fncts/io/Fiber/constructors"
|
28
28
|
*/
|
29
29
|
export declare function succeed<A>(a: A, __tsplusTrace?: string): Fiber<never, A>;
|
30
|
+
/**
|
31
|
+
* @tsplus static fncts.io.FiberOps unit
|
32
|
+
* @tsplus location "@fncts/io/Fiber/constructors"
|
33
|
+
*/
|
34
|
+
export declare const unit: Fiber<never, void>;
|
package/IO/api/all.d.ts
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
import { IO } from "@fncts/io/IO/definition";
|
2
|
+
import { Conc } from "@fncts/base/collection/immutable/Conc";
|
3
|
+
import type { EnvironmentOf, ErrorOf, ValueOf } from "@fncts/io/IO";
|
4
|
+
/**
|
5
|
+
* @tsplus static fncts.io.IOOps all
|
6
|
+
* @tsplus location "@fncts/io/IO/api/all"
|
7
|
+
*/
|
8
|
+
export declare function all<T extends ReadonlyArray<IO<any, any, any>>>(ios: [...T]): IO<{
|
9
|
+
[K in number]: EnvironmentOf<T[K]>;
|
10
|
+
}[number], {
|
11
|
+
[K in number]: ErrorOf<T[K]>;
|
12
|
+
}[number], {
|
13
|
+
[K in keyof T]: ValueOf<T[K]>;
|
14
|
+
}>;
|
15
|
+
export declare function all<T extends Iterable<IO<any, any, any>>>(ios: T): [T] extends [Iterable<infer A>] ? IO<EnvironmentOf<A>, ErrorOf<A>, Conc<ValueOf<A>>> : never;
|
16
|
+
export declare function all<T extends Record<string, IO<any, any, any>>>(ios: T): IO<{
|
17
|
+
[K in keyof T]: EnvironmentOf<T[K]>;
|
18
|
+
}[keyof T], {
|
19
|
+
[K in keyof T]: ErrorOf<T[K]>;
|
20
|
+
}[keyof T], {
|
21
|
+
[K in keyof T]: ValueOf<T[K]>;
|
22
|
+
}>;
|
23
|
+
/**
|
24
|
+
* @tsplus static fncts.io.IOOps allConcurrent
|
25
|
+
* @tsplus location "@fncts/io/IO/api/all"
|
26
|
+
*/
|
27
|
+
export declare function allConcurrent<T extends ReadonlyArray<IO<any, any, any>>>(ios: [...T]): IO<{
|
28
|
+
[K in number]: EnvironmentOf<T[K]>;
|
29
|
+
}[number], {
|
30
|
+
[K in number]: ErrorOf<T[K]>;
|
31
|
+
}[number], {
|
32
|
+
[K in keyof T]: ValueOf<T[K]>;
|
33
|
+
}>;
|
34
|
+
export declare function allConcurrent<T extends Iterable<IO<any, any, any>>>(ios: T): [T] extends [Iterable<infer A>] ? IO<EnvironmentOf<A>, ErrorOf<A>, Conc<ValueOf<A>>> : never;
|
35
|
+
export declare function allConcurrent<T extends Record<string, IO<any, any, any>>>(ios: T): IO<{
|
36
|
+
[K in keyof T]: EnvironmentOf<T[K]>;
|
37
|
+
}[keyof T], {
|
38
|
+
[K in keyof T]: ErrorOf<T[K]>;
|
39
|
+
}[keyof T], {
|
40
|
+
[K in keyof T]: ValueOf<T[K]>;
|
41
|
+
}>;
|
package/IO/api/concurrency.d.ts
CHANGED
@@ -33,3 +33,14 @@ export declare function withConcurrency(n: number, __tsplusTrace?: string): <R,
|
|
33
33
|
* @tsplus location "@fncts/io/IO/api/concurrency"
|
34
34
|
*/
|
35
35
|
export declare function withConcurrencyUnbounded<R, E, A>(ma: IO<R, E, A>, __tsplusTrace?: string): IO<R, E, A>;
|
36
|
+
export type ConcurrencyRestorer = <R, E, A>(io: IO<R, E, A>) => IO<R, E, A>;
|
37
|
+
/**
|
38
|
+
* @tsplus static fncts.io.IOOps withConcurrencyMask
|
39
|
+
* @tsplus location "@fncts/io/IO/api/concurrency"
|
40
|
+
*/
|
41
|
+
export declare function withConcurrencyMask<R, E, A>(n: number, f: (restore: ConcurrencyRestorer) => IO<R, E, A>): IO<R, E, A>;
|
42
|
+
/**
|
43
|
+
* @tsplus static fncts.io.IOOps withConcurrencyUnboundedMask
|
44
|
+
* @tsplus location "@fncts/io/IO/api/concurrency"
|
45
|
+
*/
|
46
|
+
export declare function withConcurrencyUnboundedMask<R, E, A>(f: (restore: ConcurrencyRestorer) => IO<R, E, A>): IO<R, E, A>;
|
package/IO/api/interrupt.d.ts
CHANGED
@@ -51,7 +51,7 @@ export declare function uninterruptible<R, E, A>(self: IO<R, E, A>, __tsplusTrac
|
|
51
51
|
* @tsplus static fncts.io.IOOps uninterruptibleMask
|
52
52
|
* @tsplus location "@fncts/io/IO/api/interrupt"
|
53
53
|
*/
|
54
|
-
export declare function uninterruptibleMask<R, E, A>(f: (restore: InterruptibilityRestorer) => IO<R, E, A
|
54
|
+
export declare function uninterruptibleMask<R, E, A>(f: (restore: InterruptibilityRestorer) => IO<R, E, A>, __tsplusTrace?: string): IO<R, E, A>;
|
55
55
|
/**
|
56
56
|
* @tsplus pipeable fncts.io.IO ensuring
|
57
57
|
* @tsplus location "@fncts/io/IO/api/interrupt"
|
package/IO/api/raceWith.d.ts
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
import { Lazy } from "@fncts/base/data/function/definition";
|
2
2
|
import { IO } from "@fncts/io/IO/definition";
|
3
|
+
import { FiberScope } from "@fncts/io/FiberScope";
|
3
4
|
import { Exit } from "@fncts/base/data/Exit/definition";
|
4
5
|
import { Fiber } from "@fncts/io/Fiber/definition";
|
5
6
|
import type { FiberRuntime } from "@fncts/io/Fiber/FiberRuntime";
|
@@ -7,7 +8,7 @@ import type { FiberRuntime } from "@fncts/io/Fiber/FiberRuntime";
|
|
7
8
|
* @tsplus pipeable fncts.io.IO raceFibersWith
|
8
9
|
* @tsplus location "@fncts/io/IO/api/raceWith"
|
9
10
|
*/
|
10
|
-
export declare function raceFibersWith<R, E, A, R1, E1, B, R2, E2, C, R3, E3, D>(right: Lazy<IO<R1, E1, B>>, leftWins: (winner: FiberRuntime<E, A>, loser: FiberRuntime<E1, B>) => IO<R2, E2, C>, rightWins: (winner: FiberRuntime<E1, B>, loser: FiberRuntime<E, A>) => IO<R3, E3, D>, __tsplusTrace?: string): (left: IO<R, E, A>) => IO<R | R1 | R2 | R3, E2 | E3, C | D>;
|
11
|
+
export declare function raceFibersWith<R, E, A, R1, E1, B, R2, E2, C, R3, E3, D>(right: Lazy<IO<R1, E1, B>>, leftWins: (winner: FiberRuntime<E, A>, loser: FiberRuntime<E1, B>) => IO<R2, E2, C>, rightWins: (winner: FiberRuntime<E1, B>, loser: FiberRuntime<E, A>) => IO<R3, E3, D>, leftScope?: FiberScope | null, rightScope?: FiberScope | null, __tsplusTrace?: string): (left: IO<R, E, A>) => IO<R | R1 | R2 | R3, E2 | E3, C | D>;
|
11
12
|
/**
|
12
13
|
* Returns an effect that races this effect with the specified effect, calling
|
13
14
|
* the specified finisher as soon as one result or the other has been computed.
|
package/IO/api.d.ts
CHANGED
@@ -194,14 +194,14 @@ export declare function condIO<R, R1, E, A>(b: boolean, onTrue: URIO<R, A>, onFa
|
|
194
194
|
* @tsplus static fncts.io.IOOps defer
|
195
195
|
* @tsplus location "@fncts/io/IO/api"
|
196
196
|
*/
|
197
|
-
export declare function defer<R, E, A>(io: Lazy<IO<R, E, A>>, __tsplusTrace?: string): IO<R, E, A>;
|
197
|
+
export declare function defer<R = never, E = never, A = never>(io: Lazy<IO<R, E, A>>, __tsplusTrace?: string): IO<R, E, A>;
|
198
198
|
/**
|
199
199
|
* Returns a lazily constructed effect, whose construction may itself require effects.
|
200
200
|
* When no environment is required (i.e., when R == unknown) it is conceptually equivalent to `flatten(try(io))`.
|
201
201
|
* @tsplus static fncts.io.IOOps deferTry
|
202
202
|
* @tsplus location "@fncts/io/IO/api"
|
203
203
|
*/
|
204
|
-
export declare function deferTry<R, E, A>(io: () => IO<R, E, A>, __tsplusTrace?: string): IO<R, unknown, A>;
|
204
|
+
export declare function deferTry<R = never, E = never, A = never>(io: () => IO<R, E, A>, __tsplusTrace?: string): IO<R, unknown, A>;
|
205
205
|
/**
|
206
206
|
* Returns a lazily constructed effect, whose construction may itself require effects,
|
207
207
|
* translating any thrown exceptions into typed failed effects and mapping the error.
|
@@ -903,6 +903,11 @@ export declare function swapWith<R, E, A, R1, E1, A1>(f: (ma: IO<R, A, E>) => IO
|
|
903
903
|
* @tsplus location "@fncts/io/IO/api"
|
904
904
|
*/
|
905
905
|
export declare function timedWith<R1, E1>(msTime: IO<R1, E1, number>, __tsplusTrace?: string): <R, E, A>(ma: IO<R, E, A>) => IO<R1 | R, E1 | E, readonly [number, A]>;
|
906
|
+
/**
|
907
|
+
* @tsplus static fncts.io.IOOps attempt
|
908
|
+
* @tsplus location "@fncts/io/IO/api"
|
909
|
+
*/
|
910
|
+
export declare function attempt<A>(effect: Lazy<A>, __tsplusTrace?: string): FIO<unknown, A>;
|
906
911
|
/**
|
907
912
|
* Creates a `IO` that has succeeded with a pure value
|
908
913
|
* @tsplus static fncts.io.IOOps tryCatch
|
package/IO/definition.d.ts
CHANGED
@@ -2,16 +2,14 @@ import { HKT } from "@fncts/typelevel/HKT";
|
|
2
2
|
import { NoSuchElementError } from "@fncts/base/data/exceptions";
|
3
3
|
import { FiberId } from "@fncts/base/data/FiberId/definition";
|
4
4
|
import { Cause } from "@fncts/base/data/Cause/definition";
|
5
|
-
import { Lazy } from "@fncts/base/data/function/definition";
|
6
5
|
import { STM } from "@fncts/io/STM/definition";
|
7
6
|
import { Nothing, Just } from "@fncts/base/data/Maybe/definition";
|
8
7
|
import type { FiberRuntime } from "../Fiber/FiberRuntime.js";
|
9
8
|
import type { Running } from "../FiberStatus.js";
|
10
9
|
import type { RuntimeFlagsPatch } from "../RuntimeFlags.js";
|
10
|
+
import type { RuntimeFlags } from "../RuntimeFlags.js";
|
11
11
|
import type { Left, Right } from "@fncts/base/data/Either";
|
12
12
|
import type { Failure, Success } from "@fncts/base/data/Exit";
|
13
|
-
import type { Trace } from "@fncts/base/data/Trace";
|
14
|
-
import { RuntimeFlags } from "../RuntimeFlags.js";
|
15
13
|
export declare const IOVariance: unique symbol;
|
16
14
|
export type IOVariance = typeof IOVariance;
|
17
15
|
export declare const IOTypeId: unique symbol;
|
@@ -36,6 +34,21 @@ export declare abstract class IO<R, E, A> {
|
|
36
34
|
_A: () => A;
|
37
35
|
};
|
38
36
|
}
|
37
|
+
export type EnvironmentOf<T> = [T] extends [{
|
38
|
+
[IOVariance]: {
|
39
|
+
_R: () => infer R;
|
40
|
+
};
|
41
|
+
}] ? R : never;
|
42
|
+
export type ErrorOf<T> = [T] extends [{
|
43
|
+
[IOVariance]: {
|
44
|
+
_E: () => infer E;
|
45
|
+
};
|
46
|
+
}] ? E : never;
|
47
|
+
export type ValueOf<T> = [T] extends [{
|
48
|
+
[IOVariance]: {
|
49
|
+
_A: () => infer A;
|
50
|
+
};
|
51
|
+
}] ? A : never;
|
39
52
|
declare module "@fncts/base/data/Either/definition" {
|
40
53
|
interface Either<E, A> extends IO<never, E, A> {
|
41
54
|
}
|
@@ -85,7 +98,7 @@ export declare function unifyIO<X extends IO<any, any, any>>(self: X): IO<[
|
|
85
98
|
export type UIO<A> = IO<never, never, A>;
|
86
99
|
export type URIO<R, A> = IO<R, never, A>;
|
87
100
|
export type FIO<E, A> = IO<never, E, A>;
|
88
|
-
export declare const enum
|
101
|
+
export declare const enum IOTag {
|
89
102
|
SucceedNow = 0,
|
90
103
|
Fail = 1,
|
91
104
|
Sync = 2,
|
@@ -103,133 +116,96 @@ export declare const enum IOOpCode {
|
|
103
116
|
RevertFlags = 14,
|
104
117
|
UpdateTrace = 15
|
105
118
|
}
|
106
|
-
export
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
readonly _tag
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
readonly _tag = IOOpCode.Async;
|
118
|
-
constructor(registerCallback: (f: (_: IO<R, E, A>) => void) => any, blockingOn: () => FiberId, trace?: string | undefined);
|
119
|
+
export type IOOp<Tag extends string | number, Body = {}> = IO<never, never, never> & Body & {
|
120
|
+
readonly _tag: Tag;
|
121
|
+
};
|
122
|
+
export declare class IOPrimitive {
|
123
|
+
readonly _tag: Primitive["_tag"];
|
124
|
+
i0: any;
|
125
|
+
i1: any;
|
126
|
+
i2: any;
|
127
|
+
trace: string | undefined;
|
128
|
+
[IOTypeId]: symbol;
|
129
|
+
constructor(_tag: Primitive["_tag"]);
|
119
130
|
}
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
readonly
|
128
|
-
readonly
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
readonly
|
135
|
-
readonly
|
136
|
-
readonly trace
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
export
|
146
|
-
readonly
|
147
|
-
readonly
|
148
|
-
readonly trace
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
readonly
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
readonly
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
readonly
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
readonly
|
179
|
-
readonly
|
180
|
-
readonly
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
readonly
|
189
|
-
readonly
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
export declare class GenerateStackTrace extends IO<never, never, Trace> {
|
194
|
-
readonly trace?: string | undefined;
|
195
|
-
readonly _tag = IOOpCode.GenerateStackTrace;
|
196
|
-
constructor(trace?: string | undefined);
|
197
|
-
}
|
198
|
-
export declare class Stateful<R, E, A> extends IO<R, E, A> {
|
199
|
-
readonly onState: (fiber: FiberRuntime<E, A>, status: Running) => IO<R, E, A>;
|
200
|
-
readonly trace?: string | undefined;
|
201
|
-
readonly _tag = IOOpCode.Stateful;
|
202
|
-
constructor(onState: (fiber: FiberRuntime<E, A>, status: Running) => IO<R, E, A>, trace?: string | undefined);
|
203
|
-
}
|
204
|
-
export declare class WhileLoop<R, E, A> extends IO<R, E, void> {
|
205
|
-
readonly check: () => boolean;
|
206
|
-
readonly body: () => IO<R, E, A>;
|
207
|
-
readonly process: (a: A) => any;
|
208
|
-
readonly trace?: string | undefined;
|
209
|
-
readonly _tag = IOOpCode.WhileLoop;
|
210
|
-
constructor(check: () => boolean, body: () => IO<R, E, A>, process: (a: A) => any, trace?: string | undefined);
|
211
|
-
}
|
212
|
-
export declare class YieldNow extends IO<never, never, void> {
|
213
|
-
readonly trace?: string | undefined;
|
214
|
-
readonly _tag = IOOpCode.YieldNow;
|
215
|
-
constructor(trace?: string | undefined);
|
216
|
-
}
|
217
|
-
/**
|
218
|
-
* @internal
|
219
|
-
*/
|
220
|
-
export declare class Fail<E> extends IO<never, E, never> {
|
221
|
-
readonly cause: Lazy<Cause<E>>;
|
222
|
-
readonly trace?: string | undefined;
|
223
|
-
readonly _tag = IOOpCode.Fail;
|
224
|
-
constructor(cause: Lazy<Cause<E>>, trace?: string | undefined);
|
225
|
-
}
|
226
|
-
export type Concrete = OnSuccessAndFailure<any, any, any, any, any, any, any, any, any> | OnFailure<any, any, any, any, any, any> | OnSuccess<any, any, any, any, any, any> | UpdateRuntimeFlagsWithin | Sync<any> | Async<any, any, any> | SucceedNow<any> | UpdateRuntimeFlags | GenerateStackTrace | Stateful<any, any, any> | WhileLoop<any, any, any> | YieldNow | Fail<any> | STM<any, any, any> | Left<any> | Right<any> | Nothing | Just<any> | Failure<any> | Success<any>;
|
131
|
+
export declare function isIO(u: unknown): u is IO<any, any, any>;
|
132
|
+
export interface Sync<A = any> extends IOOp<IOTag.Sync, {
|
133
|
+
readonly i0: () => A;
|
134
|
+
readonly trace: string | undefined;
|
135
|
+
}> {
|
136
|
+
}
|
137
|
+
export interface Async<R = any, E = any, A = any> extends IOOp<IOTag.Async, {
|
138
|
+
readonly i0: (resume: (io: Primitive) => void) => void;
|
139
|
+
readonly i1: () => FiberId;
|
140
|
+
readonly trace: string | undefined;
|
141
|
+
}> {
|
142
|
+
}
|
143
|
+
export interface OnSuccessAndFailure extends IOOp<IOTag.OnSuccessAndFailure, {
|
144
|
+
readonly i0: Primitive;
|
145
|
+
readonly i1: (cause: Cause<unknown>) => Primitive;
|
146
|
+
readonly i2: (a: unknown) => Primitive;
|
147
|
+
readonly trace: string | undefined;
|
148
|
+
}> {
|
149
|
+
}
|
150
|
+
export interface OnFailure extends IOOp<IOTag.OnFailure, {
|
151
|
+
readonly i0: Primitive;
|
152
|
+
readonly i1: (cause: Cause<unknown>) => Primitive;
|
153
|
+
readonly trace: string | undefined;
|
154
|
+
}> {
|
155
|
+
}
|
156
|
+
export interface OnSuccess extends IOOp<IOTag.OnSuccess, {
|
157
|
+
readonly i0: Primitive;
|
158
|
+
readonly i1: (a: unknown) => Primitive;
|
159
|
+
readonly trace: string | undefined;
|
160
|
+
}> {
|
161
|
+
}
|
162
|
+
export interface SucceedNow extends IOOp<IOTag.SucceedNow, {
|
163
|
+
readonly i0: any;
|
164
|
+
readonly trace: string | undefined;
|
165
|
+
}> {
|
166
|
+
}
|
167
|
+
export interface UpdateRuntimeFlags extends IOOp<IOTag.UpdateRuntimeFlags, {
|
168
|
+
readonly i0: RuntimeFlags.Patch;
|
169
|
+
readonly trace: string | undefined;
|
170
|
+
}> {
|
171
|
+
}
|
172
|
+
export interface UpdateRuntimeFlagsWithin extends IOOp<IOTag.UpdateRuntimeFlagsWithin, {
|
173
|
+
readonly i0: RuntimeFlagsPatch;
|
174
|
+
readonly i1: (oldRuntimeFlags: RuntimeFlags) => Primitive;
|
175
|
+
readonly trace: string | undefined;
|
176
|
+
}> {
|
177
|
+
}
|
178
|
+
export interface GenerateStackTrace extends IOOp<IOTag.GenerateStackTrace, {
|
179
|
+
readonly trace: string | undefined;
|
180
|
+
}> {
|
181
|
+
}
|
182
|
+
export interface Stateful extends IOOp<IOTag.Stateful, {
|
183
|
+
readonly i0: (fiber: FiberRuntime<any, any>, status: Running) => Primitive;
|
184
|
+
readonly trace: string | undefined;
|
185
|
+
}> {
|
186
|
+
}
|
187
|
+
export interface WhileLoop extends IOOp<IOTag.WhileLoop, {
|
188
|
+
readonly i0: () => boolean;
|
189
|
+
readonly i1: () => Primitive;
|
190
|
+
readonly i2: (a: any) => any;
|
191
|
+
readonly trace: string | undefined;
|
192
|
+
}> {
|
193
|
+
}
|
194
|
+
export interface YieldNow extends IOOp<IOTag.YieldNow, {
|
195
|
+
readonly trace: string | undefined;
|
196
|
+
}> {
|
197
|
+
}
|
198
|
+
export interface Fail extends IOOp<IOTag.Fail, {
|
199
|
+
readonly i0: () => Cause<unknown>;
|
200
|
+
readonly trace: string | undefined;
|
201
|
+
}> {
|
202
|
+
}
|
203
|
+
export type Primitive = OnSuccessAndFailure | OnFailure | OnSuccess | UpdateRuntimeFlagsWithin | Sync | Async | SucceedNow | UpdateRuntimeFlags | GenerateStackTrace | Stateful | WhileLoop | YieldNow | Fail | STM<any, any, any> | Left<any> | Right<any> | Nothing | Just<any> | Failure<any> | Success<any>;
|
227
204
|
/**
|
228
205
|
* @tsplus static fncts.io.IOOps concrete
|
229
206
|
* @tsplus macro identity
|
230
207
|
* @tsplus location "@fncts/io/IO/definition"
|
231
208
|
*/
|
232
|
-
export declare function concrete(io: IO<any, any, any>):
|
233
|
-
export type EvaluationStep = OnSuccessAndFailure
|
234
|
-
export type UpdateRuntimeFlagsWithin = Interruptible<any, any, any> | Uninterruptible<any, any, any> | Dynamic<any, any, any>;
|
209
|
+
export declare function concrete(io: IO<any, any, any>): Primitive;
|
210
|
+
export type EvaluationStep = OnSuccessAndFailure | OnFailure | OnSuccess;
|
235
211
|
export type Canceler<R> = URIO<R, void>;
|
package/IO.d.ts
CHANGED
@@ -7,6 +7,7 @@ export * from "./IO/api/acquireReleaseInterruptible.js";
|
|
7
7
|
export * from "./IO/api/acquireReleaseInterruptibleExit.js";
|
8
8
|
export * from "./IO/api/addFinalizer.js";
|
9
9
|
export * from "./IO/api/addFinalizerExit.js";
|
10
|
+
export * from "./IO/api/all.js";
|
10
11
|
export * from "./IO/api/asyncInterrupt.js";
|
11
12
|
export * from "./IO/api/asyncIO.js";
|
12
13
|
export * from "./IO/api/blocking.js";
|
package/Push/api.d.ts
CHANGED
@@ -1,29 +1,44 @@
|
|
1
1
|
import { Lazy } from "@fncts/base/data/function/definition";
|
2
|
+
import { Cause } from "@fncts/base/data/Cause/definition";
|
3
|
+
import { Either } from "@fncts/base/data/Either/definition";
|
2
4
|
import { Duration } from "@fncts/base/data/Duration/definition";
|
3
|
-
import {
|
4
|
-
import {
|
5
|
+
import { Maybe, Nothing, Just } from "@fncts/base/data/Maybe/definition";
|
6
|
+
import { Refinement } from "@fncts/base/data/Refinement/definition";
|
7
|
+
import { Predicate } from "@fncts/base/data/Predicate/definition";
|
8
|
+
import { UIO, URIO } from "@fncts/io/IO/definition";
|
5
9
|
import { Environment } from "@fncts/base/data/Environment/definition";
|
6
|
-
import {
|
10
|
+
import { Fiber } from "@fncts/io/Fiber/definition";
|
7
11
|
import { Scope } from "@fncts/io/Scope/definition";
|
8
|
-
import { Schedule } from "@fncts/io/Schedule/definition";
|
9
|
-
import { Cause } from "@fncts/base/data/Cause/definition";
|
10
|
-
import { Nothing, Just, Maybe } from "@fncts/base/data/Maybe/definition";
|
11
|
-
import { FiberId } from "@fncts/base/data/FiberId/definition";
|
12
12
|
import { Conc } from "@fncts/base/collection/immutable/Conc";
|
13
|
-
import
|
13
|
+
import { Future } from "@fncts/io/Future";
|
14
14
|
import { AtomicReference } from "@fncts/base/internal/AtomicReference";
|
15
|
-
import {
|
15
|
+
import { IO } from "@fncts/io/IO";
|
16
|
+
import { Push, PushTypeId, PushVariance, Sink } from "./definition.js";
|
16
17
|
/**
|
17
18
|
* @tsplus pipeable fncts.io.Push as
|
18
19
|
* @tsplus location "@fncts/io/Push/api"
|
19
20
|
*/
|
20
21
|
export declare function as<B>(b: Lazy<B>): <R, E, A>(self: Push<R, E, A>) => Push<R, E, B>;
|
22
|
+
interface UnsafeSink<E, A> {
|
23
|
+
event: (value: A) => void;
|
24
|
+
error: (cause: Cause<E>) => void;
|
25
|
+
}
|
26
|
+
/**
|
27
|
+
* @tsplus static fncts.io.PushOps asyncInterrupt
|
28
|
+
* @tsplus location "@fncts/io/Push/api"
|
29
|
+
*/
|
30
|
+
export declare function asyncInterrupt<R, E, A>(make: (emitter: UnsafeSink<E, A>) => Either<IO<R, never, void>, Push<R, E, A>>): Push<R, E, A>;
|
31
|
+
/**
|
32
|
+
* @tsplus static fncts.io.PushOps async
|
33
|
+
* @tsplus location "@fncts/io/Push/api"
|
34
|
+
*/
|
35
|
+
export declare function async<E, A>(make: (sink: UnsafeSink<E, A>) => void): Push<never, E, A>;
|
21
36
|
/**
|
22
37
|
* @tsplus static fncts.io.PushOps combineLatest
|
23
38
|
* @tsplus location "@fncts/io/Push/api"
|
24
39
|
*/
|
25
|
-
export declare function combineLatest<A extends ReadonlyArray<Push<any, any, any>>>(streams: [...A]): Push<
|
26
|
-
[K in keyof A]:
|
40
|
+
export declare function combineLatest<A extends ReadonlyArray<Push<any, any, any>>>(streams: [...A]): Push<Push.EnvironmentOf<A[number]>, Push.ErrorOf<A[number]>, {
|
41
|
+
[K in keyof A]: Push.ValueOf<A[K]>;
|
27
42
|
}>;
|
28
43
|
export declare function combineLatest<R, E, A>(streams: Iterable<Push<R, E, A>>): Push<R, E, ReadonlyArray<A>>;
|
29
44
|
/**
|
@@ -41,6 +56,37 @@ export declare function debounce(duration: Lazy<Duration>): <R, E, A>(self: Push
|
|
41
56
|
* @tsplus location "@fncts/io/Push/api"
|
42
57
|
*/
|
43
58
|
export declare function defer<R, E, A>(self: Lazy<Push<R, E, A>>): Push<R, E, A>;
|
59
|
+
/**
|
60
|
+
* @tsplus pipeable fncts.io.Push exhaustMap
|
61
|
+
* @tsplus location "@fncts/io/Push/api"
|
62
|
+
*/
|
63
|
+
export declare function exhaustMap<A, R1, E1, B>(f: (a: A) => Push<R1, E1, B>): <R, E>(self: Push<R, E, A>) => Push<R1 | R, E1 | E, B>;
|
64
|
+
/**
|
65
|
+
* @tsplus pipeable fncts.io.Push exhaustMapIO
|
66
|
+
* @tsplus location "@fncts/io/Push/api"
|
67
|
+
*/
|
68
|
+
export declare function exhaustMapIO<A, R1, E1, B>(f: (a: A) => IO<R1, E1, B>): <R, E>(self: Push<R, E, A>) => Push<R1 | R, E1 | E, B>;
|
69
|
+
/**
|
70
|
+
* @tsplus pipeable fncts.io.Push filterIO
|
71
|
+
* @tsplus location "@fncts/io/Push/api"
|
72
|
+
*/
|
73
|
+
export declare function filterIO<A, R1, E1>(predicate: (a: A) => IO<R1, E1, boolean>): <R, E>(self: Push<R, E, A>) => Push<R1 | R, E1 | E, A>;
|
74
|
+
/**
|
75
|
+
* @tsplus pipeable fncts.io.Push filterMapIO
|
76
|
+
* @tsplus location "@fncts/io/Push/api"
|
77
|
+
*/
|
78
|
+
export declare function filterMapIO<A, R1, E1, B>(f: (a: A) => IO<R1, E1, Maybe<B>>): <R, E>(self: Push<R, E, A>) => Push<R1 | R, E1 | E, B>;
|
79
|
+
/**
|
80
|
+
* @tsplus pipeable fncts.io.Push filter
|
81
|
+
* @tsplus location "@fncts/io/Push/api"
|
82
|
+
*/
|
83
|
+
export declare function filter<A, B extends A>(refinement: Refinement<A, B>): <R, E>(self: Push<R, E, A>) => Push<R, E, B>;
|
84
|
+
export declare function filter<A>(predicate: Predicate<A>): <R, E>(self: Push<R, E, A>) => Push<R, E, A>;
|
85
|
+
/**
|
86
|
+
* @tsplus pipeable fncts.io.Push filterMap
|
87
|
+
* @tsplus location "@fncts/io/Push/api"
|
88
|
+
*/
|
89
|
+
export declare function filterMap<A, B>(f: (a: A) => Maybe<B>): <R, E>(self: Push<R, E, A>) => Push<R, E, B>;
|
44
90
|
/**
|
45
91
|
* @tsplus pipeable fncts.io.Push flatMapConcurrentBounded
|
46
92
|
* @tsplus location "@fncts/io/Push/api"
|
@@ -87,11 +133,10 @@ export declare function fromIterable<A>(iterable: Iterable<A>): Push<never, neve
|
|
87
133
|
*/
|
88
134
|
export declare function multicast<R, E, A>(self: Push<R, E, A>): Push<R, E, A>;
|
89
135
|
interface MulticastObserver<E, A> {
|
90
|
-
readonly
|
136
|
+
readonly sink: Sink<any, E, A>;
|
91
137
|
readonly environment: Environment<any>;
|
92
|
-
readonly future: Future<never, void>;
|
93
138
|
}
|
94
|
-
export declare class Multicast<R, E, A> implements Push<R, E, A>,
|
139
|
+
export declare class Multicast<R, E, A> implements Push<R, E, A>, Sink<never, E, A> {
|
95
140
|
readonly push: Push<R, E, A>;
|
96
141
|
readonly [PushTypeId]: PushTypeId;
|
97
142
|
[PushVariance]: {
|
@@ -102,14 +147,12 @@ export declare class Multicast<R, E, A> implements Push<R, E, A>, Emitter<never,
|
|
102
147
|
protected observers: Array<MulticastObserver<E, A>>;
|
103
148
|
protected fiber: Fiber<never, unknown> | undefined;
|
104
149
|
constructor(push: Push<R, E, A>);
|
105
|
-
run<R1>(
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
protected
|
110
|
-
protected
|
111
|
-
protected runEnd(observer: MulticastObserver<E, A>): import("../IO.js").FIO<never, boolean>;
|
112
|
-
protected cleanup(): import("../IO.js").UIO<void>;
|
150
|
+
run<R1>(sink: Sink<R1, E, A>): IO<R | R1, never, void>;
|
151
|
+
event(value: A): IO<never, never, void>;
|
152
|
+
error(cause: Cause<E>): IO<never, never, void>;
|
153
|
+
protected runValue(value: A, observer: MulticastObserver<E, A>): IO<never, never, void>;
|
154
|
+
protected runError(cause: Cause<E>, observer: MulticastObserver<E, A>): IO<never, never, void>;
|
155
|
+
protected removeSink(sink: Sink<any, E, A>): IO<never, never, void>;
|
113
156
|
}
|
114
157
|
/**
|
115
158
|
* @tsplus getter fncts.io.Push hold
|
@@ -117,19 +160,11 @@ export declare class Multicast<R, E, A> implements Push<R, E, A>, Emitter<never,
|
|
117
160
|
*/
|
118
161
|
export declare function hold<R, E, A>(self: Push<R, E, A>): Push<R, E, A>;
|
119
162
|
export declare class Hold<R, E, A> extends Multicast<R, E, A> {
|
120
|
-
|
121
|
-
readonly
|
122
|
-
protected pendingEmitters: Array<readonly [Emitter<unknown, E, A>, Array<A>]>;
|
123
|
-
protected scheduledFiber: Fiber<any, any> | null;
|
163
|
+
push: Push<R, E, A>;
|
164
|
+
readonly current: AtomicReference<import("@fncts/base/data/Maybe.js").Maybe<A>>;
|
124
165
|
constructor(push: Push<R, E, A>);
|
125
|
-
run<R1>(
|
126
|
-
|
127
|
-
failCause(cause: Cause<E>): import("../IO.js").IO<never, never, void>;
|
128
|
-
get end(): import("../IO.js").IO<never, never, void>;
|
129
|
-
protected shouldScheduleFlush(): boolean;
|
130
|
-
protected scheduleFlush<R>(observer: Emitter<R, E, A>): import("../IO.js").IO<import("../Scope.js").Scope, never, import("../Fiber.js").Fiber.Runtime<never, void>>;
|
131
|
-
protected flushPending(): import("../IO.js").UIO<void>;
|
132
|
-
protected addValue(value: A): void;
|
166
|
+
run<R1>(sink: Sink<R1, E, A>): IO<R | R1, never, void>;
|
167
|
+
event(value: A): IO<never, never, void>;
|
133
168
|
}
|
134
169
|
/**
|
135
170
|
* @tsplus pipeable fncts.io.Push map 1
|
@@ -160,8 +195,13 @@ export declare function merge<R1, E1, B>(that: Push<R1, E1, B>): <R, E, A>(self:
|
|
160
195
|
* @tsplus static fncts.io.PushOps mergeAll
|
161
196
|
* @tsplus location "@fncts/io/Push/api"
|
162
197
|
*/
|
163
|
-
export declare function mergeAll<A extends ReadonlyArray<Push<any, any, any>>>(streams: [...A]): Push<
|
198
|
+
export declare function mergeAll<A extends ReadonlyArray<Push<any, any, any>>>(streams: [...A]): Push<Push.EnvironmentOf<A[number]>, Push.ErrorOf<A[number]>, Push.ValueOf<A[number]>>;
|
164
199
|
export declare function mergeAll<R, E, A>(streams: Iterable<Push<R, E, A>>): Push<R, E, A>;
|
200
|
+
/**
|
201
|
+
* @tsplus pipeable fncts.io.Push observe
|
202
|
+
* @tsplus location "@fncts/io/Push/api"
|
203
|
+
*/
|
204
|
+
export declare function observe<A, R1, E1>(f: (a: A) => IO<R1, E1, void>, __tsplusTrace?: string): <R, E>(self: Push<R, E, A>) => IO<import("../Scope.js").Scope | R1 | R, E1 | E, void>;
|
165
205
|
/**
|
166
206
|
* @tsplus static fncts.io.PushOps repeatIOMaybe
|
167
207
|
* @tsplus location "@fncts/io/Push/api"
|
@@ -188,10 +228,20 @@ export declare function scoped<R, E, A>(io: Lazy<IO<R, E, A>>, __tsplusTrace?: s
|
|
188
228
|
*/
|
189
229
|
export declare function succeed<A>(value: Lazy<A>): Push<never, never, A>;
|
190
230
|
/**
|
191
|
-
* @tsplus pipeable fncts.io.
|
231
|
+
* @tsplus pipeable fncts.io.Push switchMap
|
192
232
|
* @tsplus location "@fncts/io/Push/api"
|
193
233
|
*/
|
194
234
|
export declare function switchMap<A, R1, E1, B>(f: (a: A) => Push<R1, E1, B>): <R, E>(self: Push<R, E, A>) => Push<R1 | R, E1 | E, B>;
|
235
|
+
/**
|
236
|
+
* @tsplus pipeable fncts.io.Push switchMapIO
|
237
|
+
* @tsplus location "@fncts/io/Push/api"
|
238
|
+
*/
|
239
|
+
export declare function switchMapIO<A, R1, E1, B>(f: (a: A) => IO<R1, E1, B>): <R, E>(self: Push<R, E, A>) => Push<R1 | R, E1 | E, B>;
|
240
|
+
/**
|
241
|
+
* @tsplus pipeable fncts.io.Push tap
|
242
|
+
* @tsplus location "@fncts/io/Push/api"
|
243
|
+
*/
|
244
|
+
export declare function tap<A, R1, E1, B>(f: (a: A) => IO<R1, E1, B>): <R, E>(self: Push<R, E, A>) => Push<R1 | R, E1 | E, A>;
|
195
245
|
/**
|
196
246
|
* @tsplus pipeable fncts.io.Push transform
|
197
247
|
* @tsplus location "@fncts/io/Push/api"
|