@magnusopera/fscript 0.80.1 → 0.81.0

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.
@@ -29,35 +29,135 @@ function escapeStringLiteral(value) {
29
29
  }
30
30
 
31
31
  export function valueToString(v) {
32
+ let matchResult, i, f, b, s, xs, xs_1, fields, fields_1, v_3, caseName_1, caseName_2, v_4, t, argName, body, caseName_3, args_1, ext;
32
33
  switch (v.tag) {
34
+ case 1: {
35
+ matchResult = 1;
36
+ i = v.fields[0];
37
+ break;
38
+ }
39
+ case 2: {
40
+ matchResult = 2;
41
+ f = v.fields[0];
42
+ break;
43
+ }
44
+ case 3: {
45
+ matchResult = 3;
46
+ b = v.fields[0];
47
+ break;
48
+ }
49
+ case 4: {
50
+ matchResult = 4;
51
+ s = v.fields[0];
52
+ break;
53
+ }
54
+ case 5: {
55
+ matchResult = 5;
56
+ xs = v.fields[0];
57
+ break;
58
+ }
59
+ case 6: {
60
+ matchResult = 6;
61
+ xs_1 = v.fields[0];
62
+ break;
63
+ }
64
+ case 7: {
65
+ matchResult = 7;
66
+ fields = v.fields[0];
67
+ break;
68
+ }
69
+ case 16: {
70
+ matchResult = 7;
71
+ fields = v.fields[0].Fields;
72
+ break;
73
+ }
74
+ case 8: {
75
+ matchResult = 8;
76
+ fields_1 = v.fields[0];
77
+ break;
78
+ }
79
+ case 9: {
80
+ if (v.fields[0] != null) {
81
+ matchResult = 10;
82
+ v_3 = v.fields[0];
83
+ }
84
+ else {
85
+ matchResult = 9;
86
+ }
87
+ break;
88
+ }
89
+ case 10: {
90
+ if (v.fields[2] != null) {
91
+ matchResult = 12;
92
+ caseName_2 = v.fields[1];
93
+ v_4 = v.fields[2];
94
+ }
95
+ else {
96
+ matchResult = 11;
97
+ caseName_1 = v.fields[1];
98
+ }
99
+ break;
100
+ }
101
+ case 12: {
102
+ matchResult = 13;
103
+ t = v.fields[0];
104
+ break;
105
+ }
106
+ case 13: {
107
+ matchResult = 14;
108
+ break;
109
+ }
110
+ case 14: {
111
+ matchResult = 15;
112
+ argName = v.fields[0];
113
+ body = v.fields[1];
114
+ break;
115
+ }
116
+ case 11: {
117
+ matchResult = 16;
118
+ caseName_3 = v.fields[1];
119
+ break;
120
+ }
121
+ case 15: {
122
+ matchResult = 17;
123
+ args_1 = v.fields[1];
124
+ ext = v.fields[0];
125
+ break;
126
+ }
127
+ default:
128
+ matchResult = 0;
129
+ }
130
+ switch (matchResult) {
131
+ case 0:
132
+ return "()";
33
133
  case 1:
34
- return int64ToString(v.fields[0]);
134
+ return int64ToString(i);
35
135
  case 2:
36
- return v.fields[0].toString();
136
+ return f.toString();
37
137
  case 3:
38
- if (v.fields[0]) {
138
+ if (b) {
39
139
  return "true";
40
140
  }
41
141
  else {
42
142
  return "false";
43
143
  }
44
144
  case 4: {
45
- const arg = escapeStringLiteral(v.fields[0]);
145
+ const arg = escapeStringLiteral(s);
46
146
  return toText(printf("\"%s\""))(arg);
47
147
  }
48
148
  case 5: {
49
- const arg_1 = join(";", map(valueToString, v.fields[0]));
149
+ const arg_1 = join(";", map(valueToString, xs));
50
150
  return toText(printf("[%s]"))(arg_1);
51
151
  }
52
152
  case 6: {
53
- const arg_2 = join(", ", map(valueToString, v.fields[0]));
153
+ const arg_2 = join(", ", map(valueToString, xs_1));
54
154
  return toText(printf("(%s)"))(arg_2);
55
155
  }
56
156
  case 7: {
57
157
  const arg_5 = join("; ", map((tupledArg) => {
58
158
  const arg_4 = valueToString(tupledArg[1]);
59
159
  return toText(printf("%s = %s"))(tupledArg[0])(arg_4);
60
- }, toList(v.fields[0])));
160
+ }, toList(fields)));
61
161
  return toText(printf("{ %s }"))(arg_5);
62
162
  }
