@fncts/base 0.0.29 → 0.0.30
Sign up to get free protection for your applications and to get access to all the features.
- package/_cjs/collection/immutable/HashSet/api.cjs +18 -7
- package/_cjs/collection/immutable/HashSet/api.cjs.map +1 -1
- package/_cjs/collection/immutable/HashSet/definition.cjs +2 -2
- package/_cjs/collection/immutable/HashSet/definition.cjs.map +1 -1
- package/_cjs/control/Eval/api.cjs +4 -1
- package/_cjs/control/Eval/api.cjs.map +1 -1
- package/_cjs/control/Eval/constructors.cjs +9 -2
- package/_cjs/control/Eval/constructors.cjs.map +1 -1
- package/_cjs/control/Eval/definition.cjs +10 -28
- package/_cjs/control/Eval/definition.cjs.map +1 -1
- package/_cjs/control/Eval/run.cjs +7 -7
- package/_cjs/control/Eval/run.cjs.map +1 -1
- package/_cjs/control/{Z → Pure}/api.cjs +146 -115
- package/_cjs/control/Pure/api.cjs.map +1 -0
- package/_cjs/control/Pure/definition.cjs +78 -0
- package/_cjs/control/Pure/definition.cjs.map +1 -0
- package/_cjs/control/{Z → Pure}/instances.cjs +1 -1
- package/_cjs/control/Pure/instances.cjs.map +1 -0
- package/_cjs/control/{Z → Pure}/runtime.cjs +67 -66
- package/_cjs/control/Pure/runtime.cjs.map +1 -0
- package/_cjs/control/{Z.cjs → Pure.cjs} +5 -5
- package/_cjs/control/Pure.cjs.map +1 -0
- package/_cjs/data/Showable/show.cjs +31 -31
- package/_cjs/data/Showable/show.cjs.map +1 -1
- package/_mjs/collection/immutable/HashSet/api.mjs +17 -7
- package/_mjs/collection/immutable/HashSet/api.mjs.map +1 -1
- package/_mjs/collection/immutable/HashSet/definition.mjs +2 -2
- package/_mjs/collection/immutable/HashSet/definition.mjs.map +1 -1
- package/_mjs/control/Eval/api.mjs +5 -2
- package/_mjs/control/Eval/api.mjs.map +1 -1
- package/_mjs/control/Eval/constructors.mjs +10 -3
- package/_mjs/control/Eval/constructors.mjs.map +1 -1
- package/_mjs/control/Eval/definition.mjs +7 -25
- package/_mjs/control/Eval/definition.mjs.map +1 -1
- package/_mjs/control/Eval/run.mjs +7 -7
- package/_mjs/control/Eval/run.mjs.map +1 -1
- package/_mjs/control/{Z → Pure}/api.mjs +134 -104
- package/_mjs/control/Pure/api.mjs.map +1 -0
- package/_mjs/control/Pure/definition.mjs +60 -0
- package/_mjs/control/Pure/definition.mjs.map +1 -0
- package/_mjs/control/{Z → Pure}/instances.mjs +1 -1
- package/_mjs/control/Pure/instances.mjs.map +1 -0
- package/_mjs/control/{Z → Pure}/runtime.mjs +68 -67
- package/_mjs/control/Pure/runtime.mjs.map +1 -0
- package/_mjs/control/Pure.mjs +6 -0
- package/_mjs/control/Pure.mjs.map +1 -0
- package/_mjs/data/Showable/show.mjs +31 -31
- package/_mjs/data/Showable/show.mjs.map +1 -1
- package/_src/collection/immutable/HashSet/api.ts +12 -1
- package/_src/collection/immutable/HashSet/definition.ts +2 -2
- package/_src/control/Eval/api.ts +5 -2
- package/_src/control/Eval/constructors.ts +10 -3
- package/_src/control/Eval/definition.ts +39 -27
- package/_src/control/Eval/run.ts +7 -7
- package/_src/control/Pure/api.ts +629 -0
- package/_src/control/Pure/definition.ts +222 -0
- package/_src/control/{Z → Pure}/instances.ts +3 -3
- package/_src/control/{Z → Pure}/runtime.ts +73 -76
- package/_src/control/Pure.ts +6 -0
- package/_src/control.ts +1 -1
- package/_src/data/Showable/show.ts +55 -53
- package/_src/global.ts +1 -1
- package/collection/immutable/HashSet/api.d.ts +5 -0
- package/collection/immutable/HashSet/definition.d.ts +1 -1
- package/control/Eval/constructors.d.ts +4 -0
- package/control/Eval/definition.d.ts +25 -28
- package/control/Pure/api.d.ts +345 -0
- package/control/Pure/definition.d.ts +156 -0
- package/control/Pure/instances.d.ts +8 -0
- package/control/Pure/runtime.d.ts +56 -0
- package/control/Pure.d.ts +4 -0
- package/control.d.ts +1 -1
- package/data/Showable/show.d.ts +2 -2
- package/global.d.ts +1 -1
- package/package.json +1 -1
- package/_cjs/control/Z/api.cjs.map +0 -1
- package/_cjs/control/Z/definition.cjs +0 -163
- package/_cjs/control/Z/definition.cjs.map +0 -1
- package/_cjs/control/Z/instances.cjs.map +0 -1
- package/_cjs/control/Z/runtime.cjs.map +0 -1
- package/_cjs/control/Z.cjs.map +0 -1
- package/_mjs/control/Z/api.mjs.map +0 -1
- package/_mjs/control/Z/definition.mjs +0 -145
- package/_mjs/control/Z/definition.mjs.map +0 -1
- package/_mjs/control/Z/instances.mjs.map +0 -1
- package/_mjs/control/Z/runtime.mjs.map +0 -1
- package/_mjs/control/Z.mjs +0 -6
- package/_mjs/control/Z.mjs.map +0 -1
- package/_src/control/Z/api.ts +0 -590
- package/_src/control/Z/definition.ts +0 -199
- package/_src/control/Z.ts +0 -6
- package/control/Z/api.d.ts +0 -345
- package/control/Z/definition.d.ts +0 -151
- package/control/Z/instances.d.ts +0 -8
- package/control/Z/runtime.d.ts +0 -56
- package/control/Z.d.ts +0 -4
@@ -1,199 +0,0 @@
|
|
1
|
-
export interface ZF extends HKT {
|
2
|
-
type: Z<this["W"], this["S"], this["S"], this["R"], this["E"], this["A"]>;
|
3
|
-
variance: {
|
4
|
-
W: "+";
|
5
|
-
S: "_";
|
6
|
-
R: "-";
|
7
|
-
E: "+";
|
8
|
-
A: "+";
|
9
|
-
};
|
10
|
-
}
|
11
|
-
|
12
|
-
export const ZVariance = Symbol.for("fncts.Z.Variance");
|
13
|
-
export type ZVariance = typeof ZVariance;
|
14
|
-
|
15
|
-
export const ZTypeId = Symbol.for("fncts.Z");
|
16
|
-
export type ZTypeId = typeof ZTypeId;
|
17
|
-
|
18
|
-
/**
|
19
|
-
* `Z<W, S1, S2, R, E, A>` is a purely functional description of a synchronous computation
|
20
|
-
* that requires an environment `R` and an initial state `S1` and may either
|
21
|
-
* fail with an `E` or succeed with an updated state `S2` and an `A`. Because
|
22
|
-
* of its polymorphism `Z` can be used to model a variety of effects
|
23
|
-
* including context, state, failure, and logging.
|
24
|
-
*
|
25
|
-
* @note named `Z` in honor of `ZIO` and because it is, surely, the last synchronous effect type
|
26
|
-
* one will ever need
|
27
|
-
*
|
28
|
-
* @tsplus type fncts.control.Z
|
29
|
-
* @tsplus companion fncts.control.ZOps
|
30
|
-
*/
|
31
|
-
export abstract class Z<W, S1, S2, R, E, A> {
|
32
|
-
readonly [ZTypeId]: ZTypeId = ZTypeId;
|
33
|
-
declare [ZVariance]: {
|
34
|
-
readonly _W: (_: never) => W;
|
35
|
-
readonly _S1: (_: S1) => void;
|
36
|
-
readonly _S2: (_: never) => S2;
|
37
|
-
readonly _R: (_: never) => R;
|
38
|
-
readonly _E: (_: never) => E;
|
39
|
-
readonly _A: (_: never) => A;
|
40
|
-
};
|
41
|
-
}
|
42
|
-
|
43
|
-
/**
|
44
|
-
* @tsplus unify fncts.control.Z
|
45
|
-
*/
|
46
|
-
export function unifyZ<X extends Z<any, any, any, any, any, any>>(
|
47
|
-
_: X,
|
48
|
-
): Z<
|
49
|
-
[X] extends [Z<infer W, any, any, any, any, any>] ? W : never,
|
50
|
-
[X] extends [Z<any, infer S1, any, any, any, any>] ? S1 : never,
|
51
|
-
[X] extends [Z<any, any, infer S2, any, any, any>] ? S2 : never,
|
52
|
-
[X] extends [Z<any, any, any, infer R, any, any>] ? R : never,
|
53
|
-
[X] extends [Z<any, any, any, any, infer E, any>] ? E : never,
|
54
|
-
[X] extends [Z<any, any, any, any, any, infer A>] ? A : never
|
55
|
-
> {
|
56
|
-
return _;
|
57
|
-
}
|
58
|
-
|
59
|
-
/**
|
60
|
-
* @tsplus static fncts.control.ZOps isZ
|
61
|
-
*/
|
62
|
-
export function isZ(u: unknown): u is Z<unknown, unknown, unknown, unknown, unknown, unknown> {
|
63
|
-
return isObject(u) && ZTypeId in u;
|
64
|
-
}
|
65
|
-
|
66
|
-
export const enum ZTag {
|
67
|
-
SucceedNow = "SucceedNow",
|
68
|
-
Succeed = "Succeed",
|
69
|
-
Defer = "Defer",
|
70
|
-
Fail = "Fail",
|
71
|
-
Modify = "Modify",
|
72
|
-
Chain = "Chain",
|
73
|
-
Match = "Match",
|
74
|
-
Access = "Access",
|
75
|
-
Provide = "Provide",
|
76
|
-
Tell = "Tell",
|
77
|
-
Listen = "Listen",
|
78
|
-
MapLog = "MapLog",
|
79
|
-
}
|
80
|
-
|
81
|
-
export class SucceedNow<A> extends Z<never, unknown, never, never, never, A> {
|
82
|
-
readonly _tag = ZTag.SucceedNow;
|
83
|
-
constructor(readonly value: A) {
|
84
|
-
super();
|
85
|
-
}
|
86
|
-
}
|
87
|
-
|
88
|
-
export class Succeed<A> extends Z<never, unknown, never, never, never, A> {
|
89
|
-
readonly _tag = ZTag.Succeed;
|
90
|
-
constructor(readonly effect: () => A) {
|
91
|
-
super();
|
92
|
-
}
|
93
|
-
}
|
94
|
-
|
95
|
-
export class Defer<W, S1, S2, R, E, A> extends Z<W, S1, S2, R, E, A> {
|
96
|
-
readonly _tag = ZTag.Defer;
|
97
|
-
constructor(readonly make: () => Z<W, S1, S2, R, E, A>) {
|
98
|
-
super();
|
99
|
-
}
|
100
|
-
}
|
101
|
-
|
102
|
-
export class Fail<E> extends Z<never, unknown, never, never, E, never> {
|
103
|
-
readonly _tag = ZTag.Fail;
|
104
|
-
constructor(readonly cause: Cause<E>) {
|
105
|
-
super();
|
106
|
-
}
|
107
|
-
}
|
108
|
-
|
109
|
-
export class Modify<S1, S2, A> extends Z<never, S1, S2, never, never, A> {
|
110
|
-
readonly _tag = ZTag.Modify;
|
111
|
-
constructor(readonly run: (s1: S1) => readonly [A, S2]) {
|
112
|
-
super();
|
113
|
-
}
|
114
|
-
}
|
115
|
-
|
116
|
-
export class Chain<W, S1, S2, R, E, A, W1, S3, Q, D, B> extends Z<W | W1, S1, S3, Q & R, D | E, B> {
|
117
|
-
readonly _tag = ZTag.Chain;
|
118
|
-
constructor(readonly ma: Z<W, S1, S2, R, E, A>, readonly f: (a: A) => Z<W1, S2, S3, Q, D, B>) {
|
119
|
-
super();
|
120
|
-
}
|
121
|
-
}
|
122
|
-
|
123
|
-
export class Match<W, S1, S2, S5, R, E, A, W1, S3, R1, E1, B, W2, S4, R2, E2, C> extends Z<
|
124
|
-
W1 | W2,
|
125
|
-
S1 & S5,
|
126
|
-
S3 | S4,
|
127
|
-
R & R1 & R2,
|
128
|
-
E1 | E2,
|
129
|
-
B | C
|
130
|
-
> {
|
131
|
-
readonly _tag = ZTag.Match;
|
132
|
-
constructor(
|
133
|
-
readonly z: Z<W, S1, S2, R, E, A>,
|
134
|
-
readonly onFailure: (ws: Conc<W>, e: Cause<E>) => Z<W1, S5, S3, R1, E1, B>,
|
135
|
-
readonly onSuccess: (ws: Conc<W>, a: A) => Z<W2, S2, S4, R2, E2, C>,
|
136
|
-
) {
|
137
|
-
super();
|
138
|
-
}
|
139
|
-
}
|
140
|
-
|
141
|
-
export class Access<W, R0, S1, S2, R, E, A> extends Z<W, S1, S2, R0 | R, E, A> {
|
142
|
-
readonly _tag = ZTag.Access;
|
143
|
-
constructor(readonly asks: (r: Environment<R0>) => Z<W, S1, S2, R, E, A>) {
|
144
|
-
super();
|
145
|
-
}
|
146
|
-
}
|
147
|
-
|
148
|
-
export class Provide<W, S1, S2, R, E, A> extends Z<W, S1, S2, never, E, A> {
|
149
|
-
readonly _tag = ZTag.Provide;
|
150
|
-
constructor(readonly ma: Z<W, S1, S2, R, E, A>, readonly env: Environment<R>) {
|
151
|
-
super();
|
152
|
-
}
|
153
|
-
}
|
154
|
-
|
155
|
-
export class Tell<W> extends Z<W, unknown, never, never, never, void> {
|
156
|
-
readonly _tag = ZTag.Tell;
|
157
|
-
constructor(readonly log: Conc<W>) {
|
158
|
-
super();
|
159
|
-
}
|
160
|
-
}
|
161
|
-
|
162
|
-
export class MapLog<W, S1, S2, R, E, A, W1> extends Z<W1, S1, S2, R, E, A> {
|
163
|
-
readonly _tag = ZTag.MapLog;
|
164
|
-
constructor(readonly ma: Z<W, S1, S2, R, E, A>, readonly modifyLog: (ws: Conc<W>) => Conc<W1>) {
|
165
|
-
super();
|
166
|
-
}
|
167
|
-
}
|
168
|
-
|
169
|
-
export type Concrete =
|
170
|
-
| SucceedNow<any>
|
171
|
-
| Fail<any>
|
172
|
-
| Modify<any, any, any>
|
173
|
-
| Chain<any, any, any, any, any, any, any, any, any, any, any>
|
174
|
-
| Match<any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any>
|
175
|
-
| Access<any, any, any, any, any, any, any>
|
176
|
-
| Provide<any, any, any, any, any, any>
|
177
|
-
| Defer<any, any, any, any, any, any>
|
178
|
-
| Succeed<any>
|
179
|
-
| Tell<any>
|
180
|
-
| MapLog<any, any, any, any, any, any, any>;
|
181
|
-
|
182
|
-
/**
|
183
|
-
* @tsplus static fncts.control.ZOps concrete
|
184
|
-
*/
|
185
|
-
export function concrete(_: Z<any, any, any, any, any, any>): asserts _ is Concrete {
|
186
|
-
//
|
187
|
-
}
|
188
|
-
|
189
|
-
export const ZErrorTypeId = Symbol.for("fncts.Z.ZError");
|
190
|
-
export type ZErrorTypeId = typeof ZErrorTypeId;
|
191
|
-
|
192
|
-
export class ZError<E> {
|
193
|
-
readonly [ZErrorTypeId]: ZErrorTypeId = ZErrorTypeId;
|
194
|
-
constructor(readonly cause: Cause<E>) {}
|
195
|
-
}
|
196
|
-
|
197
|
-
export function isZError(u: unknown): u is ZError<unknown> {
|
198
|
-
return isObject(u) && ZErrorTypeId in u;
|
199
|
-
}
|
package/_src/control/Z.ts
DELETED
package/control/Z/api.d.ts
DELETED
@@ -1,345 +0,0 @@
|
|
1
|
-
import { Z } from "@fncts/base/control/Z/definition";
|
2
|
-
import { Either } from "@fncts/base/data/Either/definition";
|
3
|
-
import { Maybe } from "@fncts/base/data/Maybe/definition";
|
4
|
-
import { Environment } from "@fncts/base/data/Environment/definition";
|
5
|
-
import { Lazy } from "@fncts/base/data/function/definition";
|
6
|
-
import { Cause } from "@fncts/base/data/Cause/definition";
|
7
|
-
import { Conc } from "@fncts/base/collection/immutable/Conc";
|
8
|
-
import { Predicate } from "@fncts/base/data/Predicate/definition";
|
9
|
-
import { Zipped } from "@fncts/base/data/Zipped";
|
10
|
-
/**
|
11
|
-
* @tsplus getter fncts.control.Z absolve
|
12
|
-
* @tsplus location "@fncts/base/control/Z/api"
|
13
|
-
*/
|
14
|
-
export declare function absolve<W, S1, S2, R, E, E1, A>(fa: Z<W, S1, S2, R, E, Either<E1, A>>): Z<W, S1, S2, R, E | E1, A>;
|
15
|
-
/**
|
16
|
-
* @tsplus pipeable fncts.control.Z ap
|
17
|
-
* @tsplus location "@fncts/base/control/Z/api"
|
18
|
-
*/
|
19
|
-
export declare function ap<W, S, A, R1, E1>(fb: Z<W, S, S, R1, E1, A>): <R, E, B>(self: import("./definition.js").Z<W, S, S, R, E, (a: A) => B>) => import("./definition.js").Z<W, S, S, R & R1, E1 | E, B>;
|
20
|
-
/**
|
21
|
-
* @tsplus pipeable fncts.control.Z zipLeft
|
22
|
-
* @tsplus location "@fncts/base/control/Z/api"
|
23
|
-
*/
|
24
|
-
export declare function zipLeft<W, S, R1, E1, B>(fb: Z<W, S, S, R1, E1, B>): <R, E, A>(fa: import("./definition.js").Z<W, S, S, R, E, A>) => import("./definition.js").Z<W, S, S, R & R1, E1 | E, A>;
|
25
|
-
/**
|
26
|
-
* @tsplus pipeable fncts.control.Z zipRight
|
27
|
-
* @tsplus location "@fncts/base/control/Z/api"
|
28
|
-
*/
|
29
|
-
export declare function zipRight<W, S, R1, E1, B>(fb: Z<W, S, S, R1, E1, B>): <R, E, A>(fa: import("./definition.js").Z<W, S, S, R, E, A>) => import("./definition.js").Z<W, S, S, R & R1, E1 | E, B>;
|
30
|
-
/**
|
31
|
-
* @tsplus pipeable fncts.control.Z bimap
|
32
|
-
* @tsplus location "@fncts/base/control/Z/api"
|
33
|
-
*/
|
34
|
-
export declare function bimap<E, A, G, B>(f: (e: E) => G, g: (a: A) => B): <W, S1, S2, R>(pab: import("./definition.js").Z<W, S1, S2, R, E, A>) => import("./definition.js").Z<W, S1, S2, R, G, B>;
|
35
|
-
/**
|
36
|
-
* Recovers from all errors.
|
37
|
-
* @tsplus pipeable fncts.control.Z catchAll
|
38
|
-
* @tsplus location "@fncts/base/control/Z/api"
|
39
|
-
*/
|
40
|
-
export declare function catchAll<W, S1, E, S3, R1, E1, B>(onFailure: (e: E) => Z<W, S1, S3, R1, E1, B>): <S2, R, A>(fa: import("./definition.js").Z<W, S1, S2, R, E, A>) => import("./definition.js").Z<W, S1, S3, R1 | R, E1, B | A>;
|
41
|
-
/**
|
42
|
-
* @tsplus pipeable fncts.control.Z catchJust
|
43
|
-
* @tsplus location "@fncts/base/control/Z/api"
|
44
|
-
*/
|
45
|
-
export declare function catchJust<W, S1, E, S3, R1, E1, B>(f: (e: E) => Maybe<Z<W, S1, S3, R1, E1, B>>): <S2, R, A>(fa: import("./definition.js").Z<W, S1, S2, R, E, A>) => import("./definition.js").Z<W, S1, S3 | S2, R1 | R, E | E1, B | A>;
|
46
|
-
/**
|
47
|
-
* @tsplus pipeable fncts.control.Z flatMap
|
48
|
-
* @tsplus location "@fncts/base/control/Z/api"
|
49
|
-
*/
|
50
|
-
export declare function flatMap<S2, A, W1, S3, R1, E1, B>(f: (a: A) => Z<W1, S2, S3, R1, E1, B>): <W, S1, R, E>(ma: import("./definition.js").Z<W, S1, S2, R, E, A>) => import("./definition.js").Z<W1 | W, S1, S3, R1 & R, E1 | E, B>;
|
51
|
-
/**
|
52
|
-
* @tsplus pipeable fncts.control.Z contramapEnvironment
|
53
|
-
* @tsplus location "@fncts/base/control/Z/api"
|
54
|
-
*/
|
55
|
-
export declare function contramapEnvironment<R0, R>(f: (r0: Environment<R0>) => Environment<R>): <W, S1, S2, E, A>(ma: import("./definition.js").Z<W, S1, S2, R, E, A>) => import("./definition.js").Z<W, S1, S2, R0, E, A>;
|
56
|
-
/**
|
57
|
-
* Transforms the initial state of this computation` with the specified
|
58
|
-
* function.
|
59
|
-
* @tsplus pipeable fncts.control.Z contramapState
|
60
|
-
* @tsplus location "@fncts/base/control/Z/api"
|
61
|
-
*/
|
62
|
-
export declare function contramapState<S0, S1>(f: (s: S0) => S1): <W, S2, R, E, A>(fa: import("./definition.js").Z<W, S1, S2, R, E, A>) => import("./definition.js").Z<W, S0, S2, R, E, A>;
|
63
|
-
/**
|
64
|
-
* @tsplus pipeable fncts.control.Z cross
|
65
|
-
* @tsplus location "@fncts/base/control/Z/api"
|
66
|
-
*/
|
67
|
-
export declare function cross<W, S, R1, E1, B>(fb: Z<W, S, S, R1, E1, B>): <R, E, A>(fa: import("./definition.js").Z<W, S, S, R, E, A>) => import("./definition.js").Z<W, S, S, R & R1, E1 | E, readonly [A, B]>;
|
68
|
-
/**
|
69
|
-
* @tsplus pipeable fncts.control.Z crossWith
|
70
|
-
* @tsplus location "@fncts/base/control/Z/api"
|
71
|
-
*/
|
72
|
-
export declare function crossWith<W, S, A, R1, E1, B, C>(fb: Z<W, S, S, R1, E1, B>, f: (a: A, b: B) => C): <R, E>(fa: import("./definition.js").Z<W, S, S, R, E, A>) => import("./definition.js").Z<W, S, S, R & R1, E1 | E, C>;
|
73
|
-
/**
|
74
|
-
* @tsplus static fncts.control.ZOps defer
|
75
|
-
* @tsplus location "@fncts/base/control/Z/api"
|
76
|
-
*/
|
77
|
-
export declare function defer<W, S1, S2, R, E, A>(ma: Lazy<Z<W, S1, S2, R, E, A>>, __tsplusTrace?: string): Z<W, S1, S2, R, E, A>;
|
78
|
-
/**
|
79
|
-
* Returns a computation whose failure and success have been lifted into an
|
80
|
-
* `Either`. The resulting computation cannot fail, because the failure case
|
81
|
-
* has been exposed as part of the `Either` success case.
|
82
|
-
* @tsplus getter fncts.control.Z either
|
83
|
-
* @tsplus location "@fncts/base/control/Z/api"
|
84
|
-
*/
|
85
|
-
export declare function either<W, S1, S2, R, E, A>(fa: Z<W, S1, S2, R, E, A>): Z<W, S1, S1 | S2, R, never, Either<E, A>>;
|
86
|
-
/**
|
87
|
-
* @tsplus static fncts.control.ZOps environment
|
88
|
-
* @tsplus location "@fncts/base/control/Z/api"
|
89
|
-
*/
|
90
|
-
export declare function environment<R>(): Z<never, unknown, never, R, never, Environment<R>>;
|
91
|
-
/**
|
92
|
-
* @tsplus static fncts.control.ZOps environmentWith
|
93
|
-
* @tsplus location "@fncts/base/control/Z/api"
|
94
|
-
*/
|
95
|
-
export declare function environmentWith<R0, A>(f: (r: Environment<R0>) => A): Z<never, unknown, never, R0, never, A>;
|
96
|
-
/**
|
97
|
-
* @tsplus static fncts.control.ZOps environmentWithZ
|
98
|
-
* @tsplus location "@fncts/base/control/Z/api"
|
99
|
-
*/
|
100
|
-
export declare function environmentWithZ<R0, W, S1, S2, R, E, A>(f: (r: Environment<R0>) => Z<W, S1, S2, R, E, A>): Z<W, S1, S2, R | R0, E, A>;
|
101
|
-
/**
|
102
|
-
* Erases the current log
|
103
|
-
* @tsplus getter fncts.control.Z erase
|
104
|
-
* @tsplus location "@fncts/base/control/Z/api"
|
105
|
-
*/
|
106
|
-
export declare function erase<W, S1, S2, R, E, A>(wa: Z<W, S1, S2, R, E, A>): Z<never, S1, S2, R, E, A>;
|
107
|
-
/**
|
108
|
-
* @tsplus static fncts.control.ZOps fail
|
109
|
-
* @tsplus location "@fncts/base/control/Z/api"
|
110
|
-
*/
|
111
|
-
export declare function fail<E>(e: Lazy<E>, __tsplusTrace?: string): Z<never, unknown, never, never, E, never>;
|
112
|
-
/**
|
113
|
-
* @tsplus static fncts.control.ZOps failNow
|
114
|
-
* @tsplus location "@fncts/base/control/Z/api"
|
115
|
-
*/
|
116
|
-
export declare function failNow<E>(e: E, __tsplusTrace?: string): Z<never, unknown, never, never, E, never>;
|
117
|
-
/**
|
118
|
-
* @tsplus static fncts.control.ZOps failCause
|
119
|
-
* @tsplus location "@fncts/base/control/Z/api"
|
120
|
-
*/
|
121
|
-
export declare function failCause<E>(cause: Lazy<Cause<E>>, __tsplusTrace?: string): Z<never, unknown, never, never, E, never>;
|
122
|
-
/**
|
123
|
-
* @tsplus static fncts.control.ZOps failCauseNow
|
124
|
-
* @tsplus location "@fncts/base/control/Z/api"
|
125
|
-
*/
|
126
|
-
export declare function failCauseNow<E>(cause: Cause<E>, __tsplusTrace?: string): Z<never, unknown, never, never, E, never>;
|
127
|
-
/**
|
128
|
-
* @tsplus getter fncts.control.Z flatten
|
129
|
-
* @tsplus location "@fncts/base/control/Z/api"
|
130
|
-
*/
|
131
|
-
export declare function flatten<W, S1, S2, R, E, A, W1, S3, R1, E1>(mma: Z<W, S1, S2, R, E, Z<W1, S2, S3, R1, E1, A>>): Z<W | W1, S1, S3, R1 & R, E1 | E, A>;
|
132
|
-
/**
|
133
|
-
* Constructs a computation that returns the initial state unchanged.
|
134
|
-
* @tsplus static fncts.control.ZOps get
|
135
|
-
* @tsplus location "@fncts/base/control/Z/api"
|
136
|
-
*/
|
137
|
-
export declare function get<S>(): Z<never, S, S, never, never, S>;
|
138
|
-
/**
|
139
|
-
* @tsplus static fncts.control.ZOps gets
|
140
|
-
* @tsplus location "@fncts/base/control/Z/api"
|
141
|
-
*/
|
142
|
-
export declare function gets<S, A>(f: (s: S) => A): Z<never, S, S, never, never, A>;
|
143
|
-
/**
|
144
|
-
* @tsplus static fncts.control.ZOps getsZ
|
145
|
-
* @tsplus location "@fncts/base/control/Z/api"
|
146
|
-
*/
|
147
|
-
export declare function getsZ<S, W, R, E, A>(f: (s: S) => Z<W, S, S, R, E, A>): Z<W, S, S, R, E, A>;
|
148
|
-
/**
|
149
|
-
* @tsplus static fncts.control.ZOps halt
|
150
|
-
* @tsplus location "@fncts/base/control/Z/api"
|
151
|
-
*/
|
152
|
-
export declare function halt(defect: Lazy<unknown>, __tsplusTrace?: string): Z<never, unknown, never, never, never, never>;
|
153
|
-
/**
|
154
|
-
* @tsplus static fncts.control.ZOps haltNow
|
155
|
-
* @tsplus location "@fncts/base/control/Z/api"
|
156
|
-
*/
|
157
|
-
export declare function haltNow(defect: unknown, __tsplusTrace?: string): Z<never, unknown, never, never, never, never>;
|
158
|
-
/**
|
159
|
-
* @tsplus getter fncts.control.Z listen
|
160
|
-
* @tsplus location "@fncts/base/control/Z/api"
|
161
|
-
*/
|
162
|
-
export declare function listen<W, S1, S2, R, E, A>(wa: Z<W, S1, S2, R, E, A>): Z<W, S1, S2, R, E, readonly [A, Conc<W>]>;
|
163
|
-
/**
|
164
|
-
* @tsplus pipeable fncts.control.Z listens
|
165
|
-
* @tsplus location "@fncts/base/control/Z/api"
|
166
|
-
*/
|
167
|
-
export declare function listens<W, B>(f: (log: Conc<W>) => B): <S1, S2, R, E, A>(wa: import("./definition.js").Z<W, S1, S2, R, E, A>) => import("./definition.js").Z<W, S1, S2, R, E, readonly [A, B]>;
|
168
|
-
/**
|
169
|
-
* @tsplus pipeable fncts.control.Z map
|
170
|
-
* @tsplus location "@fncts/base/control/Z/api"
|
171
|
-
*/
|
172
|
-
export declare function map<A, B>(f: (a: A) => B): <W, S1, S2, R, E>(fa: import("./definition.js").Z<W, S1, S2, R, E, A>) => import("./definition.js").Z<W, S1, S2, R, E, B>;
|
173
|
-
/**
|
174
|
-
* @tsplus pipeable fncts.control.Z mapError
|
175
|
-
* @tsplus location "@fncts/base/control/Z/api"
|
176
|
-
*/
|
177
|
-
export declare function mapError<E, G>(f: (e: E) => G): <W, S1, S2, R, A>(pab: import("./definition.js").Z<W, S1, S2, R, E, A>) => import("./definition.js").Z<W, S1, S2, R, G, A>;
|
178
|
-
/**
|
179
|
-
* Modifies the current log with the specified function
|
180
|
-
* @tsplus pipeable fncts.control.Z mapLog
|
181
|
-
* @tsplus location "@fncts/base/control/Z/api"
|
182
|
-
*/
|
183
|
-
export declare function mapLog<W, W1>(f: (ws: Conc<W>) => Conc<W1>): <S1, S2, R, E, A>(wa: import("./definition.js").Z<W, S1, S2, R, E, A>) => import("./definition.js").Z<W1, S1, S2, R, E, A>;
|
184
|
-
/**
|
185
|
-
* Modifies the current state with the specified function
|
186
|
-
* @tsplus pipeable fncts.control.Z mapState
|
187
|
-
* @tsplus location "@fncts/base/control/Z/api"
|
188
|
-
*/
|
189
|
-
export declare function mapState<S2, S3>(f: (s: S2) => S3): <W, S1, R, E, A>(ma: import("./definition.js").Z<W, S1, S2, R, E, A>) => import("./definition.js").Z<W, S1, S3, R, E, A>;
|
190
|
-
/**
|
191
|
-
* Folds over the failed or successful results of this computation to yield
|
192
|
-
* a computation that does not fail, but succeeds with the value of the left
|
193
|
-
* or right function passed to `match`.
|
194
|
-
* @tsplus pipeable fncts.control.Z match
|
195
|
-
* @tsplus location "@fncts/base/control/Z/api"
|
196
|
-
*/
|
197
|
-
export declare function match<E, A, B, C>(onFailure: (e: E) => B, onSuccess: (a: A) => C): <W, S1, S2, R>(fa: import("./definition.js").Z<W, S1, S2, R, E, A>) => import("./definition.js").Z<W, S1, S2, R, never, B | C>;
|
198
|
-
/**
|
199
|
-
* Recovers from errors by accepting one computation to execute for the case
|
200
|
-
* of an error, and one computation to execute for the case of success.
|
201
|
-
* @tsplus pipeable fncts.control.Z matchZ
|
202
|
-
* @tsplus location "@fncts/base/control/Z/api"
|
203
|
-
*/
|
204
|
-
export declare function matchZ<S5, S2, E, A, W1, S3, R1, E1, B, W2, S4, R2, E2, C>(onFailure: (e: E) => Z<W1, S5, S3, R1, E1, B>, onSuccess: (a: A) => Z<W2, S2, S4, R2, E2, C>): <W, S1, R>(fa: import("./definition.js").Z<W, S1, S2, R, E, A>) => import("./definition.js").Z<W1 | W2 | W, S1 & S5, S3 | S4, R1 | R2 | R, E1 | E2, B | C>;
|
205
|
-
/**
|
206
|
-
* @tsplus pipeable fncts.control.Z matchCauseZ
|
207
|
-
* @tsplus location "@fncts/base/control/Z/api"
|
208
|
-
*/
|
209
|
-
export declare function matchCauseZ<S2, E, A, W1, S0, S3, R1, E1, B, W2, S4, R2, E2, C>(onFailure: (e: Cause<E>) => Z<W1, S0, S3, R1, E1, B>, onSuccess: (a: A) => Z<W2, S2, S4, R2, E2, C>): <W, S1, R>(fa: import("./definition.js").Z<W, S1, S2, R, E, A>) => import("./definition.js").Z<W1 | W2 | W, S0 & S1, S3 | S4, R1 | R2 | R, E1 | E2, B | C>;
|
210
|
-
/**
|
211
|
-
* @tsplus pipeable fncts.control.Z matchLogZ
|
212
|
-
* @tsplus location "@fncts/base/control/Z/api"
|
213
|
-
*/
|
214
|
-
export declare function matchLogZ<W, S5, S2, E, A, W1, S3, R1, E1, B, W2, S4, R2, E2, C>(onFailure: (ws: Conc<W>, e: E) => Z<W1, S5, S3, R1, E1, B>, onSuccess: (ws: Conc<W>, a: A) => Z<W2, S2, S4, R2, E2, C>): <S1, R>(fa: import("./definition.js").Z<W, S1, S2, R, E, A>) => import("./definition.js").Z<W | W1 | W2, S1 & S5, S3 | S4, R1 | R2 | R, E1 | E2, B | C>;
|
215
|
-
/**
|
216
|
-
* Recovers from errors by accepting one computation to execute for the case
|
217
|
-
* of an error, and one computation to execute for the case of success. More powerful
|
218
|
-
* than `matchCauseM` by providing the current state of the log as an argument in
|
219
|
-
* each case
|
220
|
-
* @note the log is cleared after being provided
|
221
|
-
* @tsplus pipeable fncts.control.Z matchLogCauseZ
|
222
|
-
* @tsplus location "@fncts/base/control/Z/api"
|
223
|
-
*/
|
224
|
-
export declare function matchLogCauseZ<W, S2, E, A, W1, S0, S3, R1, E1, B, W2, S4, R2, E2, C>(onFailure: (ws: Conc<W>, e: Cause<E>) => Z<W1, S0, S3, R1, E1, B>, onSuccess: (ws: Conc<W>, a: A) => Z<W2, S2, S4, R2, E2, C>): <S1, R>(fa: import("./definition.js").Z<W, S1, S2, R, E, A>) => import("./definition.js").Z<W1 | W2, S0 & S1, S3 | S4, R & R1 & R2, E1 | E2, B | C>;
|
225
|
-
/**
|
226
|
-
* Constructs a computation from the specified modify function
|
227
|
-
* @tsplus static fncts.control.ZOps modify
|
228
|
-
* @tsplus location "@fncts/base/control/Z/api"
|
229
|
-
*/
|
230
|
-
export declare function modify<S1, S2, A>(f: (s: S1) => readonly [A, S2]): Z<never, S1, S2, never, never, A>;
|
231
|
-
/**
|
232
|
-
* Constructs a computation that may fail from the specified modify function.
|
233
|
-
* @tsplus static fncts.control.ZOps modifyEither
|
234
|
-
* @tsplus location "@fncts/base/control/Z/api"
|
235
|
-
*/
|
236
|
-
export declare function modifyEither<S1, S2, E, A>(f: (s: S1) => Either<E, readonly [A, S2]>): Z<never, S1, S2, never, E, A>;
|
237
|
-
/**
|
238
|
-
* @tsplus pipeable fncts.control.Z orElse
|
239
|
-
* @tsplus location "@fncts/base/control/Z/api"
|
240
|
-
*/
|
241
|
-
export declare function orElse<S1, W1, S3, R1, E1, A1>(fb: Lazy<Z<W1, S1, S3, R1, E1, A1>>): <W, S2, R, E, A>(fa: import("./definition.js").Z<W, S1, S2, R, E, A>) => import("./definition.js").Z<W1 | W, S1, S3 | S2, R1 | R, E1 | E, A1 | A>;
|
242
|
-
/**
|
243
|
-
* Executes this computation and returns its value, if it succeeds, but
|
244
|
-
* otherwise executes the specified computation.
|
245
|
-
* @tsplus pipeable fncts.control.Z orElseEither
|
246
|
-
* @tsplus location "@fncts/base/control/Z/api"
|
247
|
-
*/
|
248
|
-
export declare function orElseEither<W, S3, S4, R1, E1, A1>(that: Lazy<Z<W, S3, S4, R1, E1, A1>>): <S1, S2, R, E, A>(fa: import("./definition.js").Z<W, S1, S2, R, E, A>) => import("./definition.js").Z<W, S1 & S3, S4 | S2, R1 | R, E1, import("../../data/Either.js").Either<A, A1>>;
|
249
|
-
/**
|
250
|
-
* @tsplus pipeable fncts.control.Z provideEnvironment
|
251
|
-
* @tsplus location "@fncts/base/control/Z/api"
|
252
|
-
*/
|
253
|
-
export declare function provideEnvironment<R>(r: Environment<R>): <W, S1, S2, E, A>(fa: import("./definition.js").Z<W, S1, S2, R, E, A>) => import("./definition.js").Z<W, S1, S2, never, E, A>;
|
254
|
-
/**
|
255
|
-
* Constructs a computation that sets the state to the specified value.
|
256
|
-
* @tsplus static fncts.control.ZOps put
|
257
|
-
* @tsplus location "@fncts/base/control/Z/api"
|
258
|
-
*/
|
259
|
-
export declare function put<S>(s: S): Z<never, unknown, S, never, never, void>;
|
260
|
-
/**
|
261
|
-
* Repeats this computation the specified number of times (or until the first failure)
|
262
|
-
* passing the updated state to each successive repetition.
|
263
|
-
* @tsplus pipeable fncts.control.Z repeatN
|
264
|
-
* @tsplus location "@fncts/base/control/Z/api"
|
265
|
-
*/
|
266
|
-
export declare function repeatN(n: number): <W, S1, S2 extends S1, R, E, A>(ma: import("./definition.js").Z<W, S1, S2, R, E, A>) => import("./definition.js").Z<W, S1, S2, R, E, A>;
|
267
|
-
/**
|
268
|
-
* Repeats this computation until its value satisfies the specified predicate
|
269
|
-
* (or until the first failure) passing the updated state to each successive repetition.
|
270
|
-
* @tsplus pipeable fncts.control.Z repeatUntil
|
271
|
-
* @tsplus location "@fncts/base/control/Z/api"
|
272
|
-
*/
|
273
|
-
export declare function repeatUntil<A>(p: Predicate<A>): <W, S1, S2 extends S1, R, E>(ma: import("./definition.js").Z<W, S1, S2, R, E, A>) => import("./definition.js").Z<W, S1, S2, R, E, A>;
|
274
|
-
/**
|
275
|
-
* @tsplus static fncts.control.ZOps succeed
|
276
|
-
* @tsplus location "@fncts/base/control/Z/api"
|
277
|
-
*/
|
278
|
-
export declare function succeed<A, W = never, S1 = unknown, S2 = never>(effect: Lazy<A>, __tsplusTrace?: string): Z<W, S1, S2, never, never, A>;
|
279
|
-
/**
|
280
|
-
* @tsplus static fncts.control.ZOps succeedNow
|
281
|
-
* @tsplus location "@fncts/base/control/Z/api"
|
282
|
-
*/
|
283
|
-
export declare function succeedNow<A, W = never, S1 = unknown, S2 = never>(a: A, __tsplusTrace?: string): Z<W, S1, S2, never, never, A>;
|
284
|
-
/**
|
285
|
-
* @tsplus pipeable fncts.control.Z tap
|
286
|
-
* @tsplus location "@fncts/base/control/Z/api"
|
287
|
-
*/
|
288
|
-
export declare function tap<S2, A, W1, S3, R1, E1, B>(f: (a: A) => Z<W1, S2, S3, R1, E1, B>): <W, S1, R, E>(ma: import("./definition.js").Z<W, S1, S2, R, E, A>) => import("./definition.js").Z<W1 | W, S1, S3, R1 & R, E1 | E, A>;
|
289
|
-
/**
|
290
|
-
* @tsplus static fncts.control.ZOps tell
|
291
|
-
* @tsplus location "@fncts/base/control/Z/api"
|
292
|
-
*/
|
293
|
-
export declare function tell<W>(w: W): Z<W, unknown, never, never, never, void>;
|
294
|
-
/**
|
295
|
-
* @tsplus static fncts.control.ZOps tellAll
|
296
|
-
* @tsplus location "@fncts/base/control/Z/api"
|
297
|
-
*/
|
298
|
-
export declare function tellAll<W>(ws: Conc<W>): Z<W, unknown, never, never, never, void>;
|
299
|
-
/**
|
300
|
-
* Like `map`, but also allows the state to be modified.
|
301
|
-
* @tsplus pipeable fncts.control.Z transform
|
302
|
-
* @tsplus location "@fncts/base/control/Z/api"
|
303
|
-
*/
|
304
|
-
export declare function transform<S2, A, S3, B>(f: (s: S2, a: A) => readonly [B, S3]): <W, S1, R, E>(ma: import("./definition.js").Z<W, S1, S2, R, E, A>) => import("./definition.js").Z<W, S1, S3, R, E, B>;
|
305
|
-
/**
|
306
|
-
* @tsplus static fncts.control.ZOps unit
|
307
|
-
* @tsplus location "@fncts/base/control/Z/api"
|
308
|
-
*/
|
309
|
-
export declare const unit: Z<never, unknown, never, never, never, void>;
|
310
|
-
/**
|
311
|
-
* Constructs a computation from the specified update function.
|
312
|
-
* @tsplus static fncts.control.ZOps update
|
313
|
-
* @tsplus location "@fncts/base/control/Z/api"
|
314
|
-
*/
|
315
|
-
export declare function update<S1, S2>(f: (s: S1) => S2): Z<never, S1, S2, never, never, void>;
|
316
|
-
/**
|
317
|
-
* @tsplus pipeable fncts.control.Z write
|
318
|
-
* @tsplus location "@fncts/base/control/Z/api"
|
319
|
-
*/
|
320
|
-
export declare function write<W1>(w: W1): <W, S1, S2, R, E, A>(ma: import("./definition.js").Z<W, S1, S2, R, E, A>) => import("./definition.js").Z<W1 | W, S1, S2, R, E, A>;
|
321
|
-
/**
|
322
|
-
* @tsplus pipeable fncts.control.Z writeAll
|
323
|
-
* @tsplus location "@fncts/base/control/Z/api"
|
324
|
-
*/
|
325
|
-
export declare function writeAll<W1>(log: Conc<W1>): <W, S1, S2, R, E, A>(ma: import("./definition.js").Z<W, S1, S2, R, E, A>) => import("./definition.js").Z<W1 | W, S1, S2, R, E, A>;
|
326
|
-
/**
|
327
|
-
* @tsplus pipeable fncts.control.Z zip
|
328
|
-
* @tsplus location "@fncts/base/control/Z/api"
|
329
|
-
*/
|
330
|
-
export declare function zip<S2, W1, S3, Q, D, B>(fb: Z<W1, S2, S3, Q, D, B>): <W, S1, R, E, A>(fa: import("./definition.js").Z<W, S1, S2, R, E, A>) => import("./definition.js").Z<W1 | W, S1, S3, Q & R, D | E, import("../../data/Zipped.js").Zipped.Make<A, B>>;
|
331
|
-
/**
|
332
|
-
* @tsplus pipeable fncts.control.Z zipFirst
|
333
|
-
* @tsplus location "@fncts/base/control/Z/api"
|
334
|
-
*/
|
335
|
-
export declare function zipFirst<S2, W1, S3, Q, D, B>(fb: Z<W1, S2, S3, Q, D, B>): <W, S1, R, E, A>(fa: import("./definition.js").Z<W, S1, S2, R, E, A>) => import("./definition.js").Z<W1 | W, S1, S3, Q & R, D | E, A>;
|
336
|
-
/**
|
337
|
-
* @tsplus pipeable fncts.control.Z zipSecond
|
338
|
-
* @tsplus location "@fncts/base/control/Z/api"
|
339
|
-
*/
|
340
|
-
export declare function zipSecond<S2, W1, S3, Q, D, B>(fb: Z<W1, S2, S3, Q, D, B>): <W, S1, R, E, A>(fa: import("./definition.js").Z<W, S1, S2, R, E, A>) => import("./definition.js").Z<W1 | W, S1, S3, Q & R, D | E, B>;
|
341
|
-
/**
|
342
|
-
* @tsplus pipeable fncts.control.Z zipWith
|
343
|
-
* @tsplus location "@fncts/base/control/Z/api"
|
344
|
-
*/
|
345
|
-
export declare function zipWith<S2, A, W1, S3, R1, E1, B, C>(fb: Z<W1, S2, S3, R1, E1, B>, f: (a: A, b: B) => C): <W, S1, R, E>(fa: import("./definition.js").Z<W, S1, S2, R, E, A>) => import("./definition.js").Z<W1 | W, S1, S3, R1 & R, E1 | E, C>;
|