@fncts/io 0.0.49 → 0.0.50
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/IO/api/foreachExec.d.ts +18 -0
- package/Push/Bounds.d.ts +4 -0
- package/Push/FlattenStrategy.d.ts +47 -0
- package/Push/IndexedBuffer.d.ts +19 -0
- package/Push/MergeStrategy.d.ts +19 -0
- package/Push/Operator/IOLoopOperator.d.ts +61 -0
- package/Push/Operator/IOOperator.d.ts +63 -0
- package/Push/Operator/LoopOperator.d.ts +50 -0
- package/Push/Operator/SyncOperator.d.ts +41 -0
- package/Push/Operator.d.ts +4 -0
- package/Push/Producer/IOProducer.d.ts +41 -0
- package/Push/Producer/SyncProducer.d.ts +61 -0
- package/Push/Producer.d.ts +1 -0
- package/Push/Sink.d.ts +65 -0
- package/Push/api.d.ts +78 -161
- package/Push/definition.d.ts +92 -19
- package/Push/internal.d.ts +3 -0
- package/Push.d.ts +6 -0
- package/Ref/Synchronized/definition.d.ts +32 -9
- package/Ref/definition.d.ts +12 -0
- package/Scope/api.d.ts +16 -1
- package/Sink/definition.d.ts +5 -6
- package/Subject/Atomic.d.ts +19 -9
- package/Subject/DeferredRef.d.ts +17 -0
- package/Subject/Hold.d.ts +19 -0
- package/Subject/RefSubject/Atomic.d.ts +41 -0
- package/Subject/RefSubject/Derived.d.ts +43 -0
- package/Subject/RefSubject/RefSubject.d.ts +27 -0
- package/Subject/definition.d.ts +14 -2
- package/Subject.d.ts +2 -0
- package/SubscriptionRef.d.ts +0 -1
- package/_cjs/IO/api/foreachExec.cjs +29 -4
- package/_cjs/IO/api/foreachExec.cjs.map +1 -1
- package/_cjs/Push/Bounds.cjs +2 -0
- package/_cjs/Push/Bounds.cjs.map +1 -0
- package/_cjs/Push/FlattenStrategy.cjs +95 -0
- package/_cjs/Push/FlattenStrategy.cjs.map +1 -0
- package/_cjs/Push/IndexedBuffer.cjs +70 -0
- package/_cjs/Push/IndexedBuffer.cjs.map +1 -0
- package/_cjs/Push/MergeStrategy.cjs +45 -0
- package/_cjs/Push/MergeStrategy.cjs.map +1 -0
- package/_cjs/Push/Operator/IOLoopOperator.cjs +225 -0
- package/_cjs/Push/Operator/IOLoopOperator.cjs.map +1 -0
- package/_cjs/Push/Operator/IOOperator.cjs +104 -0
- package/_cjs/Push/Operator/IOOperator.cjs.map +1 -0
- package/_cjs/Push/Operator/LoopOperator.cjs +165 -0
- package/_cjs/Push/Operator/LoopOperator.cjs.map +1 -0
- package/_cjs/Push/Operator/SyncOperator.cjs +78 -0
- package/_cjs/Push/Operator/SyncOperator.cjs.map +1 -0
- package/_cjs/Push/Operator.cjs +2 -0
- package/_cjs/Push/Operator.cjs.map +1 -0
- package/_cjs/Push/Producer/IOProducer.cjs +67 -0
- package/_cjs/Push/Producer/IOProducer.cjs.map +1 -0
- package/_cjs/Push/Producer/SyncProducer.cjs +107 -0
- package/_cjs/Push/Producer/SyncProducer.cjs.map +1 -0
- package/_cjs/Push/Producer.cjs +2 -0
- package/_cjs/Push/Producer.cjs.map +1 -0
- package/_cjs/Push/Sink.cjs +219 -0
- package/_cjs/Push/Sink.cjs.map +1 -0
- package/_cjs/Push/api.cjs +339 -383
- package/_cjs/Push/api.cjs.map +1 -1
- package/_cjs/Push/definition.cjs +79 -22
- package/_cjs/Push/definition.cjs.map +1 -1
- package/_cjs/Push/internal.cjs +31 -26
- package/_cjs/Push/internal.cjs.map +1 -1
- package/_cjs/Push.cjs +66 -0
- package/_cjs/Push.cjs.map +1 -1
- package/_cjs/Ref/Synchronized/definition.cjs +12 -12
- package/_cjs/Ref/Synchronized/definition.cjs.map +1 -1
- package/_cjs/Ref/definition.cjs.map +1 -1
- package/_cjs/Scope/api.cjs +28 -7
- package/_cjs/Scope/api.cjs.map +1 -1
- package/_cjs/Sink/definition.cjs +2 -3
- package/_cjs/Sink/definition.cjs.map +1 -1
- package/_cjs/Stream/definition.cjs.map +1 -1
- package/_cjs/Subject/Atomic.cjs +45 -10
- package/_cjs/Subject/Atomic.cjs.map +1 -1
- package/_cjs/Subject/DeferredRef.cjs +53 -0
- package/_cjs/Subject/DeferredRef.cjs.map +1 -0
- package/_cjs/Subject/Hold.cjs +41 -0
- package/_cjs/Subject/Hold.cjs.map +1 -0
- package/_cjs/Subject/RefSubject/Atomic.cjs +130 -0
- package/_cjs/Subject/RefSubject/Atomic.cjs.map +1 -0
- package/_cjs/Subject/RefSubject/Derived.cjs +98 -0
- package/_cjs/Subject/RefSubject/Derived.cjs.map +1 -0
- package/_cjs/Subject/RefSubject/RefSubject.cjs +19 -0
- package/_cjs/Subject/RefSubject/RefSubject.cjs.map +1 -0
- package/_cjs/Subject/definition.cjs +16 -1
- package/_cjs/Subject/definition.cjs.map +1 -1
- package/_cjs/Subject.cjs +22 -0
- package/_cjs/Subject.cjs.map +1 -1
- package/_cjs/SubscriptionRef.cjs +0 -1
- package/_cjs/SubscriptionRef.cjs.map +1 -1
- package/_mjs/IO/api/foreachExec.mjs +27 -4
- package/_mjs/IO/api/foreachExec.mjs.map +1 -1
- package/_mjs/Push/Bounds.mjs +2 -0
- package/_mjs/Push/Bounds.mjs.map +1 -0
- package/_mjs/Push/FlattenStrategy.mjs +86 -0
- package/_mjs/Push/FlattenStrategy.mjs.map +1 -0
- package/_mjs/Push/IndexedBuffer.mjs +61 -0
- package/_mjs/Push/IndexedBuffer.mjs.map +1 -0
- package/_mjs/Push/MergeStrategy.mjs +34 -0
- package/_mjs/Push/MergeStrategy.mjs.map +1 -0
- package/_mjs/Push/Operator/IOLoopOperator.mjs +208 -0
- package/_mjs/Push/Operator/IOLoopOperator.mjs.map +1 -0
- package/_mjs/Push/Operator/IOOperator.mjs +91 -0
- package/_mjs/Push/Operator/IOOperator.mjs.map +1 -0
- package/_mjs/Push/Operator/LoopOperator.mjs +151 -0
- package/_mjs/Push/Operator/LoopOperator.mjs.map +1 -0
- package/_mjs/Push/Operator/SyncOperator.mjs +67 -0
- package/_mjs/Push/Operator/SyncOperator.mjs.map +1 -0
- package/_mjs/Push/Operator.mjs +2 -0
- package/_mjs/Push/Operator.mjs.map +1 -0
- package/_mjs/Push/Producer/IOProducer.mjs +55 -0
- package/_mjs/Push/Producer/IOProducer.mjs.map +1 -0
- package/_mjs/Push/Producer/SyncProducer.mjs +90 -0
- package/_mjs/Push/Producer/SyncProducer.mjs.map +1 -0
- package/_mjs/Push/Producer.mjs +2 -0
- package/_mjs/Push/Producer.mjs.map +1 -0
- package/_mjs/Push/Sink.mjs +206 -0
- package/_mjs/Push/Sink.mjs.map +1 -0
- package/_mjs/Push/api.mjs +311 -344
- package/_mjs/Push/api.mjs.map +1 -1
- package/_mjs/Push/definition.mjs +73 -18
- package/_mjs/Push/definition.mjs.map +1 -1
- package/_mjs/Push/internal.mjs +30 -26
- package/_mjs/Push/internal.mjs.map +1 -1
- package/_mjs/Push.mjs +7 -1
- package/_mjs/Push.mjs.map +1 -1
- package/_mjs/Ref/Synchronized/definition.mjs +12 -12
- package/_mjs/Ref/Synchronized/definition.mjs.map +1 -1
- package/_mjs/Ref/definition.mjs.map +1 -1
- package/_mjs/Scope/api.mjs +22 -4
- package/_mjs/Scope/api.mjs.map +1 -1
- package/_mjs/Sink/definition.mjs +2 -3
- package/_mjs/Sink/definition.mjs.map +1 -1
- package/_mjs/Stream/definition.mjs.map +1 -1
- package/_mjs/Subject/Atomic.mjs +46 -10
- package/_mjs/Subject/Atomic.mjs.map +1 -1
- package/_mjs/Subject/DeferredRef.mjs +45 -0
- package/_mjs/Subject/DeferredRef.mjs.map +1 -0
- package/_mjs/Subject/Hold.mjs +33 -0
- package/_mjs/Subject/Hold.mjs.map +1 -0
- package/_mjs/Subject/RefSubject/Atomic.mjs +122 -0
- package/_mjs/Subject/RefSubject/Atomic.mjs.map +1 -0
- package/_mjs/Subject/RefSubject/Derived.mjs +90 -0
- package/_mjs/Subject/RefSubject/Derived.mjs.map +1 -0
- package/_mjs/Subject/RefSubject/RefSubject.mjs +12 -0
- package/_mjs/Subject/RefSubject/RefSubject.mjs.map +1 -0
- package/_mjs/Subject/definition.mjs +14 -0
- package/_mjs/Subject/definition.mjs.map +1 -1
- package/_mjs/Subject.mjs +2 -0
- package/_mjs/Subject.mjs.map +1 -1
- package/_mjs/SubscriptionRef.mjs +0 -1
- package/_mjs/SubscriptionRef.mjs.map +1 -1
- package/_src/IO/api/foreachExec.ts +47 -0
- package/_src/Push/Bounds.ts +4 -0
- package/_src/Push/FlattenStrategy.ts +137 -0
- package/_src/Push/IndexedBuffer.ts +79 -0
- package/_src/Push/MergeStrategy.ts +59 -0
- package/_src/Push/Operator/IOLoopOperator.ts +413 -0
- package/_src/Push/Operator/IOOperator.ts +173 -0
- package/_src/Push/Operator/LoopOperator.ts +242 -0
- package/_src/Push/Operator/SyncOperator.ts +107 -0
- package/_src/Push/Operator.ts +7 -0
- package/_src/Push/Producer/IOProducer.ts +83 -0
- package/_src/Push/Producer/SyncProducer.ts +105 -0
- package/_src/Push/Producer.ts +0 -0
- package/_src/Push/Sink.ts +302 -0
- package/_src/Push/api.ts +387 -513
- package/_src/Push/definition.ts +216 -23
- package/_src/Push/internal.ts +11 -0
- package/_src/Push.ts +7 -1
- package/_src/Ref/Synchronized/definition.ts +81 -37
- package/_src/Ref/definition.ts +26 -0
- package/_src/Scope/api.ts +22 -0
- package/_src/Sink/definition.ts +4 -5
- package/_src/Stream/definition.ts +0 -1
- package/_src/Subject/Atomic.ts +68 -11
- package/_src/Subject/DeferredRef.ts +44 -0
- package/_src/Subject/Hold.ts +48 -0
- package/_src/Subject/RefSubject/Atomic.ts +193 -0
- package/_src/Subject/RefSubject/Derived.ts +179 -0
- package/_src/Subject/RefSubject/RefSubject.ts +90 -0
- package/_src/Subject/definition.ts +21 -3
- package/_src/Subject.ts +5 -3
- package/_src/SubscriptionRef.ts +1 -1
- package/_src/index.ts +49 -50
- package/index.d.ts +0 -1
- package/package.json +4 -4
- package/RefSubject/Atomic.d.ts +0 -34
- package/RefSubject/Synchronized/api.d.ts +0 -9
- package/RefSubject/Synchronized/definition.d.ts +0 -39
- package/RefSubject/api.d.ts +0 -120
- package/RefSubject/definition.d.ts +0 -52
- package/RefSubject.d.ts +0 -3
- package/_cjs/RefSubject/Atomic.cjs +0 -107
- package/_cjs/RefSubject/Atomic.cjs.map +0 -1
- package/_cjs/RefSubject/Synchronized/api.cjs +0 -22
- package/_cjs/RefSubject/Synchronized/api.cjs.map +0 -1
- package/_cjs/RefSubject/Synchronized/definition.cjs +0 -55
- package/_cjs/RefSubject/Synchronized/definition.cjs.map +0 -1
- package/_cjs/RefSubject/api.cjs +0 -251
- package/_cjs/RefSubject/api.cjs.map +0 -1
- package/_cjs/RefSubject/definition.cjs +0 -26
- package/_cjs/RefSubject/definition.cjs.map +0 -1
- package/_cjs/RefSubject.cjs +0 -39
- package/_cjs/RefSubject.cjs.map +0 -1
- package/_mjs/RefSubject/Atomic.mjs +0 -99
- package/_mjs/RefSubject/Atomic.mjs.map +0 -1
- package/_mjs/RefSubject/Synchronized/api.mjs +0 -15
- package/_mjs/RefSubject/Synchronized/api.mjs.map +0 -1
- package/_mjs/RefSubject/Synchronized/definition.mjs +0 -47
- package/_mjs/RefSubject/Synchronized/definition.mjs.map +0 -1
- package/_mjs/RefSubject/api.mjs +0 -229
- package/_mjs/RefSubject/api.mjs.map +0 -1
- package/_mjs/RefSubject/definition.mjs +0 -19
- package/_mjs/RefSubject/definition.mjs.map +0 -1
- package/_mjs/RefSubject.mjs +0 -5
- package/_mjs/RefSubject.mjs.map +0 -1
- package/_src/RefSubject/Atomic.ts +0 -129
- package/_src/RefSubject/Synchronized/api.ts +0 -14
- package/_src/RefSubject/Synchronized/definition.ts +0 -76
- package/_src/RefSubject/api.ts +0 -253
- package/_src/RefSubject/definition.ts +0 -70
- package/_src/RefSubject.ts +0 -5
package/IO/api/foreachExec.d.ts
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import { ExecutionStrategy } from "@fncts/base/data/ExecutionStrategy";
|
|
2
2
|
import { IO } from "@fncts/io/IO/definition";
|
|
3
3
|
import { Conc } from "@fncts/base/collection/immutable/Conc";
|
|
4
|
+
/**
|
|
5
|
+
* Applies the function `f` to each element of the `Iterable<A>` in parallel,
|
|
6
|
+
* and returns the results in a new `Conc<B>`.
|
|
7
|
+
*
|
|
8
|
+
* For a sequential version of this method, see `foreach`.
|
|
9
|
+
* @tsplus static fncts.io.IOOps foreachWithIndexDiscardExec
|
|
10
|
+
* @tsplus location "@fncts/io/IO/api/foreachExec"
|
|
11
|
+
*/
|
|
12
|
+
export declare function foreachWithIndexDiscardExec<R, E, A, B>(as: Iterable<A>, es: ExecutionStrategy, f: (index: number, a: A) => IO<R, E, B>, __tsplusTrace?: string): IO<R, E, void>;
|
|
4
13
|
/**
|
|
5
14
|
* Applies the function `f` to each element of the `Iterable<A>` in parallel,
|
|
6
15
|
* and returns the results in a new `Conc<B>`.
|
|
@@ -10,3 +19,12 @@ import { Conc } from "@fncts/base/collection/immutable/Conc";
|
|
|
10
19
|
* @tsplus location "@fncts/io/IO/api/foreachExec"
|
|
11
20
|
*/
|
|
12
21
|
export declare function foreachExec<R, E, A, B>(as: Iterable<A>, es: ExecutionStrategy, f: (a: A) => IO<R, E, B>, __tsplusTrace?: string): IO<R, E, Conc<B>>;
|
|
22
|
+
/**
|
|
23
|
+
* Applies the function `f` to each element of the `Iterable<A>` in parallel,
|
|
24
|
+
* and returns the results in a new `Conc<B>`.
|
|
25
|
+
*
|
|
26
|
+
* For a sequential version of this method, see `foreach`.
|
|
27
|
+
* @tsplus static fncts.io.IOOps foreachExecDiscard
|
|
28
|
+
* @tsplus location "@fncts/io/IO/api/foreachExec"
|
|
29
|
+
*/
|
|
30
|
+
export declare function foreachDiscardExec<R, E, A, B>(as: Iterable<A>, es: ExecutionStrategy, f: (a: A) => IO<R, E, B>, __tsplusTrace?: string): IO<R, E, void>;
|
package/Push/Bounds.d.ts
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { IO } from "@fncts/io/IO/definition";
|
|
2
|
+
import { Scope } from "@fncts/io/Scope/definition";
|
|
3
|
+
import { Fiber } from "@fncts/io/Fiber/definition";
|
|
4
|
+
import { ExecutionStrategy } from "@fncts/base/data/ExecutionStrategy";
|
|
5
|
+
import { Ref } from "@fncts/io/Ref/definition";
|
|
6
|
+
import { HashSet } from "@fncts/base/collection/immutable/HashSet/definition";
|
|
7
|
+
import { Semaphore } from "@fncts/io/Semaphore";
|
|
8
|
+
type Fork = <R>(io: IO<R, never, void>) => IO<R | Scope, never, void>;
|
|
9
|
+
/**
|
|
10
|
+
* @tsplus type fncts.io.Push.FlattenStrategy
|
|
11
|
+
* @tsplus companion fncts.io.Push.FlattenStrategyOps
|
|
12
|
+
*/
|
|
13
|
+
export declare abstract class FlattenStrategy {
|
|
14
|
+
abstract withFork<R>(f: (fork: Fork, scope: Scope) => IO<R, never, void>, executionStrategy: ExecutionStrategy): IO<R | Scope, never, void>;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* @tsplus static fncts.io.Push.FlattenStrategyOps Switch
|
|
18
|
+
* @tsplus location "@fncts/io/Push/FlattenStrategy"
|
|
19
|
+
*/
|
|
20
|
+
export declare const SwitchStrategy: {
|
|
21
|
+
withFork<R>(f: (fork: Fork, scope: Scope) => IO<R, never, void>, executionStrategy: ExecutionStrategy): IO<R | Scope, never, void>;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* @tsplus static fncts.io.Push.FlattenStrategyOps Exhaust
|
|
25
|
+
* @tsplus location "@fncts/io/Push/FlattenStrategy"
|
|
26
|
+
*/
|
|
27
|
+
export declare const ExhaustStrategy: {
|
|
28
|
+
withFork<R>(f: (fork: Fork, scope: Scope) => IO<R, never, void>, executionStrategy: ExecutionStrategy): IO<R | Scope, never, void>;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* @tsplus static fncts.io.Push.FlattenStrategyOps Unbounded
|
|
32
|
+
* @tsplus location "@fncts/io/Push/FlattenStrategy"
|
|
33
|
+
*/
|
|
34
|
+
export declare const UnboundedStrategy: {
|
|
35
|
+
withFork<R>(f: (fork: Fork, scope: Scope) => IO<R, never, void>): IO<R | Scope, never, void>;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* @tsplus static fncts.io.Push.FlattenStrategyOps Bounded
|
|
39
|
+
* @tsplus location "@fncts/io/Push/FlattenStrategy"
|
|
40
|
+
*/
|
|
41
|
+
export declare function makeBounded(capacity: number): BoundedStrategy;
|
|
42
|
+
declare class BoundedStrategy extends FlattenStrategy {
|
|
43
|
+
readonly capacity: number;
|
|
44
|
+
constructor(capacity: number);
|
|
45
|
+
withFork<R>(f: (fork: Fork, scope: Scope) => IO<R, never, void>, executionStrategy: ExecutionStrategy): IO<R | Scope, never, void>;
|
|
46
|
+
}
|
|
47
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Future } from "@fncts/io/Future";
|
|
2
|
+
import { UIO, IO } from "@fncts/io/IO/definition";
|
|
3
|
+
import { FiberId } from "@fncts/base/data/FiberId/definition";
|
|
4
|
+
import type { Push } from "./definition.js";
|
|
5
|
+
export declare class IndexedBuffer<R, E, A> {
|
|
6
|
+
ready: boolean;
|
|
7
|
+
readonly future: Future<never, void>;
|
|
8
|
+
readonly sink: Push.UnsafeSink<R, E, A>;
|
|
9
|
+
readonly onDone: UIO<void>;
|
|
10
|
+
constructor(ready: boolean, future: Future<never, void>, sink: Push.UnsafeSink<R, E, A>, onDone: UIO<void>);
|
|
11
|
+
buffer: Array<A>;
|
|
12
|
+
onSuccess(value: A): import("../IO.js").IO<R, never, void>;
|
|
13
|
+
get onEnd(): import("../IO.js").IO<R, never, void>;
|
|
14
|
+
}
|
|
15
|
+
export declare const withBuffers: <R, E, A>(size: number, sink: Push.UnsafeSink<R, E, A>, id: FiberId) => {
|
|
16
|
+
onSuccess: (index: number, value: A) => IO<R, never, void>;
|
|
17
|
+
onEnd: (index: number) => IO<R, never, void>;
|
|
18
|
+
buffers: Map<number, IndexedBuffer<R, E, A>>;
|
|
19
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { IO } from "@fncts/io/IO/definition";
|
|
2
|
+
import { ExecutionStrategy } from "@fncts/base/data/ExecutionStrategy";
|
|
3
|
+
import type { Push } from "./definition.js";
|
|
4
|
+
export declare abstract class MergeStrategy {
|
|
5
|
+
abstract runMerge<Ps extends ReadonlyArray<Push<any, any, any>>, R>(ps: Ps, sink: Push.UnsafeSink<R, any, any>): IO<R | Push.EnvironmentOf<Ps[number]>, never, void>;
|
|
6
|
+
}
|
|
7
|
+
export declare class Unordered extends MergeStrategy {
|
|
8
|
+
readonly executionStrategy: ExecutionStrategy;
|
|
9
|
+
constructor(executionStrategy: ExecutionStrategy);
|
|
10
|
+
runMerge<Ps extends ReadonlyArray<Push<any, any, any>>, R>(ps: Ps, sink: Push.UnsafeSink<R, any, any>): IO<R | Push.EnvironmentOf<Ps[number]>, never, void>;
|
|
11
|
+
}
|
|
12
|
+
export declare class Ordered extends MergeStrategy {
|
|
13
|
+
readonly executionStrategy: ExecutionStrategy;
|
|
14
|
+
constructor(executionStrategy: ExecutionStrategy);
|
|
15
|
+
runMerge<Ps extends ReadonlyArray<Push<any, any, any>>, R>(ps: Ps, sink: Push.UnsafeSink<R, any, any>): IO<R | Push.EnvironmentOf<Ps[number]>, never, void>;
|
|
16
|
+
}
|
|
17
|
+
export declare class Switch extends MergeStrategy {
|
|
18
|
+
runMerge<Ps extends ReadonlyArray<Push<any, any, any>>, R>(ps: Ps, sink: Push.UnsafeSink<R, any, any>): IO<R | Push.EnvironmentOf<Ps[number]>, never, void>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { IO } from "@fncts/io/IO/definition";
|
|
2
|
+
import { Maybe } from "@fncts/base/data/Maybe/definition";
|
|
3
|
+
import type { IOOperator } from "./IOOperator.js";
|
|
4
|
+
import type { SyncLoopOperator } from "@fncts/io/Push/Operator/LoopOperator";
|
|
5
|
+
import type { SyncOperator } from "@fncts/io/Push/Operator/SyncOperator";
|
|
6
|
+
export declare const enum IOLoopOperatorTag {
|
|
7
|
+
LoopIO = "LoopIO",
|
|
8
|
+
FilterMapLoopIO = "FilterMapLoopIO"
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* @tsplus type fncts.io.Push.IOLoopOperator
|
|
12
|
+
*/
|
|
13
|
+
export type IOLoopOperator<B = any, A = any, R = any, E = any, C = any> = LoopIOOperator<B, A, R, E, C> | FilterMapLoopIOOperator<B, A, R, E, C>;
|
|
14
|
+
export interface LoopIOOperator<B, A, R, E, C> {
|
|
15
|
+
readonly _tag: IOLoopOperatorTag.LoopIO;
|
|
16
|
+
readonly seed: B;
|
|
17
|
+
readonly f: (acc: B, a: A) => IO<R, E, readonly [C, B]>;
|
|
18
|
+
}
|
|
19
|
+
export declare function LoopIOOperator<const B, A, R, E, C>(seed: B, f: (acc: B, a: A) => IO<R, E, readonly [C, B]>): LoopIOOperator<B, A, R, E, C>;
|
|
20
|
+
export interface FilterMapLoopIOOperator<B, A, R, E, C> {
|
|
21
|
+
readonly _tag: IOLoopOperatorTag.FilterMapLoopIO;
|
|
22
|
+
readonly seed: B;
|
|
23
|
+
readonly f: (acc: B, a: A) => IO<R, E, readonly [Maybe<C>, B]>;
|
|
24
|
+
}
|
|
25
|
+
export declare function FilterMapLoopIOOperator<const B, A, R, E, C>(seed: B, f: (acc: B, a: A) => IO<R, E, readonly [Maybe<C>, B]>): FilterMapLoopIOOperator<B, A, R, E, C>;
|
|
26
|
+
/**
|
|
27
|
+
* @tsplus pipeable fncts.io.Push.IOLoopOperator match
|
|
28
|
+
* @tsplus location "@fncts/io/Push/Operator/IOLoopOperator"
|
|
29
|
+
*/
|
|
30
|
+
export declare function match<B, A, R, E, C, D, F>(matchers: {
|
|
31
|
+
LoopIO: (op: LoopIOOperator<B, A, R, E, C>) => D;
|
|
32
|
+
FilterMapLoopIO: (op: FilterMapLoopIOOperator<B, A, R, E, C>) => F;
|
|
33
|
+
}): (self: IOLoopOperator<B, A, R, E, C>) => D | F;
|
|
34
|
+
/**
|
|
35
|
+
* @tsplus pipeable fncts.io.Push.IOLoopOperator fuse
|
|
36
|
+
* @tsplus location "@fncts/io/Push/Operator/IOLoopOperator"
|
|
37
|
+
*/
|
|
38
|
+
export declare function fuse<C, D, F, R2, E2>(that: IOLoopOperator<D, C, R2, E2, F>): <A, B, R1, E1>(self: IOLoopOperator<A, B, R1, E1, C>) => IOLoopOperator<readonly [A, D], B, R1 | R2, E1 | E2, F>;
|
|
39
|
+
/**
|
|
40
|
+
* @tsplus pipeable fncts.io.Push.IOLoopOperator after
|
|
41
|
+
* @tsplus location "@fncts/io/Push/Operator/IOLoopOperator"
|
|
42
|
+
*/
|
|
43
|
+
export declare function fuseSyncLoopOperatorBefore<A, B, C>(that: SyncLoopOperator<A, B, C>): <D, R, E, F>(self: IOLoopOperator<D, C, R, E, F>) => IOLoopOperator<readonly [A, D], B, R, E, F>;
|
|
44
|
+
/**
|
|
45
|
+
* @tsplus pipeable fncts.io.Push.IOLoopOperator before
|
|
46
|
+
* @tsplus location "@fncts/io/Push/Operator/IOLoopOperator"
|
|
47
|
+
*/
|
|
48
|
+
export declare function fuseSyncLoopOperatorAfter<D, C, F>(that: SyncLoopOperator<D, C, F>): <A, B, R, E>(self: IOLoopOperator<A, B, R, E, C>) => IOLoopOperator<readonly [A, D], B, R, E, F>;
|
|
49
|
+
/**
|
|
50
|
+
* @tsplus pipeable fncts.io.Push.IOLoopOperator after
|
|
51
|
+
* @tsplus location "@fncts/io/Push/Operator/IOLoopOperator"
|
|
52
|
+
*/
|
|
53
|
+
export declare function fuseSyncOperatorBefore(that: SyncOperator): (self: IOLoopOperator) => IOLoopOperator;
|
|
54
|
+
/**
|
|
55
|
+
* @tsplus pipeable fncts.io.Push.IOLoopOperator before
|
|
56
|
+
* @tsplus location "@fncts/io/Push/Operator/IOLoopOperator"
|
|
57
|
+
*/
|
|
58
|
+
export declare function fuseSyncOperatorAfter(that: SyncOperator): (self: IOLoopOperator) => IOLoopOperator;
|
|
59
|
+
export declare function fuseIOOperatorBefore(that: IOOperator): (self: IOLoopOperator) => IOLoopOperator;
|
|
60
|
+
export declare function fuseIOOperatorAfter(that: IOOperator): (self: IOLoopOperator) => LoopIOOperator<any, unknown, any, any, any> | FilterMapLoopIOOperator<any, unknown, any, any, any>;
|
|
61
|
+
export declare function liftLoopOperator(self: SyncLoopOperator): IOLoopOperator;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { IO } from "@fncts/io/IO/definition";
|
|
2
|
+
import { Maybe } from "@fncts/base/data/Maybe/definition";
|
|
3
|
+
import type { SyncOperator } from "./SyncOperator.js";
|
|
4
|
+
export declare const enum IOOperatorTag {
|
|
5
|
+
MapIO = "MapIO",
|
|
6
|
+
TapIO = "TapIO",
|
|
7
|
+
FilterIO = "FilterIO",
|
|
8
|
+
FilterMapIO = "FilterMapIO"
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* @tsplus type fncts.io.Push.IOOperator
|
|
12
|
+
* @tsplus companion fncts.io.Push.IOOperatorOps
|
|
13
|
+
*/
|
|
14
|
+
export type IOOperator = MapIO<any, any, any, any> | TapIO<any, any, any, any> | FilterIO<any, any, any> | FilterMapIO<any, any, any, any>;
|
|
15
|
+
export interface MapIO<R, E, A, B> {
|
|
16
|
+
readonly _tag: IOOperatorTag.MapIO;
|
|
17
|
+
readonly f: (a: A) => IO<R, E, B>;
|
|
18
|
+
}
|
|
19
|
+
export declare function MapIO<R, E, A, B>(f: (a: A) => IO<R, E, B>): MapIO<R, E, A, B>;
|
|
20
|
+
export interface TapIO<R, E, A, B> {
|
|
21
|
+
readonly _tag: IOOperatorTag.TapIO;
|
|
22
|
+
readonly f: (a: A) => IO<R, E, B>;
|
|
23
|
+
}
|
|
24
|
+
export declare function TapIO<R, E, A, B>(f: (a: A) => IO<R, E, B>): TapIO<R, E, A, B>;
|
|
25
|
+
export interface FilterIO<R, E, A> {
|
|
26
|
+
readonly _tag: IOOperatorTag.FilterIO;
|
|
27
|
+
readonly f: (a: A) => IO<R, E, boolean>;
|
|
28
|
+
}
|
|
29
|
+
export declare function FilterIO<R, E, A>(f: (a: A) => IO<R, E, boolean>): FilterIO<R, E, A>;
|
|
30
|
+
export interface FilterMapIO<R, E, A, B> {
|
|
31
|
+
readonly _tag: IOOperatorTag.FilterMapIO;
|
|
32
|
+
readonly f: (a: A) => IO<R, E, Maybe<B>>;
|
|
33
|
+
}
|
|
34
|
+
export declare function FilterMapIO<R, E, A, B>(f: (a: A) => IO<R, E, Maybe<B>>): FilterMapIO<R, E, A, B>;
|
|
35
|
+
export type IOOperatorFusionMap = {
|
|
36
|
+
readonly [K in IOOperator["_tag"]]: {
|
|
37
|
+
readonly [K2 in IOOperator["_tag"]]: (op1: Extract<IOOperator, {
|
|
38
|
+
readonly _tag: K;
|
|
39
|
+
}>, op2: Extract<IOOperator, {
|
|
40
|
+
readonly _tag: K2;
|
|
41
|
+
}>) => IOOperator;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* @tsplus pipeable fncts.io.Push.IOOperator fuse
|
|
46
|
+
* @tsplus location "@fncts/io/Push/Operator/IOOperator"
|
|
47
|
+
*/
|
|
48
|
+
export declare function fuse(that: IOOperator): (self: IOOperator) => IOOperator;
|
|
49
|
+
/**
|
|
50
|
+
* @tsplus static fncts.io.Push.IOOperatorOps fromSyncOperator
|
|
51
|
+
* @tsplus location "@fncts/io/Push/Operator/IOOperator"
|
|
52
|
+
*/
|
|
53
|
+
export declare function fromSyncOperator(op: SyncOperator): IOOperator;
|
|
54
|
+
/**
|
|
55
|
+
* @tsplus pipeable fncts.io.Push.IOOperator match
|
|
56
|
+
* @tsplus location "@fncts/io/Push/Operator/IOOperator"
|
|
57
|
+
*/
|
|
58
|
+
export declare function match<A, B, C, D>(cases: {
|
|
59
|
+
readonly MapIO: (f: MapIO<any, any, any, any>) => A;
|
|
60
|
+
readonly TapIO: (f: TapIO<any, any, any, any>) => B;
|
|
61
|
+
readonly FilterIO: (f: FilterIO<any, any, any>) => C;
|
|
62
|
+
readonly FilterMapIO: (f: FilterMapIO<any, any, any, any>) => D;
|
|
63
|
+
}): (self: IOOperator) => A | B | C | D;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Maybe } from "@fncts/base/data/Maybe/definition";
|
|
2
|
+
import { Either } from "@fncts/base/data/Either/definition";
|
|
3
|
+
import type { Bounds } from "../Bounds.js";
|
|
4
|
+
import type { SyncOperator } from "./SyncOperator.js";
|
|
5
|
+
export declare const enum SyncLoopOperatorTag {
|
|
6
|
+
Loop = "Loop",
|
|
7
|
+
FilterMapLoop = "FilterMapLoop"
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* @tsplus type fncts.io.Push.SyncLoopOperator
|
|
11
|
+
*/
|
|
12
|
+
export type SyncLoopOperator<B = any, A = any, C = any> = LoopOperator<B, A, C> | FilterMapLoopOperator<B, A, C>;
|
|
13
|
+
export interface LoopOperator<B, A, C> {
|
|
14
|
+
readonly _tag: SyncLoopOperatorTag.Loop;
|
|
15
|
+
readonly seed: B;
|
|
16
|
+
readonly f: (acc: B, a: A) => readonly [C, B];
|
|
17
|
+
}
|
|
18
|
+
export declare function LoopOperator<const B, A, C>(seed: B, f: (acc: B, a: A) => readonly [C, B]): LoopOperator<B, A, C>;
|
|
19
|
+
export interface FilterMapLoopOperator<B, A, C> {
|
|
20
|
+
readonly _tag: SyncLoopOperatorTag.FilterMapLoop;
|
|
21
|
+
readonly seed: B;
|
|
22
|
+
readonly f: (acc: B, a: A) => readonly [Maybe<C>, B];
|
|
23
|
+
}
|
|
24
|
+
export declare function FilterMapLoopOperator<const B, A, C>(seed: B, f: (acc: B, a: A) => readonly [Maybe<C>, B]): FilterMapLoopOperator<B, A, C>;
|
|
25
|
+
export declare const enum SliceOperatorTag {
|
|
26
|
+
SliceOperator = 0,
|
|
27
|
+
FilterMapSliceOperator = 1
|
|
28
|
+
}
|
|
29
|
+
export interface SliceOperator {
|
|
30
|
+
readonly _tag: SliceOperatorTag.SliceOperator;
|
|
31
|
+
readonly bounds: Bounds;
|
|
32
|
+
}
|
|
33
|
+
export declare function SliceOperator(bounds: Bounds): SliceOperator;
|
|
34
|
+
export interface FilterMapSliceOperator<A, B, C> {
|
|
35
|
+
readonly _tag: SliceOperatorTag.FilterMapSliceOperator;
|
|
36
|
+
readonly seed: B;
|
|
37
|
+
readonly f: (acc: B, a: A) => Either<readonly [Maybe<C>, B], Maybe<C>>;
|
|
38
|
+
}
|
|
39
|
+
export declare function FilterMapSliceOperator<const B, A, C>(seed: B, f: (acc: B, a: A) => Either<readonly [Maybe<C>, B], Maybe<C>>): FilterMapSliceOperator<A, B, C>;
|
|
40
|
+
/**
|
|
41
|
+
* @tsplus pipeable fncts.io.Push.SyncLoopOperator match
|
|
42
|
+
* @tsplus location "@fncts/io/Push/Operator/LoopOperator"
|
|
43
|
+
*/
|
|
44
|
+
export declare function matchSyncLoopOperator<A, B, C, D, E>(matchers: {
|
|
45
|
+
Loop: (op: LoopOperator<A, B, C>) => D;
|
|
46
|
+
FilterMapLoop: (op: FilterMapLoopOperator<A, B, C>) => E;
|
|
47
|
+
}): (self: SyncLoopOperator<A, B, C>) => D | E;
|
|
48
|
+
export declare function fuseSyncOperatorBefore(that: SyncOperator): (self: SyncLoopOperator) => SyncLoopOperator;
|
|
49
|
+
export declare function fuseSyncOperatorAfter(that: SyncOperator): (self: SyncLoopOperator) => SyncLoopOperator;
|
|
50
|
+
export declare function fuse<C, D, E>(that: SyncLoopOperator<D, C, E>): <A, B>(self: SyncLoopOperator<A, B, C>) => SyncLoopOperator<readonly [A, D], B, E>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Predicate } from "@fncts/base/data/Predicate/definition";
|
|
2
|
+
import { Maybe } from "@fncts/base/data/Maybe/definition";
|
|
3
|
+
export declare const enum SyncOperatorTag {
|
|
4
|
+
Map = "Map",
|
|
5
|
+
Filter = "Filter",
|
|
6
|
+
FilterMap = "FilterMap"
|
|
7
|
+
}
|
|
8
|
+
export interface Map<A, B> {
|
|
9
|
+
readonly _tag: SyncOperatorTag.Map;
|
|
10
|
+
readonly f: (a: A) => B;
|
|
11
|
+
}
|
|
12
|
+
export declare function Map<A, B>(f: (a: A) => B): Map<A, B>;
|
|
13
|
+
export interface Filter<A> {
|
|
14
|
+
readonly _tag: SyncOperatorTag.Filter;
|
|
15
|
+
readonly f: Predicate<A>;
|
|
16
|
+
}
|
|
17
|
+
export declare function Filter<A>(f: Predicate<A>): Filter<A>;
|
|
18
|
+
export interface FilterMap<A, B> {
|
|
19
|
+
readonly _tag: SyncOperatorTag.FilterMap;
|
|
20
|
+
readonly f: (a: A) => Maybe<B>;
|
|
21
|
+
}
|
|
22
|
+
export declare function FilterMap<A, B>(f: (a: A) => Maybe<B>): FilterMap<A, B>;
|
|
23
|
+
/**
|
|
24
|
+
* @tsplus type fncts.io.Push.SyncOperator
|
|
25
|
+
* @tsplus companion fncts.io.Push.SyncOperatorOps
|
|
26
|
+
*/
|
|
27
|
+
export type SyncOperator<A = any, B = any> = Map<A, B> | Filter<A> | FilterMap<A, B>;
|
|
28
|
+
/**
|
|
29
|
+
* @tsplus pipeable fncts.io.Push.SyncOperator fuse
|
|
30
|
+
* @tsplus location "@fncts/io/Push/Operator/SyncOperator"
|
|
31
|
+
*/
|
|
32
|
+
export declare function fuse(that: SyncOperator): (self: SyncOperator) => SyncOperator<any, any>;
|
|
33
|
+
/**
|
|
34
|
+
* @tsplus pipeable fncts.io.Push.SyncOperator match
|
|
35
|
+
* @tsplus location "@fncts/io/Push/Operator/SyncOperator"
|
|
36
|
+
*/
|
|
37
|
+
export declare function match<A, B, C, D, E>(cases: {
|
|
38
|
+
readonly Map: (f: Map<A, B>) => C;
|
|
39
|
+
readonly Filter: (f: Filter<A>) => D;
|
|
40
|
+
readonly FilterMap: (f: FilterMap<A, B>) => E;
|
|
41
|
+
}): (self: SyncOperator<A, B>) => C | D | E;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { IO } from "@fncts/io/IO/definition";
|
|
2
|
+
import { Schedule } from "@fncts/io/Schedule/definition";
|
|
3
|
+
import { Cause } from "@fncts/base/data/Cause/definition";
|
|
4
|
+
import type { Push } from "../definition.js";
|
|
5
|
+
export declare const enum IOProducerTag {
|
|
6
|
+
FromIO = 0,
|
|
7
|
+
FromScheduled = 1,
|
|
8
|
+
Scheduled = 2
|
|
9
|
+
}
|
|
10
|
+
export declare class FromIO<R, E, A> {
|
|
11
|
+
readonly source: IO<R, E, A>;
|
|
12
|
+
readonly _tag = IOProducerTag.FromIO;
|
|
13
|
+
constructor(source: IO<R, E, A>);
|
|
14
|
+
}
|
|
15
|
+
export declare class FromScheduled<R, E, I, R1, O> {
|
|
16
|
+
readonly input: IO<R, E, I>;
|
|
17
|
+
readonly schedule: Schedule<R1, I, O>;
|
|
18
|
+
readonly _tag = IOProducerTag.FromScheduled;
|
|
19
|
+
constructor(input: IO<R, E, I>, schedule: Schedule<R1, I, O>);
|
|
20
|
+
}
|
|
21
|
+
export declare class Scheduled<R, E, A, R1, O> {
|
|
22
|
+
readonly input: IO<R, E, A>;
|
|
23
|
+
readonly schedule: Schedule<R1, unknown, O>;
|
|
24
|
+
readonly _tag = IOProducerTag.Scheduled;
|
|
25
|
+
constructor(input: IO<R, E, A>, schedule: Schedule<R1, unknown, O>);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* @tsplus type fncts.io.Push.IOProducer
|
|
29
|
+
* @tsplus companion fncts.io.Push.IOProducerOps
|
|
30
|
+
*/
|
|
31
|
+
export type IOProducer<R, E, A> = FromIO<R, E, A> | FromScheduled<R, E, any, any, A> | Scheduled<R, E, A, any, any>;
|
|
32
|
+
/**
|
|
33
|
+
* @tsplus fluent fncts.io.Push.IOProducer runSink
|
|
34
|
+
* @tsplus location "@fncts/io/Push/Producer/IOProducer"
|
|
35
|
+
*/
|
|
36
|
+
export declare function runSink<R, E, A, R1>(self: IOProducer<R, E, A>, sink: Push.UnsafeSink<R1, E, A>): IO<R | R1, never, unknown>;
|
|
37
|
+
/**
|
|
38
|
+
* @tsplus fluent fncts.io.Push.IOProducer runIO
|
|
39
|
+
* @tsplus location "@fncts/io/Push/Producer/IOProducer"
|
|
40
|
+
*/
|
|
41
|
+
export declare function runIO<R, E, A, R1, E1, A1>(self: IOProducer<R, E, A>, f: (a: A) => IO<R1, E1, A1>): IO<R | R1, E | E1, unknown>;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { Lazy } from "@fncts/base/data/function/definition";
|
|
2
|
+
import { UIO, IO } from "@fncts/io/IO/definition";
|
|
3
|
+
import { Maybe } from "@fncts/base/data/Maybe/definition";
|
|
4
|
+
import type { Push } from "@fncts/io/Push";
|
|
5
|
+
export declare const enum SyncProducerTag {
|
|
6
|
+
Success = 0,
|
|
7
|
+
FromSync = 1,
|
|
8
|
+
FromArray = 2,
|
|
9
|
+
FromIterable = 3
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* @tsplus type fncts.io.Push.SyncProducer
|
|
13
|
+
* @tsplus companion fncts.io.Push.SyncProducerOps
|
|
14
|
+
*/
|
|
15
|
+
export type SyncProducer<A> = Success<A> | FromSync<A> | FromArray<A> | FromIterable<A>;
|
|
16
|
+
export declare class Success<A> {
|
|
17
|
+
readonly source: A;
|
|
18
|
+
readonly _tag = SyncProducerTag.Success;
|
|
19
|
+
constructor(source: A);
|
|
20
|
+
}
|
|
21
|
+
export declare class FromSync<A> {
|
|
22
|
+
readonly f: Lazy<A>;
|
|
23
|
+
readonly _tag = SyncProducerTag.FromSync;
|
|
24
|
+
constructor(f: Lazy<A>);
|
|
25
|
+
}
|
|
26
|
+
export declare class FromArray<A> {
|
|
27
|
+
readonly array: ReadonlyArray<A>;
|
|
28
|
+
readonly _tag = SyncProducerTag.FromArray;
|
|
29
|
+
constructor(array: ReadonlyArray<A>);
|
|
30
|
+
}
|
|
31
|
+
export declare class FromIterable<A> {
|
|
32
|
+
readonly iterable: Iterable<A>;
|
|
33
|
+
readonly _tag = SyncProducerTag.FromIterable;
|
|
34
|
+
constructor(iterable: Iterable<A>);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* @tsplus static fncts.io.Push.SyncProducerOps Success
|
|
38
|
+
* @tsplus location "@fncts/io/Push/Producer/SyncProducer"
|
|
39
|
+
*/
|
|
40
|
+
export declare function success<A>(source: A): SyncProducer<A>;
|
|
41
|
+
/**
|
|
42
|
+
* @tsplus static fncts.io.Push.SyncProducerOps fromSync
|
|
43
|
+
* @tsplus location "@fncts/io/Push/Producer/SyncProducer"
|
|
44
|
+
*/
|
|
45
|
+
export declare function fromSync<A>(f: Lazy<A>): SyncProducer<A>;
|
|
46
|
+
/**
|
|
47
|
+
* @tsplus static fncts.io.Push.SyncProducerOps fromArray
|
|
48
|
+
* @tsplus location "@fncts/io/Push/Producer/SyncProducer"
|
|
49
|
+
*/
|
|
50
|
+
export declare function fromArray<A extends ReadonlyArray<any>>(array: A): SyncProducer<A[number]>;
|
|
51
|
+
/**
|
|
52
|
+
* @tsplus static fncts.io.Push.SyncProducerOps fromIterable
|
|
53
|
+
* @tsplus location "@fncts/io/Push/Producer/SyncProducer"
|
|
54
|
+
*/
|
|
55
|
+
export declare function fromIterable<A>(iterable: Iterable<A>): SyncProducer<A>;
|
|
56
|
+
export declare function syncOnce<A>(f: () => A): UIO<A>;
|
|
57
|
+
/**
|
|
58
|
+
* @tsplus fluent fncts.io.Push.SyncProducer runSink
|
|
59
|
+
* @tsplus location "@fncts/io/Push/Producer/SyncProducer"
|
|
60
|
+
*/
|
|
61
|
+
export declare function runSink<R, E, A>(self: SyncProducer<A>, sink: Push.UnsafeSink<R, E, A>): IO<R, never, unknown>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/Push/Sink.d.ts
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { HKT } from "@fncts/typelevel/HKT";
|
|
2
|
+
import { Newtype, NewtypeIso } from "@fncts/base/data/Newtype";
|
|
3
|
+
import { URIO, UIO } from "@fncts/io/IO/definition";
|
|
4
|
+
import { Environment } from "@fncts/base/data/Environment/definition";
|
|
5
|
+
import { Predicate } from "@fncts/base/data/Predicate/definition";
|
|
6
|
+
import { Maybe } from "@fncts/base/data/Maybe/definition";
|
|
7
|
+
import type { Cause } from "@fncts/base/data/Cause";
|
|
8
|
+
import { IO } from "@fncts/io/IO";
|
|
9
|
+
interface SinkN extends HKT {
|
|
10
|
+
readonly type: Sink<this["I"], this["R"], this["E"], this["A"]>;
|
|
11
|
+
readonly variance: {
|
|
12
|
+
I: "+";
|
|
13
|
+
R: "+";
|
|
14
|
+
E: "-";
|
|
15
|
+
A: "-";
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* @tsplus type fncts.io.Push.Sink
|
|
20
|
+
*/
|
|
21
|
+
export interface Sink<Env, R, E, A> extends Newtype<{
|
|
22
|
+
readonly Sink: unique symbol;
|
|
23
|
+
}, URIO<Env, UnsafeSink<R, E, A>>> {
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* @tsplus type fncts.io.Push.SinkOps
|
|
27
|
+
*/
|
|
28
|
+
export interface SinkOps extends NewtypeIso<SinkN> {
|
|
29
|
+
}
|
|
30
|
+
export declare const Sink: SinkOps;
|
|
31
|
+
/**
|
|
32
|
+
* @tsplus type fncts.io.Push.Sink
|
|
33
|
+
* @tsplus companion fncts.io.Push.SinkOps
|
|
34
|
+
*/
|
|
35
|
+
export declare abstract class UnsafeSink<R, in E, in A> {
|
|
36
|
+
abstract onSuccess(value: A): IO<R, never, void>;
|
|
37
|
+
abstract onFailure(cause: Cause<E>): IO<R, never, void>;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* @tsplus static fncts.io.Push.SinkOps unsafeMake
|
|
41
|
+
* @tsplus location "@fncts/io/Push/Sink"
|
|
42
|
+
*/
|
|
43
|
+
export declare function unsafeMakeSink<R, E, A>(onSuccess: (value: A) => IO<R, never, unknown>, onFailure: (cause: Cause<E>) => IO<R, never, unknown>): UnsafeSink<R, E, A>;
|
|
44
|
+
/**
|
|
45
|
+
* @tsplus static fncts.io.Push.SinkOps __call
|
|
46
|
+
* @tsplus location "@fncts/io/Push/Sink"
|
|
47
|
+
*/
|
|
48
|
+
export declare function makeSink<R, E, A>(onSuccess: (value: A) => IO<R, never, unknown>, onFailure: (cause: Cause<E>) => IO<R, never, unknown>): Sink<never, R, E, A>;
|
|
49
|
+
export declare class WithEarlyExit<R, E, A> extends UnsafeSink<R, E, A> {
|
|
50
|
+
readonly onSuccess: (value: A) => IO<R, never, void>;
|
|
51
|
+
readonly onFailure: (cause: Cause<E>) => IO<R, never, void>;
|
|
52
|
+
readonly earlyExit: UIO<void>;
|
|
53
|
+
constructor(onSuccess: (value: A) => IO<R, never, void>, onFailure: (cause: Cause<E>) => IO<R, never, void>, earlyExit: UIO<void>);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* @tsplus static fncts.io.Push.SinkOps withEarlyExit
|
|
57
|
+
* @tsplus location "@fncts/io/Push/Sink"
|
|
58
|
+
*/
|
|
59
|
+
export declare function withEarlyExit<R, E, A, R1, B>(sink: UnsafeSink<R, E, A>, f: (sink: WithEarlyExit<R, E, A>) => IO<R1, E, B>): IO<R | R1, never, void>;
|
|
60
|
+
/**
|
|
61
|
+
* @tsplus pipeable fncts.io.Push.Sink provideSomeEnvironment
|
|
62
|
+
* @tsplus location "@fncts/io/Push/Sink"
|
|
63
|
+
*/
|
|
64
|
+
export declare function provideSomeEnvironment<R1>(environment: Environment<R1>): <Env, R, E, A>(self: Sink<Env, R, E, A>) => Sink<Env, Exclude<R, R1>, E, A>;
|
|
65
|
+
export {};
|