@fncts/base 0.0.29 → 0.0.31
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/Date/definition.cjs +6 -0
- package/_cjs/data/Date/definition.cjs.map +1 -0
- package/_cjs/data/Date.cjs +17 -0
- package/_cjs/data/Date.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/Date/definition.mjs +2 -0
- package/_mjs/data/Date/definition.mjs.map +1 -0
- package/_mjs/data/Date.mjs +3 -0
- package/_mjs/data/Date.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/Date/definition.ts +6 -0
- package/_src/data/Date.ts +3 -0
- package/_src/data/Showable/show.ts +55 -53
- package/_src/data.ts +1 -0
- 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/Date/definition.d.ts +9 -0
- package/data/Date.d.ts +1 -0
- package/data/Showable/show.d.ts +2 -2
- package/data.d.ts +1 -0
- 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
@@ -15,29 +15,31 @@ exports.defer = exports.crossWith = void 0;
|
|
15
15
|
exports.either = either;
|
16
16
|
exports.environment = environment;
|
17
17
|
exports.environmentWith = environmentWith;
|
18
|
-
exports.
|
18
|
+
exports.environmentWithPure = void 0;
|
19
19
|
exports.erase = erase;
|
20
20
|
exports.fail = fail;
|
21
21
|
exports.flatMap = exports.failNow = exports.failCauseNow = exports.failCause = void 0;
|
22
22
|
exports.flatten = flatten;
|
23
23
|
exports.get = void 0;
|
24
24
|
exports.gets = gets;
|
25
|
-
exports.
|
25
|
+
exports.getsPure = getsPure;
|
26
26
|
exports.halt = halt;
|
27
27
|
exports.haltNow = haltNow;
|
28
28
|
exports.listen = void 0;
|
29
29
|
exports.listens = listens;
|
30
30
|
exports.map = void 0;
|
31
31
|
exports.mapError = mapError;
|
32
|
-
exports.
|
33
|
-
exports.
|
34
|
-
exports.modify = exports.
|
32
|
+
exports.matchLogCausePure = exports.matchCausePure = exports.match = exports.mapState = exports.mapLog = void 0;
|
33
|
+
exports.matchLogPure = matchLogPure;
|
34
|
+
exports.modify = exports.matchPure = void 0;
|
35
35
|
exports.modifyEither = modifyEither;
|
36
36
|
exports.orElse = orElse;
|
37
37
|
exports.orElseEither = orElseEither;
|
38
38
|
exports.provideEnvironment = void 0;
|
39
39
|
exports.put = put;
|
40
|
-
exports.
|
40
|
+
exports.repeatUntil = exports.repeatN = void 0;
|
41
|
+
exports.succeed = succeed;
|
42
|
+
exports.succeedNow = void 0;
|
41
43
|
exports.tap = tap;
|
42
44
|
exports.tell = tell;
|
43
45
|
exports.update = exports.unit = exports.transform = exports.tellAll = void 0;
|
@@ -57,11 +59,11 @@ var tsplus_module_5 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require
|
|
57
59
|
var tsplus_module_6 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/collection/immutable/Conc/api"));
|
58
60
|
var tsplus_module_7 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/collection/immutable/Conc/constructors"));
|
59
61
|
var tsplus_module_8 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/Zipped"));
|
62
|
+
var _definition = /*#__PURE__*/require("@fncts/base/control/Pure/definition");
|
60
63
|
var _function = /*#__PURE__*/require("../../data/function.cjs");
|
61
|
-
var _definition = /*#__PURE__*/require("./definition.cjs");
|
62
64
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
63
65
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
64
|
-
const fileName_1 = "(@fncts/base) src/control/
|
66
|
+
const fileName_1 = "(@fncts/base) src/control/Pure/api.ts";
|
65
67
|
const catchAll = catchAll_1;
|
66
68
|
exports.catchAll = catchAll;
|
67
69
|
const flatMap = flatMap_1;
|
@@ -70,8 +72,8 @@ const crossWith = crossWith_1;
|
|
70
72
|
exports.crossWith = crossWith;
|
71
73
|
const defer = defer_1;
|
72
74
|
exports.defer = defer;
|
73
|
-
const
|
74
|
-
exports.
|
75
|
+
const environmentWithPure = environmentWithPure_1;
|
76
|
+
exports.environmentWithPure = environmentWithPure;
|
75
77
|
const failNow = failNow_1;
|
76
78
|
exports.failNow = failNow;
|
77
79
|
const failCause = failCause_1;
|
@@ -90,12 +92,12 @@ const mapState = mapState_1;
|
|
90
92
|
exports.mapState = mapState;
|
91
93
|
const match = match_1;
|
92
94
|
exports.match = match;
|
93
|
-
const
|
94
|
-
exports.
|
95
|
-
const
|
96
|
-
exports.
|
97
|
-
const
|
98
|
-
exports.
|
95
|
+
const matchPure = matchPure_1;
|
96
|
+
exports.matchPure = matchPure;
|
97
|
+
const matchCausePure = matchCausePure_1;
|
98
|
+
exports.matchCausePure = matchCausePure;
|
99
|
+
const matchLogCausePure = matchLogCausePure_1;
|
100
|
+
exports.matchLogCausePure = matchLogCausePure;
|
99
101
|
const modify = modify_1;
|
100
102
|
exports.modify = modify;
|
101
103
|
const provideEnvironment = provideEnvironment_1;
|
@@ -104,8 +106,6 @@ const repeatN = repeatN_1;
|
|
104
106
|
exports.repeatN = repeatN;
|
105
107
|
const repeatUntil = repeatUntil_1;
|
106
108
|
exports.repeatUntil = repeatUntil;
|
107
|
-
const succeed = succeed_1;
|
108
|
-
exports.succeed = succeed;
|
109
109
|
const succeedNow = succeedNow_1;
|
110
110
|
exports.succeedNow = succeedNow;
|
111
111
|
const tellAll = tellAll_1;
|
@@ -119,13 +119,13 @@ exports.writeAll = writeAll;
|
|
119
119
|
const zipWith = zipWith_1;
|
120
120
|
exports.zipWith = zipWith;
|
121
121
|
/**
|
122
|
-
* @tsplus getter fncts.control.
|
122
|
+
* @tsplus getter fncts.control.Pure absolve
|
123
123
|
*/
|
124
124
|
function absolve(fa) {
|
125
125
|
return flatMap_1(ea => tsplus_module_1.match(failNow_1, succeedNow_1)(ea))(fa);
|
126
126
|
}
|
127
127
|
/**
|
128
|
-
* @tsplus pipeable fncts.control.
|
128
|
+
* @tsplus pipeable fncts.control.Pure ap
|
129
129
|
*/
|
130
130
|
function ap(fb) {
|
131
131
|
return self => {
|
@@ -133,7 +133,7 @@ function ap(fb) {
|
|
133
133
|
};
|
134
134
|
}
|
135
135
|
/**
|
136
|
-
* @tsplus pipeable fncts.control.
|
136
|
+
* @tsplus pipeable fncts.control.Pure zipLeft
|
137
137
|
*/
|
138
138
|
function zipLeft(fb) {
|
139
139
|
return fa => {
|
@@ -141,7 +141,7 @@ function zipLeft(fb) {
|
|
141
141
|
};
|
142
142
|
}
|
143
143
|
/**
|
144
|
-
* @tsplus pipeable fncts.control.
|
144
|
+
* @tsplus pipeable fncts.control.Pure zipRight
|
145
145
|
*/
|
146
146
|
function zipRight(fb) {
|
147
147
|
return fa => {
|
@@ -149,25 +149,25 @@ function zipRight(fb) {
|
|
149
149
|
};
|
150
150
|
}
|
151
151
|
/**
|
152
|
-
* @tsplus pipeable fncts.control.
|
152
|
+
* @tsplus pipeable fncts.control.Pure bimap
|
153
153
|
*/
|
154
154
|
function bimap(f, g) {
|
155
155
|
return pab => {
|
156
|
-
return
|
156
|
+
return matchPure_1(e => failNow_1(f(e), fileName_1 + ":47:26"), a => succeedNow_1(g(a), fileName_1 + ":48:29"))(pab);
|
157
157
|
};
|
158
158
|
}
|
159
159
|
/**
|
160
160
|
* Recovers from all errors.
|
161
161
|
*
|
162
|
-
* @tsplus pipeable fncts.control.
|
162
|
+
* @tsplus pipeable fncts.control.Pure catchAll
|
163
163
|
*/
|
164
164
|
function catchAll_1(onFailure) {
|
165
165
|
return fa => {
|
166
|
-
return
|
166
|
+
return matchPure_1(onFailure, succeedNow_1)(fa);
|
167
167
|
};
|
168
168
|
}
|
169
169
|
/**
|
170
|
-
* @tsplus pipeable fncts.control.
|
170
|
+
* @tsplus pipeable fncts.control.Pure catchJust
|
171
171
|
*/
|
172
172
|
function catchJust(f) {
|
173
173
|
return fa => {
|
@@ -175,26 +175,29 @@ function catchJust(f) {
|
|
175
175
|
};
|
176
176
|
}
|
177
177
|
/**
|
178
|
-
* @tsplus pipeable fncts.control.
|
178
|
+
* @tsplus pipeable fncts.control.Pure flatMap
|
179
179
|
*/
|
180
180
|
function flatMap_1(f) {
|
181
181
|
return ma => {
|
182
|
-
|
182
|
+
const z = new _definition.PurePrimitive(5 /* PureTag.Chain */);
|
183
|
+
z.i0 = ma;
|
184
|
+
z.i1 = f;
|
185
|
+
return z;
|
183
186
|
};
|
184
187
|
}
|
185
188
|
/**
|
186
|
-
* @tsplus pipeable fncts.control.
|
189
|
+
* @tsplus pipeable fncts.control.Pure contramapEnvironment
|
187
190
|
*/
|
188
191
|
function contramapEnvironment(f) {
|
189
192
|
return ma => {
|
190
|
-
return
|
193
|
+
return environmentWithPure_1(r => provideEnvironment_1(f(r))(ma));
|
191
194
|
};
|
192
195
|
}
|
193
196
|
/**
|
194
197
|
* Transforms the initial state of this computation` with the specified
|
195
198
|
* function.
|
196
199
|
*
|
197
|
-
* @tsplus pipeable fncts.control.
|
200
|
+
* @tsplus pipeable fncts.control.Pure contramapState
|
198
201
|
*/
|
199
202
|
function contramapState(f) {
|
200
203
|
return fa => {
|
@@ -202,7 +205,7 @@ function contramapState(f) {
|
|
202
205
|
};
|
203
206
|
}
|
204
207
|
/**
|
205
|
-
* @tsplus pipeable fncts.control.
|
208
|
+
* @tsplus pipeable fncts.control.Pure cross
|
206
209
|
*/
|
207
210
|
function cross(fb) {
|
208
211
|
return fa => {
|
@@ -210,7 +213,7 @@ function cross(fb) {
|
|
210
213
|
};
|
211
214
|
}
|
212
215
|
/**
|
213
|
-
* @tsplus pipeable fncts.control.
|
216
|
+
* @tsplus pipeable fncts.control.Pure crossWith
|
214
217
|
*/
|
215
218
|
function crossWith_1(fb, f) {
|
216
219
|
return fa => {
|
@@ -218,73 +221,83 @@ function crossWith_1(fb, f) {
|
|
218
221
|
};
|
219
222
|
}
|
220
223
|
/**
|
221
|
-
* @tsplus static fncts.control.
|
224
|
+
* @tsplus static fncts.control.PureOps defer
|
222
225
|
*/
|
223
226
|
function defer_1(ma, __tsplusTrace) {
|
224
|
-
|
227
|
+
const z = new _definition.PurePrimitive(2 /* PureTag.Defer */);
|
228
|
+
z.i0 = ma;
|
229
|
+
return z;
|
225
230
|
}
|
226
231
|
/**
|
227
232
|
* Returns a computation whose failure and success have been lifted into an
|
228
233
|
* `Either`. The resulting computation cannot fail, because the failure case
|
229
234
|
* has been exposed as part of the `Either` success case.
|
230
235
|
*
|
231
|
-
* @tsplus getter fncts.control.
|
236
|
+
* @tsplus getter fncts.control.Pure either
|
232
237
|
*/
|
233
238
|
function either(fa) {
|
234
239
|
return match_1(tsplus_module_3.left, tsplus_module_3.right)(fa);
|
235
240
|
}
|
236
241
|
/**
|
237
|
-
* @tsplus static fncts.control.
|
242
|
+
* @tsplus static fncts.control.PureOps environment
|
238
243
|
*/
|
239
244
|
function environment() {
|
240
|
-
|
245
|
+
const z = new _definition.PurePrimitive(7 /* PureTag.Access */);
|
246
|
+
z.i0 = r => succeedNow_1(r, fileName_1 + ":152:40");
|
247
|
+
return z;
|
241
248
|
}
|
242
249
|
/**
|
243
|
-
* @tsplus static fncts.control.
|
250
|
+
* @tsplus static fncts.control.PureOps environmentWith
|
244
251
|
*/
|
245
252
|
function environmentWith(f) {
|
246
|
-
|
253
|
+
const z = new _definition.PurePrimitive(7 /* PureTag.Access */);
|
254
|
+
z.i0 = r => succeedNow_1(f(r), fileName_1 + ":161:40");
|
255
|
+
return z;
|
247
256
|
}
|
248
257
|
/**
|
249
|
-
* @tsplus static fncts.control.
|
258
|
+
* @tsplus static fncts.control.PureOps environmentWithPure
|
250
259
|
*/
|
251
|
-
function
|
252
|
-
|
260
|
+
function environmentWithPure_1(f) {
|
261
|
+
const z = new _definition.PurePrimitive(7 /* PureTag.Access */);
|
262
|
+
z.i0 = f;
|
263
|
+
return z;
|
253
264
|
}
|
254
265
|
/**
|
255
266
|
* Erases the current log
|
256
267
|
*
|
257
|
-
* @tsplus getter fncts.control.
|
268
|
+
* @tsplus getter fncts.control.Pure erase
|
258
269
|
*/
|
259
270
|
function erase(wa) {
|
260
271
|
return mapLog_1(() => tsplus_module_4.empty())(wa);
|
261
272
|
}
|
262
273
|
/**
|
263
|
-
* @tsplus static fncts.control.
|
274
|
+
* @tsplus static fncts.control.PureOps fail
|
264
275
|
*/
|
265
276
|
function fail(e, __tsplusTrace) {
|
266
277
|
return failCause_1(() => tsplus_module_5.fail(e()), __tsplusTrace);
|
267
278
|
}
|
268
279
|
/**
|
269
|
-
* @tsplus static fncts.control.
|
280
|
+
* @tsplus static fncts.control.PureOps failNow
|
270
281
|
*/
|
271
282
|
function failNow_1(e, __tsplusTrace) {
|
272
283
|
return failCauseNow_1(tsplus_module_5.fail(e), __tsplusTrace);
|
273
284
|
}
|
274
285
|
/**
|
275
|
-
* @tsplus static fncts.control.
|
286
|
+
* @tsplus static fncts.control.PureOps failCause
|
276
287
|
*/
|
277
288
|
function failCause_1(cause, __tsplusTrace) {
|
278
289
|
return defer_1(() => failCauseNow_1(cause(), __tsplusTrace), __tsplusTrace);
|
279
290
|
}
|
280
291
|
/**
|
281
|
-
* @tsplus static fncts.control.
|
292
|
+
* @tsplus static fncts.control.PureOps failCauseNow
|
282
293
|
*/
|
283
294
|
function failCauseNow_1(cause, __tsplusTrace) {
|
284
|
-
|
295
|
+
const z = new _definition.PurePrimitive(3 /* PureTag.Fail */);
|
296
|
+
z.i0 = cause;
|
297
|
+
return z;
|
285
298
|
}
|
286
299
|
/**
|
287
|
-
* @tsplus getter fncts.control.
|
300
|
+
* @tsplus getter fncts.control.Pure flatten
|
288
301
|
*/
|
289
302
|
function flatten(mma) {
|
290
303
|
return flatMap_1(_function.identity)(mma);
|
@@ -292,43 +305,43 @@ function flatten(mma) {
|
|
292
305
|
/**
|
293
306
|
* Constructs a computation that returns the initial state unchanged.
|
294
307
|
*
|
295
|
-
* @tsplus static fncts.control.
|
308
|
+
* @tsplus static fncts.control.PureOps get
|
296
309
|
*/
|
297
310
|
function get_1() {
|
298
311
|
return modify_1(s => [s, s]);
|
299
312
|
}
|
300
313
|
/**
|
301
|
-
* @tsplus static fncts.control.
|
314
|
+
* @tsplus static fncts.control.PureOps gets
|
302
315
|
*/
|
303
316
|
function gets(f) {
|
304
317
|
return modify_1(s => [f(s), s]);
|
305
318
|
}
|
306
319
|
/**
|
307
|
-
* @tsplus static fncts.control.
|
320
|
+
* @tsplus static fncts.control.PureOps getsPure
|
308
321
|
*/
|
309
|
-
function
|
322
|
+
function getsPure(f) {
|
310
323
|
return flatMap_1(f)(get_1());
|
311
324
|
}
|
312
325
|
/**
|
313
|
-
* @tsplus static fncts.control.
|
326
|
+
* @tsplus static fncts.control.PureOps halt
|
314
327
|
*/
|
315
328
|
function halt(defect, __tsplusTrace) {
|
316
329
|
return failCause_1(() => tsplus_module_5.halt(defect()), __tsplusTrace);
|
317
330
|
}
|
318
331
|
/**
|
319
|
-
* @tsplus static fncts.control.
|
332
|
+
* @tsplus static fncts.control.PureOps haltNow
|
320
333
|
*/
|
321
334
|
function haltNow(defect, __tsplusTrace) {
|
322
335
|
return failCauseNow_1(tsplus_module_5.halt(defect), __tsplusTrace);
|
323
336
|
}
|
324
337
|
/**
|
325
|
-
* @tsplus getter fncts.control.
|
338
|
+
* @tsplus getter fncts.control.Pure listen
|
326
339
|
*/
|
327
340
|
function listen_1(wa) {
|
328
|
-
return
|
341
|
+
return matchLogCausePure_1((_, e) => failCauseNow_1(e, fileName_1 + ":269:32"), (ws, a) => succeedNow_1([a, ws], fileName_1 + ":270:31"))(wa);
|
329
342
|
}
|
330
343
|
/**
|
331
|
-
* @tsplus pipeable fncts.control.
|
344
|
+
* @tsplus pipeable fncts.control.Pure listens
|
332
345
|
*/
|
333
346
|
function listens(f) {
|
334
347
|
return wa => {
|
@@ -336,35 +349,38 @@ function listens(f) {
|
|
336
349
|
};
|
337
350
|
}
|
338
351
|
/**
|
339
|
-
* @tsplus pipeable fncts.control.
|
352
|
+
* @tsplus pipeable fncts.control.Pure map
|
340
353
|
*/
|
341
354
|
function map_1(f) {
|
342
355
|
return fa => {
|
343
|
-
return flatMap_1(a => succeedNow_1(f(a), fileName_1 + ":
|
356
|
+
return flatMap_1(a => succeedNow_1(f(a), fileName_1 + ":288:45"))(fa);
|
344
357
|
};
|
345
358
|
}
|
346
359
|
/**
|
347
|
-
* @tsplus pipeable fncts.control.
|
360
|
+
* @tsplus pipeable fncts.control.Pure mapError
|
348
361
|
*/
|
349
362
|
function mapError(f) {
|
350
363
|
return pab => {
|
351
|
-
return
|
364
|
+
return matchPure_1(e => failNow_1(f(e), fileName_1 + ":297:45"), succeedNow_1)(pab);
|
352
365
|
};
|
353
366
|
}
|
354
367
|
/**
|
355
368
|
* Modifies the current log with the specified function
|
356
369
|
*
|
357
|
-
* @tsplus pipeable fncts.control.
|
370
|
+
* @tsplus pipeable fncts.control.Pure mapLog
|
358
371
|
*/
|
359
372
|
function mapLog_1(f) {
|
360
373
|
return wa => {
|
361
|
-
|
374
|
+
const z = new _definition.PurePrimitive(11 /* PureTag.MapLog */);
|
375
|
+
z.i0 = wa;
|
376
|
+
z.i1 = f;
|
377
|
+
return z;
|
362
378
|
};
|
363
379
|
}
|
364
380
|
/**
|
365
381
|
* Modifies the current state with the specified function
|
366
382
|
*
|
367
|
-
* @tsplus pipeable fncts.control.
|
383
|
+
* @tsplus pipeable fncts.control.Pure mapState
|
368
384
|
*/
|
369
385
|
function mapState_1(f) {
|
370
386
|
return ma => {
|
@@ -376,38 +392,38 @@ function mapState_1(f) {
|
|
376
392
|
* a computation that does not fail, but succeeds with the value of the left
|
377
393
|
* or right function passed to `match`.
|
378
394
|
*
|
379
|
-
* @tsplus pipeable fncts.control.
|
395
|
+
* @tsplus pipeable fncts.control.Pure match
|
380
396
|
*/
|
381
397
|
function match_1(onFailure, onSuccess) {
|
382
398
|
return fa => {
|
383
|
-
return
|
399
|
+
return matchPure_1(e => succeedNow_1(onFailure(e), fileName_1 + ":336:29"), a => succeedNow_1(onSuccess(a), fileName_1 + ":337:29"))(fa);
|
384
400
|
};
|
385
401
|
}
|
386
402
|
/**
|
387
403
|
* Recovers from errors by accepting one computation to execute for the case
|
388
404
|
* of an error, and one computation to execute for the case of success.
|
389
405
|
*
|
390
|
-
* @tsplus pipeable fncts.control.
|
406
|
+
* @tsplus pipeable fncts.control.Pure matchPure
|
391
407
|
*/
|
392
|
-
function
|
408
|
+
function matchPure_1(onFailure, onSuccess) {
|
393
409
|
return fa => {
|
394
|
-
return
|
410
|
+
return matchCausePure_1(cause => tsplus_module_1.match(onFailure, failCauseNow_1)(tsplus_module_5.failureOrCause(cause)), onSuccess)(fa);
|
395
411
|
};
|
396
412
|
}
|
397
413
|
/**
|
398
|
-
* @tsplus pipeable fncts.control.
|
414
|
+
* @tsplus pipeable fncts.control.Pure matchCausePure
|
399
415
|
*/
|
400
|
-
function
|
416
|
+
function matchCausePure_1(onFailure, onSuccess) {
|
401
417
|
return fa => {
|
402
|
-
return
|
418
|
+
return matchLogCausePure_1((ws, e) => mapLog_1(w1s => tsplus_module_6.concat(w1s)(ws))(onFailure(e)), (ws, a) => mapLog_1(w2s => tsplus_module_6.concat(w2s)(ws))(onSuccess(a)))(fa);
|
403
419
|
};
|
404
420
|
}
|
405
421
|
/**
|
406
|
-
* @tsplus pipeable fncts.control.
|
422
|
+
* @tsplus pipeable fncts.control.Pure matchLogPure
|
407
423
|
*/
|
408
|
-
function
|
424
|
+
function matchLogPure(onFailure, onSuccess) {
|
409
425
|
return fa => {
|
410
|
-
return
|
426
|
+
return matchLogCausePure_1((ws, cause) => tsplus_module_1.match(e => onFailure(ws, e), failCauseNow_1)(tsplus_module_5.failureOrCause(cause)), onSuccess)(fa);
|
411
427
|
};
|
412
428
|
}
|
413
429
|
/**
|
@@ -418,60 +434,69 @@ function matchLogZ(onFailure, onSuccess) {
|
|
418
434
|
*
|
419
435
|
* @note the log is cleared after being provided
|
420
436
|
*
|
421
|
-
* @tsplus pipeable fncts.control.
|
437
|
+
* @tsplus pipeable fncts.control.Pure matchLogCausePure
|
422
438
|
*/
|
423
|
-
function
|
439
|
+
function matchLogCausePure_1(onFailure, onSuccess) {
|
424
440
|
return fa => {
|
425
|
-
|
441
|
+
const z = new _definition.PurePrimitive(6 /* PureTag.Match */);
|
442
|
+
z.i0 = fa;
|
443
|
+
z.i1 = onFailure;
|
444
|
+
z.i2 = onSuccess;
|
445
|
+
return z;
|
426
446
|
};
|
427
447
|
}
|
428
448
|
/**
|
429
449
|
* Constructs a computation from the specified modify function
|
430
450
|
*
|
431
|
-
* @tsplus static fncts.control.
|
451
|
+
* @tsplus static fncts.control.PureOps modify
|
432
452
|
*/
|
433
453
|
function modify_1(f) {
|
434
|
-
|
454
|
+
const z = new _definition.PurePrimitive(4 /* PureTag.Modify */);
|
455
|
+
z.i0 = f;
|
456
|
+
return z;
|
435
457
|
}
|
436
458
|
/**
|
437
459
|
* Constructs a computation that may fail from the specified modify function.
|
438
460
|
*
|
439
|
-
* @tsplus static fncts.control.
|
461
|
+
* @tsplus static fncts.control.PureOps modifyEither
|
440
462
|
*/
|
441
463
|
function modifyEither(f) {
|
442
|
-
return flatMap_1(r => tsplus_module_1.match(failNow_1, ([a, s2]) => mapState_1(() => s2)(succeedNow_1(a, fileName_1 + ":
|
464
|
+
return flatMap_1(r => tsplus_module_1.match(failNow_1, ([a, s2]) => mapState_1(() => s2)(succeedNow_1(a, fileName_1 + ":431:71")))(r))(map_1(f)(get_1()));
|
443
465
|
}
|
444
466
|
/**
|
445
|
-
* @tsplus pipeable fncts.control.
|
467
|
+
* @tsplus pipeable fncts.control.Pure orElse
|
446
468
|
*/
|
447
469
|
function orElse(fb) {
|
448
470
|
return fa => {
|
449
|
-
return
|
471
|
+
return matchPure_1(() => fb(), succeedNow_1)(fa);
|
450
472
|
};
|
451
473
|
}
|
452
474
|
/**
|
453
475
|
* Executes this computation and returns its value, if it succeeds, but
|
454
476
|
* otherwise executes the specified computation.
|
455
477
|
*
|
456
|
-
* @tsplus pipeable fncts.control.
|
478
|
+
* @tsplus pipeable fncts.control.Pure orElseEither
|
457
479
|
*/
|
458
480
|
function orElseEither(that) {
|
459
481
|
return fa => {
|
460
|
-
return
|
482
|
+
return matchPure_1(() => map_1(tsplus_module_3.right)(that()), a => succeedNow_1(tsplus_module_3.left(a, fileName_1 + ":453:41"), fileName_1 + ":453:29"))(fa);
|
461
483
|
};
|
462
484
|
}
|
463
485
|
/**
|
464
|
-
* @tsplus pipeable fncts.control.
|
486
|
+
* @tsplus pipeable fncts.control.Pure provideEnvironment
|
465
487
|
*/
|
466
488
|
function provideEnvironment_1(r) {
|
467
489
|
return fa => {
|
468
|
-
|
490
|
+
const z = new _definition.PurePrimitive(8 /* PureTag.Provide */);
|
491
|
+
z.i0 = fa;
|
492
|
+
z.i1 = r;
|
493
|
+
return z;
|
469
494
|
};
|
470
495
|
}
|
471
496
|
/**
|
472
497
|
* Constructs a computation that sets the state to the specified value.
|
473
498
|
*
|
474
|
-
* @tsplus static fncts.control.
|
499
|
+
* @tsplus static fncts.control.PureOps put
|
475
500
|
*/
|
476
501
|
function put(s) {
|
477
502
|
return modify_1(() => [undefined, s]);
|
@@ -480,38 +505,42 @@ function put(s) {
|
|
480
505
|
* Repeats this computation the specified number of times (or until the first failure)
|
481
506
|
* passing the updated state to each successive repetition.
|
482
507
|
*
|
483
|
-
* @tsplus pipeable fncts.control.
|
508
|
+
* @tsplus pipeable fncts.control.Pure repeatN
|
484
509
|
*/
|
485
510
|
function repeatN_1(n) {
|
486
511
|
return ma => {
|
487
|
-
return flatMap_1(a => n <= 0 ? succeedNow_1(a, fileName_1 + ":
|
512
|
+
return flatMap_1(a => n <= 0 ? succeedNow_1(a, fileName_1 + ":487:55") : repeatN_1(n - 1)(ma))(ma);
|
488
513
|
};
|
489
514
|
}
|
490
515
|
/**
|
491
516
|
* Repeats this computation until its value satisfies the specified predicate
|
492
517
|
* (or until the first failure) passing the updated state to each successive repetition.
|
493
518
|
*
|
494
|
-
* @tsplus pipeable fncts.control.
|
519
|
+
* @tsplus pipeable fncts.control.Pure repeatUntil
|
495
520
|
*/
|
496
521
|
function repeatUntil_1(p) {
|
497
522
|
return ma => {
|
498
|
-
return flatMap_1(a => p(a) ? succeedNow_1(a, fileName_1 + ":
|
523
|
+
return flatMap_1(a => p(a) ? succeedNow_1(a, fileName_1 + ":499:53") : repeatUntil_1(p)(ma))(ma);
|
499
524
|
};
|
500
525
|
}
|
501
526
|
/**
|
502
|
-
* @tsplus static fncts.control.
|
527
|
+
* @tsplus static fncts.control.PureOps succeed
|
503
528
|
*/
|
504
|
-
function
|
505
|
-
|
529
|
+
function succeed(effect, __tsplusTrace) {
|
530
|
+
const z = new _definition.PurePrimitive(1 /* PureTag.Succeed */);
|
531
|
+
z.i0 = effect;
|
532
|
+
return z;
|
506
533
|
}
|
507
534
|
/**
|
508
|
-
* @tsplus static fncts.control.
|
535
|
+
* @tsplus static fncts.control.PureOps succeedNow
|
509
536
|
*/
|
510
537
|
function succeedNow_1(a, __tsplusTrace) {
|
511
|
-
|
538
|
+
const z = new _definition.PurePrimitive(0 /* PureTag.SucceedNow */);
|
539
|
+
z.i0 = a;
|
540
|
+
return z;
|
512
541
|
}
|
513
542
|
/**
|
514
|
-
* @tsplus pipeable fncts.control.
|
543
|
+
* @tsplus pipeable fncts.control.Pure tap
|
515
544
|
*/
|
516
545
|
function tap(f) {
|
517
546
|
return ma => {
|
@@ -519,21 +548,23 @@ function tap(f) {
|
|
519
548
|
};
|
520
549
|
}
|
521
550
|
/**
|
522
|
-
* @tsplus static fncts.control.
|
551
|
+
* @tsplus static fncts.control.PureOps tell
|
523
552
|
*/
|
524
553
|
function tell(w) {
|
525
554
|
return tellAll_1(tsplus_module_7.single(w));
|
526
555
|
}
|
527
556
|
/**
|
528
|
-
* @tsplus static fncts.control.
|
557
|
+
* @tsplus static fncts.control.PureOps tellAll
|
529
558
|
*/
|
530
559
|
function tellAll_1(ws) {
|
531
|
-
|
560
|
+
const z = new _definition.PurePrimitive(9 /* PureTag.Tell */);
|
561
|
+
z.i0 = ws;
|
562
|
+
return z;
|
532
563
|
}
|
533
564
|
/**
|
534
565
|
* Like `map`, but also allows the state to be modified.
|
535
566
|
*
|
536
|
-
* @tsplus pipeable fncts.control.
|
567
|
+
* @tsplus pipeable fncts.control.Pure transform
|
537
568
|
*/
|
538
569
|
function transform_1(f) {
|
539
570
|
return ma => {
|
@@ -541,20 +572,20 @@ function transform_1(f) {
|
|
541
572
|
};
|
542
573
|
}
|
543
574
|
/**
|
544
|
-
* @tsplus static fncts.control.
|
575
|
+
* @tsplus static fncts.control.PureOps unit
|
545
576
|
*/
|
546
|
-
const unit = /*#__PURE__*/succeedNow_1(undefined, fileName_1 + ":
|
577
|
+
const unit = /*#__PURE__*/succeedNow_1(undefined, fileName_1 + ":566:85");
|
547
578
|
/**
|
548
579
|
* Constructs a computation from the specified update function.
|
549
580
|
*
|
550
|
-
* @tsplus static fncts.control.
|
581
|
+
* @tsplus static fncts.control.PureOps update
|
551
582
|
*/
|
552
583
|
exports.unit = unit;
|
553
584
|
function update_1(f) {
|
554
585
|
return modify_1(s => [undefined, f(s)]);
|
555
586
|
}
|
556
587
|
/**
|
557
|
-
* @tsplus pipeable fncts.control.
|
588
|
+
* @tsplus pipeable fncts.control.Pure write
|
558
589
|
*/
|
559
590
|
function write(w) {
|
560
591
|
return ma => {
|
@@ -562,7 +593,7 @@ function write(w) {
|
|
562
593
|
};
|
563
594
|
}
|
564
595
|
/**
|
565
|
-
* @tsplus pipeable fncts.control.
|
596
|
+
* @tsplus pipeable fncts.control.Pure writeAll
|
566
597
|
*/
|
567
598
|
function writeAll_1(log) {
|
568
599
|
return ma => {
|
@@ -570,7 +601,7 @@ function writeAll_1(log) {
|
|
570
601
|
};
|
571
602
|
}
|
572
603
|
/**
|
573
|
-
* @tsplus pipeable fncts.control.
|
604
|
+
* @tsplus pipeable fncts.control.Pure zip
|
574
605
|
*/
|
575
606
|
function zip(fb) {
|
576
607
|
return fa => {
|
@@ -578,7 +609,7 @@ function zip(fb) {
|
|
578
609
|
};
|
579
610
|
}
|
580
611
|
/**
|
581
|
-
* @tsplus pipeable fncts.control.
|
612
|
+
* @tsplus pipeable fncts.control.Pure zipFirst
|
582
613
|
*/
|
583
614
|
function zipFirst(fb) {
|
584
615
|
return fa => {
|
@@ -586,7 +617,7 @@ function zipFirst(fb) {
|
|
586
617
|
};
|
587
618
|
}
|
588
619
|
/**
|
589
|
-
* @tsplus pipeable fncts.control.
|
620
|
+
* @tsplus pipeable fncts.control.Pure zipSecond
|
590
621
|
*/
|
591
622
|
function zipSecond(fb) {
|
592
623
|
return fa => {
|
@@ -594,7 +625,7 @@ function zipSecond(fb) {
|
|
594
625
|
};
|
595
626
|
}
|
596
627
|
/**
|
597
|
-
* @tsplus pipeable fncts.control.
|
628
|
+
* @tsplus pipeable fncts.control.Pure zipWith
|
598
629
|
*/
|
599
630
|
function zipWith_1(fb, f) {
|
600
631
|
return fa => {
|