@fncts/io 0.0.34 → 0.0.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Fiber/FiberRuntime.d.ts +7 -7
- 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 +25 -4
- package/Push/definition.d.ts +17 -0
- package/STM/definition.d.ts +2 -2
- package/Sink/api.d.ts +19 -19
- 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/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/Push/api.cjs +149 -110
- package/_cjs/Push/api.cjs.map +1 -1
- package/_cjs/Push/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/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/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/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/Push/api.mjs +145 -109
- package/_mjs/Push/api.mjs.map +1 -1
- package/_mjs/Push/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/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/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/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 -199
- package/_src/IO.ts +1 -0
- package/_src/Push/api.ts +70 -4
- package/_src/Push/definition.ts +6 -0
- package/_src/STM/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/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,16 +1,17 @@
|
|
|
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";
|
|
4
|
+
import { IO } from "@fncts/io/IO/definition";
|
|
2
5
|
import { Duration } from "@fncts/base/data/Duration/definition";
|
|
3
6
|
import { Fiber } from "@fncts/io/Fiber/definition";
|
|
4
|
-
import { IO } from "@fncts/io/IO/definition";
|
|
5
7
|
import { Environment } from "@fncts/base/data/Environment/definition";
|
|
6
8
|
import { Future } from "@fncts/io/Future";
|
|
7
9
|
import { Scope } from "@fncts/io/Scope/definition";
|
|
8
10
|
import { Schedule } from "@fncts/io/Schedule/definition";
|
|
9
|
-
import { Cause } from "@fncts/base/data/Cause/definition";
|
|
10
11
|
import { Nothing, Just, Maybe } from "@fncts/base/data/Maybe/definition";
|
|
11
12
|
import { FiberId } from "@fncts/base/data/FiberId/definition";
|
|
12
13
|
import { Conc } from "@fncts/base/collection/immutable/Conc";
|
|
13
|
-
import type {
|
|
14
|
+
import type { _E, _R } from "@fncts/base/types";
|
|
14
15
|
import { AtomicReference } from "@fncts/base/internal/AtomicReference";
|
|
15
16
|
import { Emitter, Push, PushTypeId, PushVariance } from "./definition.js";
|
|
16
17
|
/**
|
|
@@ -18,6 +19,21 @@ import { Emitter, Push, PushTypeId, PushVariance } from "./definition.js";
|
|
|
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 UnsafeEmitter<E, A> {
|
|
23
|
+
emit: (value: A) => void;
|
|
24
|
+
failCause: (cause: Cause<E>) => void;
|
|
25
|
+
end: () => void;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* @tsplus static fncts.io.PushOps asyncInterrupt
|
|
29
|
+
* @tsplus location "@fncts/io/Push/api"
|
|
30
|
+
*/
|
|
31
|
+
export declare function asyncInterrupt<R, E, A>(make: (emitter: UnsafeEmitter<E, A>) => Either<IO<R, never, void>, Push<R, E, A>>): Push<R, E, A>;
|
|
32
|
+
/**
|
|
33
|
+
* @tsplus static fncts.io.PushOps async
|
|
34
|
+
* @tsplus location "@fncts/io/Push/api"
|
|
35
|
+
*/
|
|
36
|
+
export declare function async<E, A>(make: (emitter: UnsafeEmitter<E, A>) => void): Push<never, E, A>;
|
|
21
37
|
/**
|
|
22
38
|
* @tsplus static fncts.io.PushOps combineLatest
|
|
23
39
|
* @tsplus location "@fncts/io/Push/api"
|
|
@@ -160,8 +176,13 @@ export declare function merge<R1, E1, B>(that: Push<R1, E1, B>): <R, E, A>(self:
|
|
|
160
176
|
* @tsplus static fncts.io.PushOps mergeAll
|
|
161
177
|
* @tsplus location "@fncts/io/Push/api"
|
|
162
178
|
*/
|
|
163
|
-
export declare function mergeAll<A extends ReadonlyArray<Push<any, any, any>>>(streams: [...A]): Push<
|
|
179
|
+
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
180
|
export declare function mergeAll<R, E, A>(streams: Iterable<Push<R, E, A>>): Push<R, E, A>;
|
|
181
|
+
/**
|
|
182
|
+
* @tsplus pipeable fncts.io.Push observe
|
|
183
|
+
* @tsplus location "@fncts/io/Push/api"
|
|
184
|
+
*/
|
|
185
|
+
export declare function observe<A, R1, E1>(f: (a: A) => IO<R1, E1, void>, __tsplusTrace?: string): <R, E>(self: Push<R, E, A>) => import("../IO.js").IO<import("../Scope.js").Scope | R1 | R, E1 | E, void>;
|
|
165
186
|
/**
|
|
166
187
|
* @tsplus static fncts.io.PushOps repeatIOMaybe
|
|
167
188
|
* @tsplus location "@fncts/io/Push/api"
|
package/Push/definition.d.ts
CHANGED
|
@@ -19,6 +19,23 @@ export declare class Push<R, E, A> {
|
|
|
19
19
|
};
|
|
20
20
|
constructor(run: <R1>(emitter: Emitter<R1, E, A>) => IO<R | R1 | Scope, never, unknown>);
|
|
21
21
|
}
|
|
22
|
+
export declare namespace Push {
|
|
23
|
+
type EnvironmentOf<X> = [X] extends [{
|
|
24
|
+
[PushVariance]: {
|
|
25
|
+
readonly _R: (_: never) => infer R;
|
|
26
|
+
};
|
|
27
|
+
}] ? R : never;
|
|
28
|
+
type ErrorOf<X> = [X] extends [{
|
|
29
|
+
[PushVariance]: {
|
|
30
|
+
readonly _E: (_: never) => infer E;
|
|
31
|
+
};
|
|
32
|
+
}] ? E : never;
|
|
33
|
+
type ValueOf<X> = [X] extends [{
|
|
34
|
+
[PushVariance]: {
|
|
35
|
+
readonly _A: (_: never) => infer A;
|
|
36
|
+
};
|
|
37
|
+
}] ? A : never;
|
|
38
|
+
}
|
|
22
39
|
/**
|
|
23
40
|
* @tsplus type fncts.io.Push.Emitter
|
|
24
41
|
* @tsplus companion fncts.io.Push.EmitterOps
|
package/STM/definition.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { FiberId } from "@fncts/base/data/FiberId/definition";
|
|
|
2
2
|
import { Environment } from "@fncts/base/data/Environment/definition";
|
|
3
3
|
import type { Journal } from "./internal/Journal.js";
|
|
4
4
|
import type { _A, _E, _R } from "@fncts/base/types";
|
|
5
|
-
import {
|
|
5
|
+
import { IOTag, IOTypeId, IOVariance } from "@fncts/io/IO/definition";
|
|
6
6
|
export declare const enum STMTag {
|
|
7
7
|
Effect = "Effect",
|
|
8
8
|
OnFailure = "OnFailure",
|
|
@@ -22,7 +22,7 @@ export type STMTypeId = typeof STMTypeId;
|
|
|
22
22
|
*/
|
|
23
23
|
export declare abstract class STM<R, E, A> {
|
|
24
24
|
readonly [IOTypeId]: IOTypeId;
|
|
25
|
-
readonly _tag =
|
|
25
|
+
readonly _tag = IOTag.Commit;
|
|
26
26
|
readonly trace?: string;
|
|
27
27
|
readonly [STMTypeId]: STMTypeId;
|
|
28
28
|
[IOVariance]: {
|