@fncts/io 0.0.9 → 0.0.12
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/runtime.d.ts +8 -1
- 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 +1 -1
- package/_cjs/Cached/api.cjs.map +1 -1
- package/_cjs/Channel/api/mapOutIOC.cjs +1 -1
- package/_cjs/Channel/api/mapOutIOC.cjs.map +1 -1
- package/_cjs/Channel/api/mergeAllWith.cjs +2 -2
- package/_cjs/Channel/api/mergeAllWith.cjs.map +1 -1
- package/_cjs/Channel/api/mergeWith.cjs +1 -1
- package/_cjs/Channel/api/mergeWith.cjs.map +1 -1
- package/_cjs/Channel/api.cjs +87 -32
- package/_cjs/Channel/api.cjs.map +1 -1
- package/_cjs/Channel/internal/MergeDecision.cjs +11 -2
- package/_cjs/Channel/internal/MergeDecision.cjs.map +1 -1
- package/_cjs/IO/api/foreachC.cjs +2 -2
- package/_cjs/IO/api/foreachC.cjs.map +1 -1
- package/_cjs/IO/runtime.cjs +18 -7
- package/_cjs/IO/runtime.cjs.map +1 -1
- package/_cjs/STM/api.cjs +15 -6
- package/_cjs/STM/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 +29 -29
- 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/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/demo.cjs +15 -0
- package/_cjs/demo.cjs.map +1 -0
- package/_mjs/Cached/api.mjs +1 -1
- package/_mjs/Cached/api.mjs.map +1 -1
- package/_mjs/Channel/api/mapOutIOC.mjs +1 -1
- package/_mjs/Channel/api/mapOutIOC.mjs.map +1 -1
- package/_mjs/Channel/api/mergeAllWith.mjs +2 -2
- package/_mjs/Channel/api/mergeAllWith.mjs.map +1 -1
- package/_mjs/Channel/api/mergeWith.mjs +1 -1
- package/_mjs/Channel/api/mergeWith.mjs.map +1 -1
- package/_mjs/Channel/api.mjs +75 -30
- package/_mjs/Channel/api.mjs.map +1 -1
- package/_mjs/Channel/internal/MergeDecision.mjs +7 -0
- package/_mjs/Channel/internal/MergeDecision.mjs.map +1 -1
- package/_mjs/IO/api/foreachC.mjs +2 -2
- package/_mjs/IO/api/foreachC.mjs.map +1 -1
- package/_mjs/IO/runtime.mjs +15 -5
- package/_mjs/IO/runtime.mjs.map +1 -1
- package/_mjs/STM/api.mjs +13 -6
- package/_mjs/STM/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 +29 -29
- 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/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/demo.mjs +7 -0
- package/_mjs/demo.mjs.map +1 -0
- package/_src/Channel/api.ts +98 -11
- package/_src/Channel/internal/MergeDecision.ts +15 -0
- package/_src/IO/api.ts +1 -1
- package/_src/IO/runtime.ts +18 -11
- 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/_src/demo.ts +6 -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/demo.d.ts +1 -0
- package/package.json +3 -3
package/Channel/api.d.ts
CHANGED
@@ -12,6 +12,7 @@ import { Queue } from "@fncts/io/Queue/definition";
|
|
12
12
|
import { FiberId } from "@fncts/base/data/FiberId";
|
13
13
|
import { Has } from "@fncts/base/typeclass/Has";
|
14
14
|
import { Scope } from "@fncts/io/Scope/definition";
|
15
|
+
import { Hub } from "@fncts/io/Hub/definition";
|
15
16
|
import type { AsyncInputConsumer } from "@fncts/io/Channel/internal/AsyncInputConsumer";
|
16
17
|
import type { AsyncInputProducer } from "@fncts/io/Channel/internal/AsyncInputProducer";
|
17
18
|
import type { UpstreamPullRequest } from "@fncts/io/Channel/UpstreamPullRequest";
|
@@ -88,6 +89,11 @@ export declare function catchAll_<Env, Env1, InErr, InErr1, InElem, InElem1, InD
|
|
88
89
|
* @tsplus location "@fncts/io/Channel/api"
|
89
90
|
*/
|
90
91
|
export declare function catchAllCause_<Env, Env1, InErr, InErr1, InElem, InElem1, InDone, InDone1, OutErr, OutErr1, OutElem, OutElem1, OutDone, OutDone1>(self: Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>, f: (cause: Cause<OutErr>) => Channel<Env1, InErr1, InElem1, InDone1, OutErr1, OutElem1, OutDone1>): Channel<Env & Env1, InErr & InErr1, InElem & InElem1, InDone & InDone1, OutErr1, OutElem | OutElem1, OutDone | OutDone1>;
|
92
|
+
/**
|
93
|
+
* @tsplus getter fncts.io.Channel collectElements
|
94
|
+
* @tsplus location "@fncts/io/Channel/api"
|
95
|
+
*/
|
96
|
+
export declare function collectElements<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>(self: Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>): Channel<Env, InErr, InElem, InDone, OutErr, never, readonly [Conc<OutElem>, OutDone]>;
|
91
97
|
/**
|
92
98
|
* @tsplus getter fncts.io.Channel concatAll
|
93
99
|
* @tsplus location "@fncts/io/Channel/api"
|
@@ -246,7 +252,7 @@ export declare function fromQueue<Err, Elem, Done>(queue: Queue.Dequeue<Either<E
|
|
246
252
|
* @tsplus fluent fncts.io.Channel provideEnvironment
|
247
253
|
* @tsplus location "@fncts/io/Channel/api"
|
248
254
|
*/
|
249
|
-
export declare function provideEnvironment_<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>(self: Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>, env: Environment<Env
|
255
|
+
export declare function provideEnvironment_<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>(self: Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>, env: Lazy<Environment<Env>>): Channel<unknown, InErr, InElem, InDone, OutErr, OutElem, OutDone>;
|
250
256
|
/**
|
251
257
|
* @tsplus fluent fncts.io.Channel contramapEnvironment
|
252
258
|
* @tsplus location "@fncts/io/Channel/api"
|
@@ -318,6 +324,12 @@ export declare function mapOutIO_<Env, Env1, InErr, InElem, InDone, OutErr, OutE
|
|
318
324
|
* @tsplus location "@fncts/io/Channel/api"
|
319
325
|
*/
|
320
326
|
export declare function matchCauseChannel_<Env, Env1, Env2, InErr, InErr1, InErr2, InElem, InElem1, InElem2, InDone, InDone1, InDone2, OutErr, OutErr2, OutErr3, OutElem, OutElem1, OutElem2, OutDone, OutDone2, OutDone3>(channel: Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>, onError: (c: Cause<OutErr>) => Channel<Env1, InErr1, InElem1, InDone1, OutErr2, OutElem1, OutDone2>, onSuccess: (o: OutDone) => Channel<Env2, InErr2, InElem2, InDone2, OutErr3, OutElem2, OutDone3>): Channel<Env & Env1 & Env2, InErr & InErr1 & InErr2, InElem & InElem1 & InElem2, InDone & InDone1 & InDone2, OutErr2 | OutErr3, OutElem | OutElem1 | OutElem2, OutDone2 | OutDone3>;
|
327
|
+
/**
|
328
|
+
* Fold the channel exposing success and full error cause
|
329
|
+
* @tsplus fluent fncts.io.Channel matchChannel
|
330
|
+
* @tsplus location "@fncts/io/Channel/api"
|
331
|
+
*/
|
332
|
+
export declare function matchChannel_<Env, Env1, Env2, InErr, InErr1, InErr2, InElem, InElem1, InElem2, InDone, InDone1, InDone2, OutErr, OutErr2, OutErr3, OutElem, OutElem1, OutElem2, OutDone, OutDone2, OutDone3>(channel: Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>, onError: (e: OutErr) => Channel<Env1, InErr1, InElem1, InDone1, OutErr2, OutElem1, OutDone2>, onSuccess: (o: OutDone) => Channel<Env2, InErr2, InElem2, InDone2, OutErr3, OutElem2, OutDone3>): Channel<Env & Env1 & Env2, InErr & InErr1 & InErr2, InElem & InElem1 & InElem2, InDone & InDone1 & InDone2, OutErr2 | OutErr3, OutElem | OutElem1 | OutElem2, OutDone2 | OutDone3>;
|
321
333
|
export declare const never: Channel<unknown, unknown, unknown, unknown, never, never, never>;
|
322
334
|
/**
|
323
335
|
* Returns a new channel that will perform the operations of this one, until failure, and then
|
@@ -339,6 +351,7 @@ export declare function orHaltWith_<Env, InErr, InElem, InDone, OutErr, OutElem,
|
|
339
351
|
/**
|
340
352
|
* Pipe the output of a channel into the input of another
|
341
353
|
* @tsplus fluent fncts.io.Channel pipeTo
|
354
|
+
* @tsplus operator fncts.io.Channel >>>
|
342
355
|
* @tsplus location "@fncts/io/Channel/api"
|
343
356
|
*/
|
344
357
|
export declare function pipeTo_<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone, Env1, OutErr1, OutElem1, OutDone1>(left: Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>, right: Channel<Env1, OutErr, OutElem, OutDone, OutErr1, OutElem1, OutDone1>): Channel<Env & Env1, InErr, InElem, InDone, OutErr1, OutElem1, OutDone1>;
|
@@ -376,10 +389,10 @@ export declare function readWith<Env, Env1, Env2, InErr, InElem, InDone, OutErr,
|
|
376
389
|
*/
|
377
390
|
export declare function repeated<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>(self: Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>): Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>;
|
378
391
|
/**
|
379
|
-
* @tsplus static fncts.io.
|
392
|
+
* @tsplus static fncts.io.ChannelOps toQueue
|
380
393
|
* @tsplus location "@fncts/io/Channel/api"
|
381
394
|
*/
|
382
|
-
export declare function toQueue<Err, Done, Elem>(queue: Queue.Enqueue<Either<Exit<Err, Done>, Elem
|
395
|
+
export declare function toQueue<Err, Done, Elem>(queue: Lazy<Queue.Enqueue<Either<Exit<Err, Done>, Elem>>>): Channel<unknown, Err, Elem, Done, never, never, unknown>;
|
383
396
|
/**
|
384
397
|
* Writes an output to the channel
|
385
398
|
* @tsplus static fncts.io.ChannelOps write
|
@@ -418,4 +431,14 @@ export declare function unwrap<R, E, Env, InErr, InElem, InDone, OutErr, OutElem
|
|
418
431
|
* @tsplus static fncts.io.ChannelOps unwrapScoped
|
419
432
|
* @tsplus location "@fncts/io/Channel/api"
|
420
433
|
*/
|
421
|
-
export declare function unwrapScoped<R, E, Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>(self: IO<R & Has<Scope>, E, Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone
|
434
|
+
export declare function unwrapScoped<R, E, Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>(self: Lazy<IO<R & Has<Scope>, E, Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>>>): Channel<R & Env, InErr, InElem, InDone, E | OutErr, OutElem, OutDone>;
|
435
|
+
/**
|
436
|
+
* @tsplus static fncts.io.ChannelOps fromHubScoped
|
437
|
+
* @tsplus location "@fncts/io/Channel/api"
|
438
|
+
*/
|
439
|
+
export declare function fromHubScoped<Err, Done, Elem>(hub: Lazy<Hub<Either<Exit<Err, Done>, Elem>>>): IO<Has<Scope>, never, Channel<unknown, unknown, unknown, unknown, Err, Elem, Done>>;
|
440
|
+
/**
|
441
|
+
* @tsplus static fncts.io.ChannelOps toHub
|
442
|
+
* @tsplus location "@fncts/io/Channel/api"
|
443
|
+
*/
|
444
|
+
export declare function toHub<Err, Done, Elem>(hub: Lazy<Hub<Either<Exit<Err, Done>, Elem>>>): Channel<unknown, Err, Elem, Done, never, never, unknown>;
|
@@ -18,6 +18,20 @@ export declare abstract class MergeDecision<R, E0, Z0, E, Z> {
|
|
18
18
|
readonly _E: () => E;
|
19
19
|
readonly _Z: () => Z;
|
20
20
|
}
|
21
|
+
/**
|
22
|
+
* @tsplus unify fncts.io.Channel.MergeDecision
|
23
|
+
*/
|
24
|
+
export declare function unifyMergeDecision<X extends MergeDecision<any, any, any, any, any>>(_: X): MergeDecision<[
|
25
|
+
X
|
26
|
+
] extends [MergeDecision<infer R, any, any, any, any>] ? R : never, [
|
27
|
+
X
|
28
|
+
] extends [MergeDecision<any, infer E0, any, any, any>] ? E0 : never, [
|
29
|
+
X
|
30
|
+
] extends [MergeDecision<any, any, infer Z0, any, any>] ? Z0 : never, [
|
31
|
+
X
|
32
|
+
] extends [MergeDecision<any, any, any, infer E, any>] ? E : never, [
|
33
|
+
X
|
34
|
+
] extends [MergeDecision<any, any, any, any, infer Z>] ? Z : never>;
|
21
35
|
/**
|
22
36
|
* @tsplus fluent fncts.io.Channel.MergeDecision concrete
|
23
37
|
* @tsplus macro remove
|
package/IO/runtime.d.ts
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
import { Environment } from "@fncts/base/data/Environment";
|
2
2
|
import { RuntimeConfig } from "@fncts/io/RuntimeConfig";
|
3
3
|
import { IO, URIO } from "@fncts/io/IO/definition";
|
4
|
-
import { Exit } from "@fncts/base/data/Exit";
|
5
4
|
import { FiberId } from "@fncts/base/data/FiberId";
|
6
5
|
import { TraceElement } from "@fncts/base/data/TraceElement/definition";
|
7
6
|
import { InterruptStatus } from "@fncts/io/InterruptStatus";
|
@@ -11,10 +10,13 @@ import { Cons } from "@fncts/base/collection/immutable/List";
|
|
11
10
|
import { FiberScope } from "@fncts/io/FiberScope/definition";
|
12
11
|
import { Supervisor } from "@fncts/io/Supervisor/definition";
|
13
12
|
import { Nothing } from "@fncts/base/data/Maybe";
|
13
|
+
import { Exit } from "@fncts/base/data/Exit";
|
14
|
+
import { FiberContext } from "@fncts/io/Fiber";
|
14
15
|
export declare class Runtime<R> {
|
15
16
|
readonly environment: Environment<R>;
|
16
17
|
readonly runtimeConfig: RuntimeConfig;
|
17
18
|
constructor(environment: Environment<R>, runtimeConfig: RuntimeConfig);
|
19
|
+
unsafeRunFiber: <E, A>(io: import("@fncts/io/IO/definition").IO<R, E, A>, __tsplusTrace?: string) => FiberContext<E, A>;
|
18
20
|
unsafeRunWith: <E, A>(io: import("@fncts/io/IO/definition").IO<R, E, A>, k: (exit: import("@fncts/base/data/Exit").Exit<E, A>) => any, __tsplusTrace?: string) => (fiberId: FiberId) => (f: (exit: import("@fncts/base/data/Exit").Exit<E, A>) => any) => void;
|
19
21
|
unsafeRunAsync: <E, A>(io: import("@fncts/io/IO/definition").IO<R, E, A>, __tsplusTrace?: string) => void;
|
20
22
|
unsafeRunAsyncWith: <E, A>(io: import("@fncts/io/IO/definition").IO<R, E, A>, k: (exit: import("@fncts/base/data/Exit").Exit<E, A>) => any, __tsplusTrace?: string) => void;
|
@@ -27,6 +29,11 @@ export declare class Runtime<R> {
|
|
27
29
|
export declare function runtime<R>(__tsplusTrace?: string): URIO<R, Runtime<R>>;
|
28
30
|
export declare const defaultRuntimeConfig: import("../RuntimeConfig").RuntimeConfig;
|
29
31
|
export declare const defaultRuntime: Runtime<unknown>;
|
32
|
+
/**
|
33
|
+
* @tsplus fluent fncts.io.IO unsafeRunFiber
|
34
|
+
* @tsplus location "@fncts/io/IO/runtime"
|
35
|
+
*/
|
36
|
+
export declare const unsafeRunFiber: <E, A>(io: import("@fncts/io/IO/definition").IO<unknown, E, A>, __tsplusTrace?: string) => FiberContext<E, A>;
|
30
37
|
/**
|
31
38
|
* @tsplus fluent fncts.io.IO unsafeRunAsync
|
32
39
|
* @tsplus location "@fncts/io/IO/runtime"
|
package/STM/api.d.ts
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
import { Lazy } from "@fncts/base/data/function";
|
2
2
|
import { Maybe } from "@fncts/base/data/Maybe";
|
3
3
|
import { Either } from "@fncts/base/data/Either";
|
4
|
+
import { FiberId } from "@fncts/base/data/FiberId";
|
4
5
|
import { IO } from "@fncts/io/IO/definition";
|
5
6
|
import { Environment } from "@fncts/base/data/Environment";
|
6
7
|
import { Refinement } from "@fncts/base/data/Refinement";
|
7
8
|
import { Predicate } from "@fncts/base/data/Predicate";
|
9
|
+
import type { Journal } from "./internal/Journal.js";
|
8
10
|
import { STM } from "./definition.js";
|
9
11
|
/**
|
10
12
|
* Maps the success value of this effect to the specified constant value.
|
@@ -31,6 +33,11 @@ export declare function asJustError<R, E, A>(stm: STM<R, E, A>): STM<R, Maybe<E>
|
|
31
33
|
* @tsplus location "@fncts/io/STM/api"
|
32
34
|
*/
|
33
35
|
export declare function absolve<R, E, E1, A>(z: STM<R, E, Either<E1, A>>): STM<R, E | E1, A>;
|
36
|
+
/**
|
37
|
+
* @tsplus static fncts.io.STMOps Effect
|
38
|
+
* @tsplus location "@fncts/io/STM/api"
|
39
|
+
*/
|
40
|
+
export declare function makeEffect<R, E, A>(f: (journal: Journal, fiberId: FiberId, r: R) => A): STM<R, E, A>;
|
34
41
|
/**
|
35
42
|
* Retrieves the environment inside an stm.
|
36
43
|
* @tsplus static fncts.io.STMOps environment
|