@fncts/base 0.0.29 → 0.0.30
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/_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
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
var _a, _b, _c;
|
|
2
|
+
import * as tsplus_module_1 from "@fncts/base/util/predicates";
|
|
3
|
+
export const PureVariance = /*#__PURE__*/Symbol.for("fncts.Pure.Variance");
|
|
4
|
+
export const PureTypeId = /*#__PURE__*/Symbol.for("fncts.Pure");
|
|
5
|
+
/**
|
|
6
|
+
* `Pure<W, S1, S2, R, E, A>` is a purely functional description of a synchronous computation
|
|
7
|
+
* that requires an environment `R` and an initial state `S1` and may either
|
|
8
|
+
* fail with an `E` or succeed with an updated state `S2` and an `A`. Because
|
|
9
|
+
* of its polymorphism `Z` can be used to model a variety of effects
|
|
10
|
+
* including context, state, failure, and logging.
|
|
11
|
+
*
|
|
12
|
+
* @tsplus type fncts.control.Pure
|
|
13
|
+
* @tsplus companion fncts.control.PureOps
|
|
14
|
+
*/
|
|
15
|
+
export class Pure {
|
|
16
|
+
constructor() {
|
|
17
|
+
this[_a] = PureTypeId;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
_a = PureTypeId;
|
|
21
|
+
/**
|
|
22
|
+
* @tsplus unify fncts.control.Pure
|
|
23
|
+
*/
|
|
24
|
+
export function unifyPure(_) {
|
|
25
|
+
return _;
|
|
26
|
+
}
|
|
27
|
+
export class PurePrimitive {
|
|
28
|
+
constructor(_tag) {
|
|
29
|
+
this._tag = _tag;
|
|
30
|
+
this[_b] = PureTypeId;
|
|
31
|
+
this.i0 = undefined;
|
|
32
|
+
this.i1 = undefined;
|
|
33
|
+
this.i2 = undefined;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
_b = PureTypeId;
|
|
37
|
+
/**
|
|
38
|
+
* @tsplus static fncts.control.PureOps isPure
|
|
39
|
+
*/
|
|
40
|
+
export function isPure(u) {
|
|
41
|
+
return tsplus_module_1.isObject(u) && PureTypeId in u;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* @tsplus static fncts.control.PureOps concrete
|
|
45
|
+
*/
|
|
46
|
+
export function concrete(_) {
|
|
47
|
+
//
|
|
48
|
+
}
|
|
49
|
+
export const PureErrorTypeId = /*#__PURE__*/Symbol.for("fncts.Pure.ZError");
|
|
50
|
+
export class PureError {
|
|
51
|
+
constructor(cause) {
|
|
52
|
+
this.cause = cause;
|
|
53
|
+
this[_c] = PureErrorTypeId;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
_c = PureErrorTypeId;
|
|
57
|
+
export function isPureError(u) {
|
|
58
|
+
return tsplus_module_1.isObject(u) && PureErrorTypeId in u;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=definition.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definition.mjs","names":["PureVariance","Symbol","for","PureTypeId","Pure","constructor","_a","unifyPure","_","PurePrimitive","_tag","_b","i0","undefined","i1","i2","isPure","u","tsplus_module_1","isObject","concrete","PureErrorTypeId","PureError","cause","_c","isPureError"],"sources":["../../../_src/control/Pure/definition.ts"],"sourcesContent":[null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"./api.mjs";
|
|
3
3
|
/**
|
|
4
|
-
* @tsplus static fncts.control.
|
|
4
|
+
* @tsplus static fncts.control.PureOps Applicative
|
|
5
5
|
* @tsplus implicit
|
|
6
6
|
*/
|
|
7
7
|
export const Applicative = {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instances.mjs","names":["map","succeedNow","zip","zipWith","Applicative","pure"],"sources":["../../../_src/control/Pure/instances.ts"],"sourcesContent":[null],"mappings":";AAGA,SAASA,GAAG,EAAEC,UAAU,EAAEC,GAAG,EAAEC,OAAO,QAAQ,WAAU;AACxD;;;;AAIA,OAAO,MAAMC,WAAW,GAAsC;EAC5DJ,GAAG;EACHE,GAAG;EACHC,OAAO;EACPE,IAAI,EAAEJ;CACN"}
|
|
@@ -1,35 +1,36 @@
|
|
|
1
|
-
const fileName_1 = "(@fncts/base) src/control/
|
|
1
|
+
const fileName_1 = "(@fncts/base) src/control/Pure/runtime.ts";
|
|
2
2
|
import * as tsplus_module_1 from "@fncts/base/internal/Stack";
|
|
3
3
|
import * as tsplus_module_2 from "@fncts/base/collection/immutable/Conc/api/empty";
|
|
4
|
-
import * as tsplus_module_3 from "@fncts/base/control/
|
|
4
|
+
import * as tsplus_module_3 from "@fncts/base/control/Pure/api";
|
|
5
5
|
import * as tsplus_module_4 from "@fncts/base/data/Environment/api";
|
|
6
6
|
import * as tsplus_module_5 from "@fncts/base/data/Cause/api";
|
|
7
7
|
import * as tsplus_module_6 from "@fncts/base/data/Exit/constructors";
|
|
8
|
-
import * as tsplus_module_7 from "@fncts/base/data/
|
|
8
|
+
import * as tsplus_module_7 from "@fncts/base/data/function/api";
|
|
9
|
+
import * as tsplus_module_8 from "@fncts/base/data/Exit/api";
|
|
9
10
|
export const unsafeRunAll = unsafeRunAll_1;
|
|
10
11
|
export const unsafeRun = unsafeRun_1;
|
|
11
12
|
export const unsafeRunResult = unsafeRunResult_1;
|
|
12
13
|
import { identity } from "../../data/function.mjs";
|
|
13
14
|
import { Stack } from "../../internal/Stack.mjs";
|
|
14
|
-
import { concrete,
|
|
15
|
+
import { concrete, isPureError, PurePrimitive } from "./definition.mjs";
|
|
15
16
|
class MatchFrame {
|
|
16
17
|
constructor(failure, apply) {
|
|
17
18
|
this.failure = failure;
|
|
18
19
|
this.apply = apply;
|
|
19
|
-
this.
|
|
20
|
+
this._tag = "MatchFrame";
|
|
20
21
|
}
|
|
21
22
|
}
|
|
22
23
|
class ApplyFrame {
|
|
23
24
|
constructor(apply) {
|
|
24
25
|
this.apply = apply;
|
|
25
|
-
this.
|
|
26
|
+
this._tag = "ApplyFrame";
|
|
26
27
|
}
|
|
27
28
|
}
|
|
28
29
|
/**
|
|
29
30
|
* Runs this computation with the specified initial state, returning either a
|
|
30
31
|
* failure or the updated state and the result
|
|
31
32
|
*
|
|
32
|
-
* @tsplus pipeable fncts.control.
|
|
33
|
+
* @tsplus pipeable fncts.control.Pure unsafeRunAll
|
|
33
34
|
*/
|
|
34
35
|
function unsafeRunAll_1(s) {
|
|
35
36
|
return ma => {
|
|
@@ -47,7 +48,7 @@ function unsafeRunAll_1(s) {
|
|
|
47
48
|
if (next == null) {
|
|
48
49
|
unwinding = false;
|
|
49
50
|
} else {
|
|
50
|
-
if (next.
|
|
51
|
+
if (next._tag === "MatchFrame") {
|
|
51
52
|
unwinding = false;
|
|
52
53
|
stack.push(new ApplyFrame(next.failure));
|
|
53
54
|
}
|
|
@@ -57,28 +58,28 @@ function unsafeRunAll_1(s) {
|
|
|
57
58
|
while (current != null) {
|
|
58
59
|
try {
|
|
59
60
|
while (current != null) {
|
|
60
|
-
const
|
|
61
|
-
concrete(
|
|
62
|
-
switch (
|
|
63
|
-
case
|
|
61
|
+
const currPure = current;
|
|
62
|
+
concrete(currPure);
|
|
63
|
+
switch (currPure._tag) {
|
|
64
|
+
case 5 /* PureTag.Chain */:
|
|
64
65
|
{
|
|
65
|
-
const nested =
|
|
66
|
-
const continuation =
|
|
66
|
+
const nested = currPure.i0;
|
|
67
|
+
const continuation = currPure.i1;
|
|
67
68
|
concrete(nested);
|
|
68
69
|
switch (nested._tag) {
|
|
69
|
-
case
|
|
70
|
+
case 0 /* PureTag.SucceedNow */:
|
|
70
71
|
{
|
|
71
|
-
current = continuation(nested.
|
|
72
|
+
current = continuation(nested.i0);
|
|
72
73
|
break;
|
|
73
74
|
}
|
|
74
|
-
case
|
|
75
|
+
case 1 /* PureTag.Succeed */:
|
|
75
76
|
{
|
|
76
|
-
current = continuation(nested.
|
|
77
|
+
current = continuation(nested.i0());
|
|
77
78
|
break;
|
|
78
79
|
}
|
|
79
|
-
case
|
|
80
|
+
case 4 /* PureTag.Modify */:
|
|
80
81
|
{
|
|
81
|
-
const updated = nested.
|
|
82
|
+
const updated = nested.i0(s0);
|
|
82
83
|
result = updated[0];
|
|
83
84
|
s0 = updated[1];
|
|
84
85
|
current = continuation(result);
|
|
@@ -93,9 +94,9 @@ function unsafeRunAll_1(s) {
|
|
|
93
94
|
}
|
|
94
95
|
break;
|
|
95
96
|
}
|
|
96
|
-
case
|
|
97
|
+
case 1 /* PureTag.Succeed */:
|
|
97
98
|
{
|
|
98
|
-
result =
|
|
99
|
+
result = currPure.i0();
|
|
99
100
|
const nextInstruction = stack.pop();
|
|
100
101
|
if (nextInstruction) {
|
|
101
102
|
current = nextInstruction.apply(result);
|
|
@@ -104,14 +105,14 @@ function unsafeRunAll_1(s) {
|
|
|
104
105
|
}
|
|
105
106
|
break;
|
|
106
107
|
}
|
|
107
|
-
case
|
|
108
|
+
case 2 /* PureTag.Defer */:
|
|
108
109
|
{
|
|
109
|
-
current =
|
|
110
|
+
current = currPure.i0();
|
|
110
111
|
break;
|
|
111
112
|
}
|
|
112
|
-
case
|
|
113
|
+
case 0 /* PureTag.SucceedNow */:
|
|
113
114
|
{
|
|
114
|
-
result =
|
|
115
|
+
result = currPure.i0;
|
|
115
116
|
const nextInstr = stack.pop();
|
|
116
117
|
if (nextInstr) {
|
|
117
118
|
current = nextInstr.apply(result);
|
|
@@ -120,48 +121,51 @@ function unsafeRunAll_1(s) {
|
|
|
120
121
|
}
|
|
121
122
|
break;
|
|
122
123
|
}
|
|
123
|
-
case
|
|
124
|
+
case 3 /* PureTag.Fail */:
|
|
124
125
|
{
|
|
125
126
|
unsafeUnwindStack();
|
|
126
127
|
const nextInst = stack.pop();
|
|
127
128
|
if (nextInst) {
|
|
128
|
-
current = nextInst.apply(
|
|
129
|
+
current = nextInst.apply(currPure.i0);
|
|
129
130
|
} else {
|
|
130
131
|
failed = true;
|
|
131
|
-
result =
|
|
132
|
+
result = currPure.i0;
|
|
132
133
|
current = undefined;
|
|
133
134
|
}
|
|
134
135
|
break;
|
|
135
136
|
}
|
|
136
|
-
case
|
|
137
|
+
case 6 /* PureTag.Match */:
|
|
137
138
|
{
|
|
138
|
-
current =
|
|
139
|
+
current = currPure.i0;
|
|
139
140
|
const state = s0;
|
|
140
141
|
stack.push(new MatchFrame(cause => {
|
|
141
|
-
const m = tsplus_module_3.flatMap(() =>
|
|
142
|
+
const m = tsplus_module_3.flatMap(() => currPure.i1(log, cause))(tsplus_module_3.put(state));
|
|
142
143
|
log = tsplus_module_2.empty();
|
|
143
144
|
return m;
|
|
144
145
|
}, a => {
|
|
145
|
-
const m =
|
|
146
|
+
const m = currPure.i2(log, a);
|
|
146
147
|
log = tsplus_module_2.empty();
|
|
147
148
|
return m;
|
|
148
149
|
}));
|
|
149
150
|
break;
|
|
150
151
|
}
|
|
151
|
-
case
|
|
152
|
+
case 7 /* PureTag.Access */:
|
|
152
153
|
{
|
|
153
|
-
current =
|
|
154
|
+
current = currPure.i0(environment.peek() ?? tsplus_module_4.make());
|
|
154
155
|
break;
|
|
155
156
|
}
|
|
156
|
-
case
|
|
157
|
+
case 8 /* PureTag.Provide */:
|
|
157
158
|
{
|
|
158
|
-
environment.push(
|
|
159
|
-
current =
|
|
159
|
+
environment.push(currPure.i1);
|
|
160
|
+
current = new PurePrimitive(6 /* PureTag.Match */);
|
|
161
|
+
current.i0 = currPure;
|
|
162
|
+
current.i1 = e => tsplus_module_3.flatMap(() => tsplus_module_3.failNow(e, fileName_1 + ":146:110"))(tsplus_module_3.succeedNow(environment.pop(), fileName_1 + ":146:64"));
|
|
163
|
+
current.i2 = a => tsplus_module_3.flatMap(() => tsplus_module_3.succeedNow(a, fileName_1 + ":147:113"))(tsplus_module_3.succeedNow(environment.pop(), fileName_1 + ":147:64"));
|
|
160
164
|
break;
|
|
161
165
|
}
|
|
162
|
-
case
|
|
166
|
+
case 4 /* PureTag.Modify */:
|
|
163
167
|
{
|
|
164
|
-
const updated =
|
|
168
|
+
const updated = currPure.i0(s0);
|
|
165
169
|
s0 = updated[1];
|
|
166
170
|
result = updated[0];
|
|
167
171
|
const nextInst = stack.pop();
|
|
@@ -172,9 +176,9 @@ function unsafeRunAll_1(s) {
|
|
|
172
176
|
}
|
|
173
177
|
break;
|
|
174
178
|
}
|
|
175
|
-
case
|
|
179
|
+
case 9 /* PureTag.Tell */:
|
|
176
180
|
{
|
|
177
|
-
log =
|
|
181
|
+
log = currPure.i0;
|
|
178
182
|
const nextInst = stack.pop();
|
|
179
183
|
if (nextInst) {
|
|
180
184
|
current = nextInst.apply(result);
|
|
@@ -183,22 +187,22 @@ function unsafeRunAll_1(s) {
|
|
|
183
187
|
}
|
|
184
188
|
break;
|
|
185
189
|
}
|
|
186
|
-
case
|
|
190
|
+
case 11 /* PureTag.MapLog */:
|
|
187
191
|
{
|
|
188
|
-
current =
|
|
192
|
+
current = currPure.i0;
|
|
189
193
|
stack.push(new MatchFrame(cause => {
|
|
190
|
-
log =
|
|
191
|
-
return tsplus_module_3.failCauseNow(cause, fileName_1 + ":178:
|
|
194
|
+
log = currPure.i1(log);
|
|
195
|
+
return tsplus_module_3.failCauseNow(cause, fileName_1 + ":178:45");
|
|
192
196
|
}, a => {
|
|
193
|
-
log =
|
|
194
|
-
return tsplus_module_3.succeedNow(a, fileName_1 + ":182:
|
|
197
|
+
log = currPure.i1(log);
|
|
198
|
+
return tsplus_module_3.succeedNow(a, fileName_1 + ":182:43");
|
|
195
199
|
}));
|
|
196
200
|
}
|
|
197
201
|
}
|
|
198
202
|
}
|
|
199
203
|
} catch (e) {
|
|
200
|
-
if (
|
|
201
|
-
current = tsplus_module_3.failCauseNow(e.cause, fileName_1 + ":191:
|
|
204
|
+
if (isPureError(e)) {
|
|
205
|
+
current = tsplus_module_3.failCauseNow(e.cause, fileName_1 + ":191:38");
|
|
202
206
|
} else {
|
|
203
207
|
failed = true;
|
|
204
208
|
result = tsplus_module_5.halt(e);
|
|
@@ -215,20 +219,19 @@ function unsafeRunAll_1(s) {
|
|
|
215
219
|
* Runs this computation with the specified initial state, returning both
|
|
216
220
|
* the updated state and the result.
|
|
217
221
|
*
|
|
218
|
-
* @tsplus pipeable fncts.control.
|
|
222
|
+
* @tsplus pipeable fncts.control.Pure unsafeRun
|
|
219
223
|
*/
|
|
220
224
|
function unsafeRun_1(s) {
|
|
221
225
|
return ma => {
|
|
222
|
-
return
|
|
223
|
-
|
|
224
|
-
throw new Error();
|
|
226
|
+
return tsplus_module_8.match(cause => {
|
|
227
|
+
throw tsplus_module_5.squashWith(tsplus_module_7.identity)(cause);
|
|
225
228
|
}, identity)(unsafeRunAll_1(s)(ma)[1]);
|
|
226
229
|
};
|
|
227
230
|
}
|
|
228
231
|
/**
|
|
229
232
|
* Runs this computation, returning the result.
|
|
230
233
|
*
|
|
231
|
-
* @tsplus getter fncts.control.
|
|
234
|
+
* @tsplus getter fncts.control.Pure unsafeRunResult
|
|
232
235
|
*/
|
|
233
236
|
function unsafeRunResult_1(ma) {
|
|
234
237
|
return unsafeRun_1({})(ma)[1];
|
|
@@ -236,7 +239,7 @@ function unsafeRunResult_1(ma) {
|
|
|
236
239
|
/**
|
|
237
240
|
* Runs this computation with the given environment, returning the result.
|
|
238
241
|
*
|
|
239
|
-
* @tsplus pipeable fncts.control.
|
|
242
|
+
* @tsplus pipeable fncts.control.Pure unsafeRunReader
|
|
240
243
|
*/
|
|
241
244
|
export function unsafeRunReader(r) {
|
|
242
245
|
return ma => {
|
|
@@ -247,7 +250,7 @@ export function unsafeRunReader(r) {
|
|
|
247
250
|
* Runs this computation with the specified initial state, returning the
|
|
248
251
|
* updated state and discarding the result.
|
|
249
252
|
*
|
|
250
|
-
* @tsplus pipeable fncts.control.
|
|
253
|
+
* @tsplus pipeable fncts.control.Pure unsafeRunState
|
|
251
254
|
*/
|
|
252
255
|
export function unsafeRunState(s) {
|
|
253
256
|
return ma => {
|
|
@@ -258,33 +261,31 @@ export function unsafeRunState(s) {
|
|
|
258
261
|
* Runs this computation with the specified initial state, returning the
|
|
259
262
|
* result and discarding the updated state.
|
|
260
263
|
*
|
|
261
|
-
* @tsplus pipeable fncts.control.
|
|
264
|
+
* @tsplus pipeable fncts.control.Pure unsafeRunStateResult
|
|
262
265
|
*/
|
|
263
266
|
export function unsafeRunStateResult(s) {
|
|
264
267
|
return ma => {
|
|
265
|
-
return
|
|
266
|
-
|
|
267
|
-
throw new Error();
|
|
268
|
+
return tsplus_module_8.match(cause => {
|
|
269
|
+
throw tsplus_module_5.squashWith(tsplus_module_7.identity)(cause);
|
|
268
270
|
}, ([_, a]) => a)(unsafeRunAll_1(s)(ma)[1]);
|
|
269
271
|
};
|
|
270
272
|
}
|
|
271
273
|
/**
|
|
272
274
|
* Runs this computation returning either the result or error
|
|
273
275
|
*
|
|
274
|
-
* @tsplus getter fncts.control.
|
|
276
|
+
* @tsplus getter fncts.control.Pure unsafeRunExit
|
|
275
277
|
*/
|
|
276
278
|
export function unsafeRunExit(ma) {
|
|
277
|
-
return
|
|
279
|
+
return tsplus_module_8.map(([_, a]) => a)(unsafeRunAll_1({})(ma)[1]);
|
|
278
280
|
}
|
|
279
281
|
/**
|
|
280
282
|
*
|
|
281
|
-
* @tsplus getter fncts.control.
|
|
283
|
+
* @tsplus getter fncts.control.Pure unsafeRunWriter
|
|
282
284
|
*/
|
|
283
285
|
export function unsafeRunWriter(ma) {
|
|
284
286
|
const [w, exit] = unsafeRunAll_1({})(ma);
|
|
285
|
-
return
|
|
286
|
-
|
|
287
|
-
throw new Error();
|
|
287
|
+
return tsplus_module_8.match(cause => {
|
|
288
|
+
throw tsplus_module_5.squashWith(tsplus_module_7.identity)(cause);
|
|
288
289
|
}, ([_, a]) => [w, a])(exit);
|
|
289
290
|
}
|
|
290
291
|
//# sourceMappingURL=runtime.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.mjs","names":["unsafeRunAll","unsafeRunAll_1","unsafeRun","unsafeRun_1","unsafeRunResult","unsafeRunResult_1","identity","Stack","concrete","isPureError","PurePrimitive","MatchFrame","constructor","failure","apply","_tag","ApplyFrame","s","ma","stack","tsplus_module_1","makeStack","s0","result","environment","failed","current","log","tsplus_module_2","empty","unsafeUnwindStack","unwinding","next","pop","push","currPure","nested","i0","continuation","i1","updated","nextInstruction","undefined","nextInstr","nextInst","state","cause","m","tsplus_module_3","flatMap","put","a","i2","peek","tsplus_module_4","make","e","failNow","fileName_1","succeedNow","failCauseNow","tsplus_module_5","halt","tsplus_module_6","failCause","succeed","tsplus_module_8","match","squashWith","tsplus_module_7","unsafeRunReader","r","provideEnvironment","unsafeRunState","unsafeRunStateResult","_","unsafeRunExit","map","unsafeRunWriter","w","exit"],"sources":["../../../_src/control/Pure/runtime.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;aAyBgBA,YAAY,GAAAC,cAAA;aAyLZC,SAAS,GAAAC,WAAA;aAaTC,eAAe,GAAAC,iBAAA;AA/N/B,SAASC,QAAQ,QAAQ,yBAAwB;AACjD,SAASC,KAAK,QAAQ,0BAAyB;AAC/C,SAASC,QAAQ,EAAEC,WAAW,EAAEC,aAAa,QAAiB,kBAAiB;AAE/E,MAAMC,UAAU;EAEdC,YACWC,OAAuD,EACvDC,KAAqD;IADrD,KAAAD,OAAO,GAAPA,OAAO;IACP,KAAAC,KAAK,GAALA,KAAK;IAHP,KAAAC,IAAI,GAAG,YAAY;EAIzB;;AAGL,MAAMC,UAA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,CAAC,EAJb6B,IAAI,CAKV;AACH"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Pure.mjs","names":[],"sources":["../../_src/control/Pure.ts"],"sourcesContent":[null],"mappings":"AAAA;AACA,cAAc,gBAAe;AAC7B,cAAc,uBAAsB;AACpC,cAAc,sBAAqB;AACnC,cAAc,oBAAmB"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
const fileName_1 = "(@fncts/base) src/data/Showable/show.ts";
|
|
2
2
|
import * as tsplus_module_1 from "@fncts/base/data/CaseClass";
|
|
3
3
|
import * as tsplus_module_2 from "@fncts/base/collection/immutable/HashMap/api";
|
|
4
|
-
import * as tsplus_module_3 from "@fncts/base/control/
|
|
5
|
-
import * as tsplus_module_4 from "@fncts/base/control/
|
|
4
|
+
import * as tsplus_module_3 from "@fncts/base/control/Pure/runtime";
|
|
5
|
+
import * as tsplus_module_4 from "@fncts/base/control/Pure/api";
|
|
6
6
|
import * as tsplus_module_5 from "@fncts/base/data/Maybe/destructors";
|
|
7
7
|
import * as tsplus_module_6 from "@fncts/base/data/Showable/definition";
|
|
8
8
|
import * as tsplus_module_7 from "@fncts/base/collection/immutable/Conc/api/empty";
|
|
9
9
|
import * as tsplus_module_8 from "@fncts/base/collection/immutable/Conc/definition";
|
|
10
10
|
import * as tsplus_module_9 from "@fncts/base/collection/immutable/Conc/api";
|
|
11
|
-
import * as tsplus_module_10 from "@fncts/base/control/
|
|
12
|
-
import * as tsplus_module_11 from "@fncts/base/control/
|
|
11
|
+
import * as tsplus_module_10 from "@fncts/base/control/Pure/definition";
|
|
12
|
+
import * as tsplus_module_11 from "@fncts/base/control/Pure/instances";
|
|
13
13
|
import * as tsplus_module_12 from "@fncts/base/collection/immutable/Conc/constructors";
|
|
14
14
|
import * as tsplus_module_13 from "@fncts/base/collection/Iterable/api/traverseConc";
|
|
15
15
|
import { tuple } from "@fncts/base/data/function";
|
|
@@ -56,21 +56,21 @@ export function showWithOptions(value, options) {
|
|
|
56
56
|
return tsplus_module_3.unsafeRunStateResult(getShowContext(options))(_show(value));
|
|
57
57
|
}
|
|
58
58
|
export function _show(value) {
|
|
59
|
-
return tsplus_module_4.
|
|
59
|
+
return tsplus_module_4.getsPure(context => {
|
|
60
60
|
if (value === undefined) {
|
|
61
|
-
return tsplus_module_4.succeedNow(context.stylize("undefined", "undefined"), fileName_1 + ":139:
|
|
61
|
+
return tsplus_module_4.succeedNow(context.stylize("undefined", "undefined"), fileName_1 + ":139:29");
|
|
62
62
|
}
|
|
63
63
|
if (value === null) {
|
|
64
|
-
return tsplus_module_4.succeedNow(context.stylize("null", "null"), fileName_1 + ":142:
|
|
64
|
+
return tsplus_module_4.succeedNow(context.stylize("null", "null"), fileName_1 + ":142:29");
|
|
65
65
|
}
|
|
66
66
|
if (!isObject(value) && !isFunction(value)) {
|
|
67
|
-
return tsplus_module_4.succeedNow(_showPrimitive(context, value), fileName_1 + ":145:
|
|
67
|
+
return tsplus_module_4.succeedNow(_showPrimitive(context, value), fileName_1 + ":145:29");
|
|
68
68
|
}
|
|
69
69
|
return showValue(value);
|
|
70
70
|
});
|
|
71
71
|
}
|
|
72
72
|
function showValue(value) {
|
|
73
|
-
return tsplus_module_4.
|
|
73
|
+
return tsplus_module_4.getsPure(context => {
|
|
74
74
|
if (context.seen.findIndex(v => v === value) !== -1) {
|
|
75
75
|
return tsplus_module_4.map(index => context.stylize(`[Circular *${index}]`, "special"))(tsplus_module_4.modify(context => tsplus_module_5.match(() => [context.circular.size + 1, context.copy({
|
|
76
76
|
circular: tsplus_module_2.set(value, context.circular.size + 1)(context.circular)
|
|
@@ -110,7 +110,7 @@ function getInspectionInfo(context, value, typedArray) {
|
|
|
110
110
|
let keys = [];
|
|
111
111
|
let tag = value[Symbol.toStringTag];
|
|
112
112
|
let base = "";
|
|
113
|
-
let formatter = _ => tsplus_module_4.succeedNow(tsplus_module_7.empty(), fileName_1 + ":227:
|
|
113
|
+
let formatter = _ => tsplus_module_4.succeedNow(tsplus_module_7.empty(), fileName_1 + ":227:47");
|
|
114
114
|
let braces = ["", ""];
|
|
115
115
|
let noIterator = true;
|
|
116
116
|
let extrasType = OBJECT_TYPE;
|
|
@@ -219,7 +219,7 @@ function getInspectionInfo(context, value, typedArray) {
|
|
|
219
219
|
return inspectionEarlyReturn(`${getPrefix(constructor, tag, "WeakSet")}{}`);
|
|
220
220
|
} else if (isWeakMap(value)) {
|
|
221
221
|
return inspectionEarlyReturn(`${getPrefix(constructor, tag, "WeakMap")}{}`);
|
|
222
|
-
} else if (tsplus_module_10.
|
|
222
|
+
} else if (tsplus_module_10.isPure(value)) {
|
|
223
223
|
return constructor !== null ? inspectionEarlyReturn(`Z (${constructor}) {}`) : inspectionEarlyReturn("Z {}");
|
|
224
224
|
} else {
|
|
225
225
|
if (keys.length === 0) {
|
|
@@ -251,13 +251,13 @@ function showRaw(value, typedArray) {
|
|
|
251
251
|
if (info.constructor !== null) {
|
|
252
252
|
constructorName = `[${constructorName}]`;
|
|
253
253
|
}
|
|
254
|
-
return tsplus_module_4.zipRight(tsplus_module_4.succeedNow(context.stylize(constructorName, "special"), fileName_1 + ":384:
|
|
254
|
+
return tsplus_module_4.zipRight(tsplus_module_4.succeedNow(context.stylize(constructorName, "special"), fileName_1 + ":384:35"))(tsplus_module_4.update(context => context.copy({
|
|
255
255
|
recurseTimes: context.recurseTimes - 1,
|
|
256
256
|
currentDepth: context.currentDepth - 1
|
|
257
257
|
})));
|
|
258
258
|
}
|
|
259
259
|
if (info._tag === "InspectionEarlyReturn") {
|
|
260
|
-
return tsplus_module_4.succeedNow(info.shown, fileName_1 + ":387:
|
|
260
|
+
return tsplus_module_4.succeedNow(info.shown, fileName_1 + ":387:31");
|
|
261
261
|
} else {
|
|
262
262
|
return tsplus_module_4.zipRight(tsplus_module_4.defer(() => {
|
|
263
263
|
let keys;
|
|
@@ -268,7 +268,7 @@ function showRaw(value, typedArray) {
|
|
|
268
268
|
switch (info._tag) {
|
|
269
269
|
case "InspectionInfo":
|
|
270
270
|
{
|
|
271
|
-
base = tsplus_module_4.succeedNow(info.base, fileName_1 + ":401:
|
|
271
|
+
base = tsplus_module_4.succeedNow(info.base, fileName_1 + ":401:39");
|
|
272
272
|
keys = tsplus_module_4.crossWith(tsplus_module_9._traverse(info.protoProps)(tsplus_module_11.Applicative)(key => showProperty(value, key, PROTO_TYPE)), (k1, k2) => tsplus_module_9.concat(k2)(k1))(tsplus_module_9._traverse(tsplus_module_12.from(info.keys))(tsplus_module_11.Applicative)(key => showProperty(value, key, info.extrasType)));
|
|
273
273
|
indices = info.formatter(value);
|
|
274
274
|
braces = info.braces;
|
|
@@ -279,11 +279,11 @@ function showRaw(value, typedArray) {
|
|
|
279
279
|
{
|
|
280
280
|
const externalComputation = info.computation;
|
|
281
281
|
if (externalComputation._tag === "Primitive") {
|
|
282
|
-
return tsplus_module_4.
|
|
282
|
+
return tsplus_module_4.getsPure(context => tsplus_module_4.map(str => str.replace(/\n/g, `\n${" ".repeat(context.indentationLevel)}`))(externalComputation.computation));
|
|
283
283
|
} else {
|
|
284
|
-
base = externalComputation.base || tsplus_module_4.succeedNow("", fileName_1 + ":422:
|
|
285
|
-
keys = externalComputation.keys || tsplus_module_4.succeedNow(tsplus_module_7.empty(), fileName_1 + ":423:
|
|
286
|
-
indices = externalComputation.indices || tsplus_module_4.succeedNow(tsplus_module_7.empty(), fileName_1 + ":424:
|
|
284
|
+
base = externalComputation.base || tsplus_module_4.succeedNow("", fileName_1 + ":422:75");
|
|
285
|
+
keys = externalComputation.keys || tsplus_module_4.succeedNow(tsplus_module_7.empty(), fileName_1 + ":423:75");
|
|
286
|
+
indices = externalComputation.indices || tsplus_module_4.succeedNow(tsplus_module_7.empty(), fileName_1 + ":424:78");
|
|
287
287
|
braces = externalComputation.braces || ["", ""];
|
|
288
288
|
extrasType = externalComputation.extrasType || OBJECT_TYPE;
|
|
289
289
|
}
|
|
@@ -291,7 +291,7 @@ function showRaw(value, typedArray) {
|
|
|
291
291
|
}
|
|
292
292
|
}
|
|
293
293
|
const output = tsplus_module_4.crossWith(keys, (idxs, ks) => tsplus_module_9.concat(ks)(idxs))(indices);
|
|
294
|
-
const baseWithRef = tsplus_module_4.
|
|
294
|
+
const baseWithRef = tsplus_module_4.getsPure(context => tsplus_module_5.match(() => base, index => tsplus_module_4.map(base => {
|
|
295
295
|
const ref = context.stylize(`<ref *${index}>`, "special");
|
|
296
296
|
return base === "" ? ref : `${ref} ${base}`;
|
|
297
297
|
})(base))(tsplus_module_2.get(value)(context.circular)));
|
|
@@ -324,7 +324,7 @@ function showRaw(value, typedArray) {
|
|
|
324
324
|
recurseTimes: context.recurseTimes + 1,
|
|
325
325
|
currentDepth: _.recurseTimes + 1
|
|
326
326
|
}))))));
|
|
327
|
-
}, fileName_1 + ":393:
|
|
327
|
+
}, fileName_1 + ":393:21"))(tsplus_module_4.update(context => {
|
|
328
328
|
context.seen.push(value);
|
|
329
329
|
return context;
|
|
330
330
|
}));
|
|
@@ -387,7 +387,7 @@ function showMap(value) {
|
|
|
387
387
|
}))));
|
|
388
388
|
}
|
|
389
389
|
function showTypedArray(value) {
|
|
390
|
-
return tsplus_module_4.
|
|
390
|
+
return tsplus_module_4.getsPure(context => tsplus_module_4.defer(() => {
|
|
391
391
|
const maxLength = Math.min(Math.max(0, context.maxArrayLength), value.length);
|
|
392
392
|
const remaining = value.length - maxLength;
|
|
393
393
|
let output = tsplus_module_7.empty();
|
|
@@ -401,13 +401,13 @@ function showTypedArray(value) {
|
|
|
401
401
|
if (context.showHidden) {
|
|
402
402
|
return tsplus_module_4.zipLeft(tsplus_module_4.update(_ => _.copy({
|
|
403
403
|
indentationLevel: _.indentationLevel - 2
|
|
404
|
-
})))(tsplus_module_4.zipRight(tsplus_module_4.flatMap(output => tsplus_module_4.map(shownKeys => tsplus_module_9.concat(shownKeys)(output))(tsplus_module_9._traverse(tsplus_module_12.make("BYTES_PER_ELEMENT", "length", "byteLength", "byteOffset", "buffer"))(tsplus_module_11.Applicative)(key => tsplus_module_4.map(shown => `[${key}]: ${shown}`)(_show(value[key])))))(tsplus_module_4.succeedNow(output, fileName_1 + ":572:
|
|
404
|
+
})))(tsplus_module_4.zipRight(tsplus_module_4.flatMap(output => tsplus_module_4.map(shownKeys => tsplus_module_9.concat(shownKeys)(output))(tsplus_module_9._traverse(tsplus_module_12.make("BYTES_PER_ELEMENT", "length", "byteLength", "byteOffset", "buffer"))(tsplus_module_11.Applicative)(key => tsplus_module_4.map(shown => `[${key}]: ${shown}`)(_show(value[key])))))(tsplus_module_4.succeedNow(output, fileName_1 + ":572:28")))(tsplus_module_4.update(_ => _.copy({
|
|
405
405
|
indentationLevel: _.indentationLevel + 2
|
|
406
406
|
}))));
|
|
407
407
|
} else {
|
|
408
|
-
return tsplus_module_4.succeedNow(output, fileName_1 + ":582:
|
|
408
|
+
return tsplus_module_4.succeedNow(output, fileName_1 + ":582:31");
|
|
409
409
|
}
|
|
410
|
-
}, fileName_1 + ":557:
|
|
410
|
+
}, fileName_1 + ":557:15"));
|
|
411
411
|
}
|
|
412
412
|
function showArrayBuffer(value) {
|
|
413
413
|
return tsplus_module_4.gets(context => {
|
|
@@ -427,7 +427,7 @@ function showArrayBuffer(value) {
|
|
|
427
427
|
}
|
|
428
428
|
const maxEntries = 2 ** 32 - 2;
|
|
429
429
|
function showSpecialArray(value, maxLength, currentComputation, currentIndex, currentLength) {
|
|
430
|
-
return tsplus_module_4.
|
|
430
|
+
return tsplus_module_4.getsPure(context => {
|
|
431
431
|
const keys = Object.keys(value);
|
|
432
432
|
let index = currentIndex;
|
|
433
433
|
let i = currentIndex;
|
|
@@ -469,7 +469,7 @@ function showSpecialArray(value, maxLength, currentComputation, currentIndex, cu
|
|
|
469
469
|
}
|
|
470
470
|
function showArray(value) {
|
|
471
471
|
return tsplus_module_4.flatMap(([remaining, chunk]) => {
|
|
472
|
-
let computation = tsplus_module_4.succeedNow(tsplus_module_7.empty(), fileName_1 + ":668:
|
|
472
|
+
let computation = tsplus_module_4.succeedNow(tsplus_module_7.empty(), fileName_1 + ":668:38");
|
|
473
473
|
for (let i = 0; i < chunk.length; i++) {
|
|
474
474
|
if (!Object.prototype.hasOwnProperty.call(value, i)) {
|
|
475
475
|
return showSpecialArray(value, chunk.length, computation, i, i);
|
|
@@ -499,7 +499,7 @@ function showChunk(value) {
|
|
|
499
499
|
}));
|
|
500
500
|
}
|
|
501
501
|
export function showProperty(value, key, type, desc) {
|
|
502
|
-
return tsplus_module_4.
|
|
502
|
+
return tsplus_module_4.getsPure(context => tsplus_module_4.map(([descriptor, extra, shown]) => {
|
|
503
503
|
if (type === ARRAY_TYPE) {
|
|
504
504
|
return shown;
|
|
505
505
|
}
|
|
@@ -534,13 +534,13 @@ export function showProperty(value, key, type, desc) {
|
|
|
534
534
|
indentationLevel: _.indentationLevel + diff
|
|
535
535
|
})))));
|
|
536
536
|
} else if (isDefined(descriptor.get)) {
|
|
537
|
-
return tsplus_module_4.succeedNow(tuple(descriptor, " ", `[${descriptor.set ? "Getter/Settter" : "Getter"}]`), fileName_1 + ":
|
|
537
|
+
return tsplus_module_4.succeedNow(tuple(descriptor, " ", `[${descriptor.set ? "Getter/Settter" : "Getter"}]`), fileName_1 + ":724:31");
|
|
538
538
|
} else if (isDefined(descriptor.set)) {
|
|
539
|
-
return tsplus_module_4.succeedNow(tuple(descriptor, " ", "Setter"), fileName_1 + ":
|
|
539
|
+
return tsplus_module_4.succeedNow(tuple(descriptor, " ", "Setter"), fileName_1 + ":726:31");
|
|
540
540
|
} else {
|
|
541
|
-
return tsplus_module_4.succeedNow(tuple(descriptor, " ", "undefined"), fileName_1 + ":
|
|
541
|
+
return tsplus_module_4.succeedNow(tuple(descriptor, " ", "undefined"), fileName_1 + ":728:31");
|
|
542
542
|
}
|
|
543
|
-
}, fileName_1 + ":703:
|
|
543
|
+
}, fileName_1 + ":703:15")));
|
|
544
544
|
}
|
|
545
545
|
/**
|
|
546
546
|
* Groups the formatted elements of an array-like structure into chunks limited by the
|