63
163
  case 8: {
@@ -67,49 +167,41 @@ export function valueToString(v) {
67
167
  arg_6 = ((key.tag === 1) ? int64ToString(key.fields[0]) : ((key.tag === 2) ? (key.fields[0] ? "true" : "false") : ((key.tag === 3) ? concat(key.fields[0], ".", key.fields[1]) : concat("\"", escapeStringLiteral(key.fields[0]), "\""))));
68
168
  const arg_7 = valueToString(tupledArg_1[1]);
69
169
  return toText(printf("%s => %s"))(arg_6)(arg_7);
70
- }, toList(v.fields[0])));
170
+ }, toList(fields_1)));
71
171
  return toText(printf("map { %s }"))(arg_8);
72
172
  }
73
173
  case 9:
74
- if (v.fields[0] != null) {
75
- const v_3 = v.fields[0];
76
- const arg_9 = valueToString(v_3);
77
- return toText(printf("Some %s"))(arg_9);
78
- }
79
- else {
80
- return "None";
81
- }
82
- case 10:
83
- if (v.fields[2] != null) {
84
- const v_4 = v.fields[2];
85
- const arg_11 = valueToString(v_4);
86
- return toText(printf("%s %s"))(v.fields[1])(arg_11);
87
- }
88
- else {
89
- return v.fields[1];
90
- }
174
+ return "None";
175
+ case 10: {
176
+ const arg_9 = valueToString(v_3);
177
+ return toText(printf("Some %s"))(arg_9);
178
+ }
179
+ case 11:
180
+ return caseName_1;
91
181
  case 12: {
92
- const arg_12 = Types_typeToString(v.fields[0]);
182
+ const arg_11 = valueToString(v_4);
183
+ return toText(printf("%s %s"))(caseName_2)(arg_11);
184
+ }
185
+ case 13: {
186
+ const arg_12 = Types_typeToString(t);
93
187
  return toText(printf("<type %s>"))(arg_12);
94
188
  }
95
- case 13:
189
+ case 14:
96
190
  return "<task>";
97
- case 14: {
98
- const arg_13 = join(" ", closureParameters(v.fields[0], v.fields[1]));
191
+ case 15: {
192
+ const arg_13 = join(" ", closureParameters(argName, body));
99
193
  return toText(printf("<fun %s>"))(arg_13);
100
194
  }
101
- case 11:
102
- return toText(printf("<ctor %s>"))(v.fields[1]);
103
- case 15:
104
- if (isEmpty(v.fields[1])) {
105
- return toText(printf("<extern %s>"))(v.fields[0].Name);
195
+ case 16:
196
+ return toText(printf("<ctor %s>"))(caseName_3);
197
+ default:
198
+ if (isEmpty(args_1)) {
199
+ return toText(printf("<extern %s>"))(ext.Name);
106
200
  }
107
201
  else {
108
- const arg_17 = length(v.fields[1]) | 0;
109
- return toText(printf("<extern %s (%d/%d)>"))(v.fields[0].Name)(arg_17)(v.fields[0].Arity);
202
+ const arg_17 = length(args_1) | 0;
203
+ return toText(printf("<extern %s (%d/%d)>"))(ext.Name)(arg_17)(ext.Arity);
110
204
  }
111
- default:
112
- return "()";
113
205
  }
114
206
  }
115
207