firefly-compiler 0.4.6 → 0.4.8

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.
Files changed (90) hide show
  1. package/compiler/Compiler.ff +2 -0
  2. package/compiler/Deriver.ff +7 -0
  3. package/core/Array.ff +17 -4
  4. package/core/AssetSystem.ff +1 -1
  5. package/core/BrowserSystem.ff +27 -0
  6. package/core/List.ff +4 -0
  7. package/core/Lock.ff +2 -2
  8. package/core/Random.ff +148 -0
  9. package/core/SourceLocation.ff +27 -0
  10. package/core/Task.ff +3 -0
  11. package/core/WebSocket.ff +127 -0
  12. package/httpserver/HttpServer.ff +1 -1
  13. package/lux/Css.ff +648 -0
  14. package/lux/CssTest.ff +48 -0
  15. package/lux/Lux.ff +33 -18
  16. package/lux/Main.ff +4 -1
  17. package/output/js/ff/compiler/Builder.mjs +448 -444
  18. package/output/js/ff/compiler/Compiler.mjs +420 -416
  19. package/output/js/ff/compiler/Dependencies.mjs +393 -389
  20. package/output/js/ff/compiler/Deriver.mjs +1178 -1170
  21. package/output/js/ff/compiler/Dictionaries.mjs +1315 -1309
  22. package/output/js/ff/compiler/Environment.mjs +1025 -1015
  23. package/output/js/ff/compiler/Inference.mjs +4272 -4268
  24. package/output/js/ff/compiler/JsEmitter.mjs +5405 -5391
  25. package/output/js/ff/compiler/JsImporter.mjs +270 -266
  26. package/output/js/ff/compiler/LspHook.mjs +799 -793
  27. package/output/js/ff/compiler/Main.mjs +1691 -1675
  28. package/output/js/ff/compiler/Parser.mjs +4016 -4008
  29. package/output/js/ff/compiler/Patterns.mjs +935 -927
  30. package/output/js/ff/compiler/Resolver.mjs +2311 -2307
  31. package/output/js/ff/compiler/Substitution.mjs +1154 -1150
  32. package/output/js/ff/compiler/Syntax.mjs +12566 -12434
  33. package/output/js/ff/compiler/Token.mjs +3152 -3096
  34. package/output/js/ff/compiler/Tokenizer.mjs +597 -593
  35. package/output/js/ff/compiler/Unification.mjs +1762 -1752
  36. package/output/js/ff/compiler/Wildcards.mjs +612 -608
  37. package/output/js/ff/compiler/Workspace.mjs +695 -687
  38. package/output/js/ff/core/Any.mjs +147 -143
  39. package/output/js/ff/core/Array.mjs +573 -547
  40. package/output/js/ff/core/AssetSystem.mjs +278 -274
  41. package/output/js/ff/core/Atomic.mjs +158 -154
  42. package/output/js/ff/core/Bool.mjs +156 -152
  43. package/output/js/ff/core/Box.mjs +116 -112
  44. package/output/js/ff/core/BrowserSystem.mjs +181 -126
  45. package/output/js/ff/core/Buffer.mjs +399 -395
  46. package/output/js/ff/core/BuildSystem.mjs +300 -296
  47. package/output/js/ff/core/Channel.mjs +193 -189
  48. package/output/js/ff/core/Char.mjs +153 -149
  49. package/output/js/ff/core/Core.mjs +304 -300
  50. package/output/js/ff/core/Duration.mjs +120 -116
  51. package/output/js/ff/core/Equal.mjs +183 -179
  52. package/output/js/ff/core/Error.mjs +146 -142
  53. package/output/js/ff/core/FileHandle.mjs +154 -150
  54. package/output/js/ff/core/Float.mjs +229 -225
  55. package/output/js/ff/core/HttpClient.mjs +195 -191
  56. package/output/js/ff/core/Instant.mjs +113 -109
  57. package/output/js/ff/core/Int.mjs +269 -265
  58. package/output/js/ff/core/IntMap.mjs +284 -280
  59. package/output/js/ff/core/JsSystem.mjs +242 -238
  60. package/output/js/ff/core/JsValue.mjs +712 -708
  61. package/output/js/ff/core/List.mjs +2346 -2334
  62. package/output/js/ff/core/Lock.mjs +235 -231
  63. package/output/js/ff/core/Log.mjs +167 -163
  64. package/output/js/ff/core/Map.mjs +366 -362
  65. package/output/js/ff/core/NodeSystem.mjs +298 -294
  66. package/output/js/ff/core/Nothing.mjs +108 -104
  67. package/output/js/ff/core/Option.mjs +1023 -1015
  68. package/output/js/ff/core/Ordering.mjs +734 -730
  69. package/output/js/ff/core/Pair.mjs +337 -331
  70. package/output/js/ff/core/Path.mjs +549 -545
  71. package/output/js/ff/core/Random.mjs +340 -0
  72. package/output/js/ff/core/RbMap.mjs +1944 -1940
  73. package/output/js/ff/core/Serializable.mjs +432 -428
  74. package/output/js/ff/core/Set.mjs +258 -254
  75. package/output/js/ff/core/Show.mjs +209 -205
  76. package/output/js/ff/core/SourceLocation.mjs +273 -229
  77. package/output/js/ff/core/Stack.mjs +533 -529
  78. package/output/js/ff/core/Stream.mjs +1308 -1304
  79. package/output/js/ff/core/String.mjs +369 -365
  80. package/output/js/ff/core/StringMap.mjs +284 -280
  81. package/output/js/ff/core/Task.mjs +325 -319
  82. package/output/js/ff/core/Try.mjs +511 -507
  83. package/output/js/ff/core/Unit.mjs +155 -151
  84. package/output/js/ff/core/WebSocket.mjs +198 -0
  85. package/package.json +1 -1
  86. package/vscode/package.json +1 -1
  87. package/webserver/.firefly/include/package-lock.json +16 -0
  88. package/webserver/.firefly/include/package.json +5 -0
  89. package/webserver/.firefly/package.ff +2 -0
  90. package/webserver/WebServer.ff +608 -0
@@ -1,187 +1,191 @@
1
-
2
-
3
- import * as ff_core_Any from "../../ff/core/Any.mjs"
4
-
5
- import * as ff_core_Array from "../../ff/core/Array.mjs"
6
-
7
- import * as ff_core_AssetSystem from "../../ff/core/AssetSystem.mjs"
8
-
9
- import * as ff_core_Atomic from "../../ff/core/Atomic.mjs"
10
-
11
- import * as ff_core_Bool from "../../ff/core/Bool.mjs"
12
-
13
- import * as ff_core_Box from "../../ff/core/Box.mjs"
14
-
15
- import * as ff_core_BrowserSystem from "../../ff/core/BrowserSystem.mjs"
16
-
17
- import * as ff_core_Buffer from "../../ff/core/Buffer.mjs"
18
-
19
- import * as ff_core_BuildSystem from "../../ff/core/BuildSystem.mjs"
20
-
21
- import * as ff_core_Channel from "../../ff/core/Channel.mjs"
22
-
23
- import * as ff_core_Char from "../../ff/core/Char.mjs"
24
-
25
- import * as ff_core_Core from "../../ff/core/Core.mjs"
26
-
27
- import * as ff_core_Duration from "../../ff/core/Duration.mjs"
28
-
29
- import * as ff_core_Equal from "../../ff/core/Equal.mjs"
30
-
31
- import * as ff_core_Error from "../../ff/core/Error.mjs"
32
-
33
- import * as ff_core_FileHandle from "../../ff/core/FileHandle.mjs"
34
-
35
- import * as ff_core_Float from "../../ff/core/Float.mjs"
36
-
37
- import * as ff_core_HttpClient from "../../ff/core/HttpClient.mjs"
38
-
39
- import * as ff_core_Instant from "../../ff/core/Instant.mjs"
40
-
41
- import * as ff_core_Int from "../../ff/core/Int.mjs"
42
-
43
- import * as ff_core_IntMap from "../../ff/core/IntMap.mjs"
44
-
45
- import * as ff_core_JsSystem from "../../ff/core/JsSystem.mjs"
46
-
47
- import * as ff_core_JsValue from "../../ff/core/JsValue.mjs"
48
-
49
- import * as ff_core_List from "../../ff/core/List.mjs"
50
-
51
- import * as ff_core_Lock from "../../ff/core/Lock.mjs"
52
-
53
- import * as ff_core_Log from "../../ff/core/Log.mjs"
54
-
55
- import * as ff_core_Map from "../../ff/core/Map.mjs"
56
-
57
- import * as ff_core_NodeSystem from "../../ff/core/NodeSystem.mjs"
58
-
59
- import * as ff_core_Nothing from "../../ff/core/Nothing.mjs"
60
-
61
- import * as ff_core_Option from "../../ff/core/Option.mjs"
62
-
63
- import * as ff_core_Ordering from "../../ff/core/Ordering.mjs"
64
-
65
- import * as ff_core_Pair from "../../ff/core/Pair.mjs"
66
-
67
- import * as ff_core_Path from "../../ff/core/Path.mjs"
68
-
69
- import * as ff_core_Serializable from "../../ff/core/Serializable.mjs"
70
-
71
- import * as ff_core_Set from "../../ff/core/Set.mjs"
72
-
73
- import * as ff_core_Show from "../../ff/core/Show.mjs"
74
-
75
- import * as ff_core_SourceLocation from "../../ff/core/SourceLocation.mjs"
76
-
77
- import * as ff_core_Stack from "../../ff/core/Stack.mjs"
78
-
79
- import * as ff_core_Stream from "../../ff/core/Stream.mjs"
80
-
81
- import * as ff_core_String from "../../ff/core/String.mjs"
82
-
83
- import * as ff_core_StringMap from "../../ff/core/StringMap.mjs"
84
-
85
- import * as ff_core_Task from "../../ff/core/Task.mjs"
86
-
87
- import * as ff_core_Try from "../../ff/core/Try.mjs"
88
-
89
- import * as ff_core_Unit from "../../ff/core/Unit.mjs"
90
-
91
- // type List
92
- const Empty$ = {Empty: true};
93
- export function Empty() {
94
- return Empty$;
95
- }
96
- export function Link(head_, tail_) {
97
- return {Link: true, head_, tail_};
98
- }
99
-
100
-
101
-
102
- export function range_(size_) {
1
+
2
+
3
+ import * as ff_core_Any from "../../ff/core/Any.mjs"
4
+
5
+ import * as ff_core_Array from "../../ff/core/Array.mjs"
6
+
7
+ import * as ff_core_AssetSystem from "../../ff/core/AssetSystem.mjs"
8
+
9
+ import * as ff_core_Atomic from "../../ff/core/Atomic.mjs"
10
+
11
+ import * as ff_core_Bool from "../../ff/core/Bool.mjs"
12
+
13
+ import * as ff_core_Box from "../../ff/core/Box.mjs"
14
+
15
+ import * as ff_core_BrowserSystem from "../../ff/core/BrowserSystem.mjs"
16
+
17
+ import * as ff_core_Buffer from "../../ff/core/Buffer.mjs"
18
+
19
+ import * as ff_core_BuildSystem from "../../ff/core/BuildSystem.mjs"
20
+
21
+ import * as ff_core_Channel from "../../ff/core/Channel.mjs"
22
+
23
+ import * as ff_core_Char from "../../ff/core/Char.mjs"
24
+
25
+ import * as ff_core_Core from "../../ff/core/Core.mjs"
26
+
27
+ import * as ff_core_Duration from "../../ff/core/Duration.mjs"
28
+
29
+ import * as ff_core_Equal from "../../ff/core/Equal.mjs"
30
+
31
+ import * as ff_core_Error from "../../ff/core/Error.mjs"
32
+
33
+ import * as ff_core_FileHandle from "../../ff/core/FileHandle.mjs"
34
+
35
+ import * as ff_core_Float from "../../ff/core/Float.mjs"
36
+
37
+ import * as ff_core_HttpClient from "../../ff/core/HttpClient.mjs"
38
+
39
+ import * as ff_core_Instant from "../../ff/core/Instant.mjs"
40
+
41
+ import * as ff_core_Int from "../../ff/core/Int.mjs"
42
+
43
+ import * as ff_core_IntMap from "../../ff/core/IntMap.mjs"
44
+
45
+ import * as ff_core_JsSystem from "../../ff/core/JsSystem.mjs"
46
+
47
+ import * as ff_core_JsValue from "../../ff/core/JsValue.mjs"
48
+
49
+ import * as ff_core_List from "../../ff/core/List.mjs"
50
+
51
+ import * as ff_core_Lock from "../../ff/core/Lock.mjs"
52
+
53
+ import * as ff_core_Log from "../../ff/core/Log.mjs"
54
+
55
+ import * as ff_core_Map from "../../ff/core/Map.mjs"
56
+
57
+ import * as ff_core_NodeSystem from "../../ff/core/NodeSystem.mjs"
58
+
59
+ import * as ff_core_Nothing from "../../ff/core/Nothing.mjs"
60
+
61
+ import * as ff_core_Option from "../../ff/core/Option.mjs"
62
+
63
+ import * as ff_core_Ordering from "../../ff/core/Ordering.mjs"
64
+
65
+ import * as ff_core_Pair from "../../ff/core/Pair.mjs"
66
+
67
+ import * as ff_core_Path from "../../ff/core/Path.mjs"
68
+
69
+ import * as ff_core_Random from "../../ff/core/Random.mjs"
70
+
71
+ import * as ff_core_Serializable from "../../ff/core/Serializable.mjs"
72
+
73
+ import * as ff_core_Set from "../../ff/core/Set.mjs"
74
+
75
+ import * as ff_core_Show from "../../ff/core/Show.mjs"
76
+
77
+ import * as ff_core_SourceLocation from "../../ff/core/SourceLocation.mjs"
78
+
79
+ import * as ff_core_Stack from "../../ff/core/Stack.mjs"
80
+
81
+ import * as ff_core_Stream from "../../ff/core/Stream.mjs"
82
+
83
+ import * as ff_core_String from "../../ff/core/String.mjs"
84
+
85
+ import * as ff_core_StringMap from "../../ff/core/StringMap.mjs"
86
+
87
+ import * as ff_core_Task from "../../ff/core/Task.mjs"
88
+
89
+ import * as ff_core_Try from "../../ff/core/Try.mjs"
90
+
91
+ import * as ff_core_Unit from "../../ff/core/Unit.mjs"
92
+
93
+ import * as ff_core_WebSocket from "../../ff/core/WebSocket.mjs"
94
+
95
+ // type List
96
+ const Empty$ = {Empty: true};
97
+ export function Empty() {
98
+ return Empty$;
99
+ }
100
+ export function Link(head_, tail_) {
101
+ return {Link: true, head_, tail_};
102
+ }
103
+
104
+
105
+
106
+ export function range_(size_) {
103
107
 
104
108
  let result = ff_core_List.Empty();
105
109
  for(let i = size_ - 1; i >= 0; i--) {
106
110
  result = ff_core_List.Link(i, result);
107
111
  }
108
112
  return result;
109
-
110
- }
111
-
112
- export function build_(initial_, body_) {
113
- function go_(state_, result_) {
114
- _tailcall: for(;;) {
115
- {
116
- const _1 = body_(state_);
117
- {
118
- if(_1.None) {
119
- return ff_core_List.List_reverse(result_)
120
- return
121
- }
122
- }
123
- {
124
- if(_1.Some) {
125
- const s_ = _1.value_.first_;
126
- const x_ = _1.value_.second_;
127
- {
128
- const state_r_ = s_;
129
- const result_r_ = ff_core_List.Link(x_, result_);
130
- state_ = state_r_
131
- result_ = result_r_
132
- continue _tailcall
133
- }
134
- return
135
- }
136
- }
137
- }
138
- return
139
- }
140
- }
141
- return go_(initial_, ff_core_List.Empty())
142
- }
143
-
144
- export async function range_$(size_, $task) {
145
- throw new Error('Function range is missing on this target in async context.');
146
- }
147
-
148
- export async function build_$(initial_, body_, $task) {
149
- async function go_$(state_, result_, $task) {
150
- _tailcall: for(;;) {
151
- {
152
- const _1 = (await body_(state_, $task));
153
- {
154
- if(_1.None) {
155
- return ff_core_List.List_reverse(result_)
156
- return
157
- }
158
- }
159
- {
160
- if(_1.Some) {
161
- const s_ = _1.value_.first_;
162
- const x_ = _1.value_.second_;
163
- {
164
- const state_r_ = s_;
165
- const result_r_ = ff_core_List.Link(x_, result_);
166
- state_ = state_r_
167
- result_ = result_r_
168
- continue _tailcall
169
- }
170
- return
171
- }
172
- }
173
- }
174
- return
175
- }
176
- }
177
- return (await go_$(initial_, ff_core_List.Empty(), $task))
178
- }
179
-
180
- export function List_addAll(self_, list_) {
181
- return ff_core_List.List_flatten(ff_core_List.Link(self_, ff_core_List.Link(list_, ff_core_List.Empty())))
182
- }
183
-
184
- export function List_toStack(self_) {
113
+
114
+ }
115
+
116
+ export function build_(initial_, body_) {
117
+ function go_(state_, result_) {
118
+ _tailcall: for(;;) {
119
+ {
120
+ const _1 = body_(state_);
121
+ {
122
+ if(_1.None) {
123
+ return ff_core_List.List_reverse(result_)
124
+ return
125
+ }
126
+ }
127
+ {
128
+ if(_1.Some) {
129
+ const s_ = _1.value_.first_;
130
+ const x_ = _1.value_.second_;
131
+ {
132
+ const state_r_ = s_;
133
+ const result_r_ = ff_core_List.Link(x_, result_);
134
+ state_ = state_r_
135
+ result_ = result_r_
136
+ continue _tailcall
137
+ }
138
+ return
139
+ }
140
+ }
141
+ }
142
+ return
143
+ }
144
+ }
145
+ return go_(initial_, ff_core_List.Empty())
146
+ }
147
+
148
+ export async function range_$(size_, $task) {
149
+ throw new Error('Function range is missing on this target in async context.');
150
+ }
151
+
152
+ export async function build_$(initial_, body_, $task) {
153
+ async function go_$(state_, result_, $task) {
154
+ _tailcall: for(;;) {
155
+ {
156
+ const _1 = (await body_(state_, $task));
157
+ {
158
+ if(_1.None) {
159
+ return ff_core_List.List_reverse(result_)
160
+ return
161
+ }
162
+ }
163
+ {
164
+ if(_1.Some) {
165
+ const s_ = _1.value_.first_;
166
+ const x_ = _1.value_.second_;
167
+ {
168
+ const state_r_ = s_;
169
+ const result_r_ = ff_core_List.Link(x_, result_);
170
+ state_ = state_r_
171
+ result_ = result_r_
172
+ continue _tailcall
173
+ }
174
+ return
175
+ }
176
+ }
177
+ }
178
+ return
179
+ }
180
+ }
181
+ return (await go_$(initial_, ff_core_List.Empty(), $task))
182
+ }
183
+
184
+ export function List_addAll(self_, list_) {
185
+ return ff_core_List.List_flatten(ff_core_List.Link(self_, ff_core_List.Link(list_, ff_core_List.Empty())))
186
+ }
187
+
188
+ export function List_toStack(self_) {
185
189
 
186
190
  let current = self_;
187
191
  let result = [];
@@ -190,2159 +194,2167 @@ export function List_toStack(self_) {
190
194
  current = current.tail_;
191
195
  }
192
196
  return {array: result};
193
-
194
- }
195
-
196
- export function List_toArray(self_) {
197
- return ff_core_Stack.Stack_drain(ff_core_List.List_toStack(self_))
198
- }
199
-
200
- export function List_grab(self_, index_) {
201
- function go_(list_, i_) {
202
- _tailcall: for(;;) {
203
- {
204
- const _1 = list_;
205
- {
206
- if(_1.Empty) {
207
- return ff_core_Try.internalThrowGrabException_()
208
- return
209
- }
210
- }
211
- {
212
- if(_1.Link) {
213
- const head_ = _1.head_;
214
- const _guard1 = (i_ === 0);
215
- if(_guard1) {
216
- return head_
217
- return
218
- }
219
- }
220
- }
221
- {
222
- if(_1.Link) {
223
- const tail_ = _1.tail_;
224
- {
225
- const list_r_ = tail_;
226
- const i_r_ = (i_ - 1);
227
- list_ = list_r_
228
- i_ = i_r_
229
- continue _tailcall
230
- }
231
- return
232
- }
233
- }
234
- }
235
- return
236
- }
237
- }
238
- return go_(self_, index_)
239
- }
240
-
241
- export function List_first(self_) {
242
- {
243
- const _1 = self_;
244
- {
245
- if(_1.Empty) {
246
- return ff_core_Option.None()
247
- return
248
- }
249
- }
250
- {
251
- if(_1.Link) {
252
- const head_ = _1.head_;
253
- return ff_core_Option.Some(head_)
254
- return
255
- }
256
- }
257
- }
258
- }
259
-
260
- export function List_last(self_) {
261
- _tailcall: for(;;) {
262
- {
263
- const _1 = self_;
264
- {
265
- if(_1.Empty) {
266
- return ff_core_Option.None()
267
- return
268
- }
269
- }
270
- {
271
- if(_1.Link) {
272
- const head_ = _1.head_;
273
- if(_1.tail_.Empty) {
274
- return ff_core_Option.Some(head_)
275
- return
276
- }
277
- }
278
- }
279
- {
280
- if(_1.Link) {
281
- const tail_ = _1.tail_;
282
- {
283
- const self_r_ = tail_;
284
- self_ = self_r_
285
- continue _tailcall
286
- }
287
- return
288
- }
289
- }
290
- }
291
- return
292
- }
293
- }
294
-
295
- export function List_grabFirst(self_) {
296
- return ff_core_Option.Option_else(ff_core_List.List_first(self_), (() => {
297
- return ff_core_Try.internalThrowGrabException_()
298
- }))
299
- }
300
-
301
- export function List_grabLast(self_) {
302
- return ff_core_Option.Option_else(ff_core_List.List_last(self_), (() => {
303
- return ff_core_Try.internalThrowGrabException_()
304
- }))
305
- }
306
-
307
- export function List_dropFirst(self_, count_ = 1) {
308
- _tailcall: for(;;) {
309
- {
310
- const _1 = self_;
311
- {
312
- const _guard1 = (count_ <= 0);
313
- if(_guard1) {
314
- return self_
315
- return
316
- }
317
- }
318
- {
319
- if(_1.Empty) {
320
- return self_
321
- return
322
- }
323
- }
324
- {
325
- if(_1.Link) {
326
- const tail_ = _1.tail_;
327
- {
328
- const self_r_ = tail_;
329
- const count_r_ = (count_ - 1);
330
- self_ = self_r_
331
- count_ = count_r_
332
- continue _tailcall
333
- }
334
- return
335
- }
336
- }
337
- }
338
- return
339
- }
340
- }
341
-
342
- export function List_dropLast(self_, count_ = 1) {
343
- return ff_core_List.List_reverse(ff_core_List.List_dropFirst(ff_core_List.List_reverse(self_), count_))
344
- }
345
-
346
- export function List_takeFirst(self_, count_ = 1) {
347
- function go_(list_, count_, result_) {
348
- _tailcall: for(;;) {
349
- {
350
- const _1 = list_;
351
- {
352
- const _guard1 = (count_ <= 0);
353
- if(_guard1) {
354
- return ff_core_List.List_reverse(result_)
355
- return
356
- }
357
- }
358
- {
359
- if(_1.Empty) {
360
- return ff_core_List.List_reverse(result_)
361
- return
362
- }
363
- }
364
- {
365
- if(_1.Link) {
366
- const head_ = _1.head_;
367
- const tail_ = _1.tail_;
368
- {
369
- const list_r_ = tail_;
370
- const count_r_ = (count_ - 1);
371
- const result_r_ = ff_core_List.Link(head_, result_);
372
- list_ = list_r_
373
- count_ = count_r_
374
- result_ = result_r_
375
- continue _tailcall
376
- }
377
- return
378
- }
379
- }
380
- }
381
- return
382
- }
383
- }
384
- return go_(self_, count_, ff_core_List.Empty())
385
- }
386
-
387
- export function List_takeLast(self_, count_ = 1) {
388
- return ff_core_List.List_reverse(ff_core_List.List_takeFirst(ff_core_List.List_reverse(self_), count_))
389
- }
390
-
391
- export function List_pairs(self_) {
392
- let i_ = 0;
393
- return ff_core_List.List_map(self_, ((x_) => {
394
- const r_ = ff_core_Pair.Pair(i_, x_);
395
- i_ += 1;
396
- return r_
397
- }))
398
- }
399
-
400
- export function List_slice(self_, from_, until_) {
401
- return ff_core_List.List_takeFirst(ff_core_List.List_dropFirst(self_, from_), (until_ - from_))
402
- }
403
-
404
- export function List_isEmpty(self_) {
405
- {
406
- const _1 = self_;
407
- {
408
- if(_1.Empty) {
409
- return true
410
- return
411
- }
412
- }
413
- {
414
- return false
415
- return
416
- }
417
- }
418
- }
419
-
420
- export function List_size(self_) {
421
- function go_(list_, result_) {
422
- _tailcall: for(;;) {
423
- {
424
- const _1 = list_;
425
- {
426
- if(_1.Empty) {
427
- return result_
428
- return
429
- }
430
- }
431
- {
432
- if(_1.Link) {
433
- const tail_ = _1.tail_;
434
- {
435
- const list_r_ = tail_;
436
- const result_r_ = (result_ + 1);
437
- list_ = list_r_
438
- result_ = result_r_
439
- continue _tailcall
440
- }
441
- return
442
- }
443
- }
444
- }
445
- return
446
- }
447
- }
448
- return go_(self_, 0)
449
- }
450
-
451
- export function List_each(self_, body_) {
452
- _tailcall: for(;;) {
453
- {
454
- const _1 = self_;
455
- {
456
- if(_1.Empty) {
457
-
458
- return
459
- }
460
- }
461
- {
462
- if(_1.Link) {
463
- const head_ = _1.head_;
464
- const tail_ = _1.tail_;
465
- body_(head_);
466
- {
467
- const self_r_ = tail_;
468
- const body_r_ = body_;
469
- self_ = self_r_
470
- body_ = body_r_
471
- continue _tailcall
472
- }
473
- return
474
- }
475
- }
476
- }
477
- return
478
- }
479
- }
480
-
481
- export function List_all(self_, body_) {
482
- _tailcall: for(;;) {
483
- {
484
- const _1 = self_;
485
- {
486
- if(_1.Empty) {
487
- return true
488
- return
489
- }
490
- }
491
- {
492
- if(_1.Link) {
493
- const head_ = _1.head_;
494
- const _guard1 = (!body_(head_));
495
- if(_guard1) {
496
- return false
497
- return
498
- }
499
- }
500
- }
501
- {
502
- if(_1.Link) {
503
- const tail_ = _1.tail_;
504
- {
505
- const self_r_ = tail_;
506
- const body_r_ = body_;
507
- self_ = self_r_
508
- body_ = body_r_
509
- continue _tailcall
510
- }
511
- return
512
- }
513
- }
514
- }
515
- return
516
- }
517
- }
518
-
519
- export function List_any(self_, body_) {
520
- _tailcall: for(;;) {
521
- {
522
- const _1 = self_;
523
- {
524
- if(_1.Empty) {
525
- return false
526
- return
527
- }
528
- }
529
- {
530
- if(_1.Link) {
531
- const head_ = _1.head_;
532
- const _guard1 = body_(head_);
533
- if(_guard1) {
534
- return true
535
- return
536
- }
537
- }
538
- }
539
- {
540
- if(_1.Link) {
541
- const tail_ = _1.tail_;
542
- {
543
- const self_r_ = tail_;
544
- const body_r_ = body_;
545
- self_ = self_r_
546
- body_ = body_r_
547
- continue _tailcall
548
- }
549
- return
550
- }
551
- }
552
- }
553
- return
554
- }
555
- }
556
-
557
- export function List_find(self_, body_) {
558
- _tailcall: for(;;) {
559
- {
560
- const _1 = self_;
561
- {
562
- if(_1.Empty) {
563
- return ff_core_Option.None()
564
- return
565
- }
566
- }
567
- {
568
- if(_1.Link) {
569
- const head_ = _1.head_;
570
- const _guard1 = body_(head_);
571
- if(_guard1) {
572
- return ff_core_Option.Some(head_)
573
- return
574
- }
575
- }
576
- }
577
- {
578
- if(_1.Link) {
579
- const tail_ = _1.tail_;
580
- {
581
- const self_r_ = tail_;
582
- const body_r_ = body_;
583
- self_ = self_r_
584
- body_ = body_r_
585
- continue _tailcall
586
- }
587
- return
588
- }
589
- }
590
- }
591
- return
592
- }
593
- }
594
-
595
- export function List_filter(self_, body_) {
596
- function go_(list_, result_) {
597
- _tailcall: for(;;) {
598
- {
599
- const _1 = list_;
600
- {
601
- if(_1.Empty) {
602
- return ff_core_List.List_reverse(result_)
603
- return
604
- }
605
- }
606
- {
607
- if(_1.Link) {
608
- const head_ = _1.head_;
609
- const tail_ = _1.tail_;
610
- const _guard1 = body_(head_);
611
- if(_guard1) {
612
- {
613
- const list_r_ = tail_;
614
- const result_r_ = ff_core_List.Link(head_, result_);
615
- list_ = list_r_
616
- result_ = result_r_
617
- continue _tailcall
618
- }
619
- return
620
- }
621
- }
622
- }
623
- {
624
- if(_1.Link) {
625
- const tail_ = _1.tail_;
626
- {
627
- const list_r_ = tail_;
628
- const result_r_ = result_;
629
- list_ = list_r_
630
- result_ = result_r_
631
- continue _tailcall
632
- }
633
- return
634
- }
635
- }
636
- }
637
- return
638
- }
639
- }
640
- return go_(self_, ff_core_List.Empty())
641
- }
642
-
643
- export function List_partition(self_, body_) {
644
- return ff_core_Pair.Pair(ff_core_List.List_filter(self_, body_), ff_core_List.List_filter(self_, ((_w1) => {
645
- return (!body_(_w1))
646
- })))
647
- }
648
-
649
- export function List_map(self_, body_) {
650
- function go_(list_, result_) {
651
- _tailcall: for(;;) {
652
- {
653
- const _1 = list_;
654
- {
655
- if(_1.Empty) {
656
- return ff_core_List.List_reverse(result_)
657
- return
658
- }
659
- }
660
- {
661
- if(_1.Link) {
662
- const head_ = _1.head_;
663
- const tail_ = _1.tail_;
664
- {
665
- const list_r_ = tail_;
666
- const result_r_ = ff_core_List.Link(body_(head_), result_);
667
- list_ = list_r_
668
- result_ = result_r_
669
- continue _tailcall
670
- }
671
- return
672
- }
673
- }
674
- }
675
- return
676
- }
677
- }
678
- return go_(self_, ff_core_List.Empty())
679
- }
680
-
681
- export function List_flatMap(self_, body_) {
682
- function go_(list_, result_) {
683
- _tailcall: for(;;) {
684
- {
685
- const _1 = list_;
686
- {
687
- if(_1.Empty) {
688
- return ff_core_List.List_flatten(ff_core_List.List_reverse(result_))
689
- return
690
- }
691
- }
692
- {
693
- if(_1.Link) {
694
- const head_ = _1.head_;
695
- const tail_ = _1.tail_;
696
- {
697
- const list_r_ = tail_;
698
- const result_r_ = ff_core_List.Link(body_(head_), result_);
699
- list_ = list_r_
700
- result_ = result_r_
701
- continue _tailcall
702
- }
703
- return
704
- }
705
- }
706
- }
707
- return
708
- }
709
- }
710
- return go_(self_, ff_core_List.Empty())
711
- }
712
-
713
- export function List_collect(self_, body_) {
714
- return ff_core_Stream.Stream_toList(ff_core_Stream.Stream_collect(ff_core_List.List_toStream(self_, false), body_))
715
- }
716
-
717
- export function List_collectFirst(self_, body_) {
718
- _tailcall: for(;;) {
719
- {
720
- const _1 = self_;
721
- {
722
- if(_1.Empty) {
723
- return ff_core_Option.None()
724
- return
725
- }
726
- }
727
- {
728
- if(_1.Link) {
729
- const head_ = _1.head_;
730
- const tail_ = _1.tail_;
731
- {
732
- const _1 = body_(head_);
733
- {
734
- if(_1.None) {
735
- {
736
- const self_r_ = tail_;
737
- const body_r_ = body_;
738
- self_ = self_r_
739
- body_ = body_r_
740
- continue _tailcall
741
- }
742
- return
743
- }
744
- }
745
- {
746
- if(_1.Some) {
747
- const value_ = _1.value_;
748
- return ff_core_Option.Some(value_)
749
- return
750
- }
751
- }
752
- }
753
- return
754
- }
755
- }
756
- }
757
- return
758
- }
759
- }
760
-
761
- export function List_foldLeft(self_, initial_, body_) {
762
- function go_(state_, list_) {
763
- _tailcall: for(;;) {
764
- {
765
- const _1 = list_;
766
- {
767
- if(_1.Empty) {
768
- return state_
769
- return
770
- }
771
- }
772
- {
773
- if(_1.Link) {
774
- const head_ = _1.head_;
775
- const tail_ = _1.tail_;
776
- {
777
- const state_r_ = body_(state_, head_);
778
- const list_r_ = tail_;
779
- state_ = state_r_
780
- list_ = list_r_
781
- continue _tailcall
782
- }
783
- return
784
- }
785
- }
786
- }
787
- return
788
- }
789
- }
790
- return go_(initial_, self_)
791
- }
792
-
793
- export function List_updated(self_, index_, value_) {
794
- function go_(list_, i_, result_) {
795
- _tailcall: for(;;) {
796
- {
797
- const _1 = list_;
798
- {
799
- if(_1.Empty) {
800
- return ff_core_List.List_reverse(result_)
801
- return
802
- }
803
- }
804
- {
805
- if(_1.Link) {
806
- const head_ = _1.head_;
807
- const tail_ = _1.tail_;
808
- const _guard1 = (i_ === 0);
809
- if(_guard1) {
810
- {
811
- const list_r_ = tail_;
812
- const i_r_ = (i_ - 1);
813
- const result_r_ = ff_core_List.Link(value_, result_);
814
- list_ = list_r_
815
- i_ = i_r_
816
- result_ = result_r_
817
- continue _tailcall
818
- }
819
- return
820
- }
821
- }
822
- }
823
- {
824
- if(_1.Link) {
825
- const head_ = _1.head_;
826
- const tail_ = _1.tail_;
827
- {
828
- const list_r_ = tail_;
829
- const i_r_ = (i_ - 1);
830
- const result_r_ = ff_core_List.Link(head_, result_);
831
- list_ = list_r_
832
- i_ = i_r_
833
- result_ = result_r_
834
- continue _tailcall
835
- }
836
- return
837
- }
838
- }
839
- }
840
- return
841
- }
842
- }
843
- return go_(self_, index_, ff_core_List.Empty())
844
- }
845
-
846
- export function List_modify(self_, index_, body_) {
847
- function go_(list_, i_, result_) {
848
- _tailcall: for(;;) {
849
- {
850
- const _1 = list_;
851
- {
852
- if(_1.Empty) {
853
- return ff_core_List.List_reverse(result_)
854
- return
855
- }
856
- }
857
- {
858
- if(_1.Link) {
859
- const head_ = _1.head_;
860
- const tail_ = _1.tail_;
861
- const _guard1 = (i_ === 0);
862
- if(_guard1) {
863
- {
864
- const list_r_ = tail_;
865
- const i_r_ = (i_ - 1);
866
- const result_r_ = ff_core_List.Link(body_(head_), result_);
867
- list_ = list_r_
868
- i_ = i_r_
869
- result_ = result_r_
870
- continue _tailcall
871
- }
872
- return
873
- }
874
- }
875
- }
876
- {
877
- if(_1.Link) {
878
- const head_ = _1.head_;
879
- const tail_ = _1.tail_;
880
- {
881
- const list_r_ = tail_;
882
- const i_r_ = (i_ - 1);
883
- const result_r_ = ff_core_List.Link(head_, result_);
884
- list_ = list_r_
885
- i_ = i_r_
886
- result_ = result_r_
887
- continue _tailcall
888
- }
889
- return
890
- }
891
- }
892
- }
893
- return
894
- }
895
- }
896
- return go_(self_, index_, ff_core_List.Empty())
897
- }
898
-
899
- export function List_zip(self_, that_) {
900
- function go_(list1_, list2_, result_) {
901
- _tailcall: for(;;) {
902
- {
903
- const _1 = ff_core_Pair.Pair(list1_, list2_);
904
- {
905
- if(_1.first_.Link) {
906
- const x_ = _1.first_.head_;
907
- const xs_ = _1.first_.tail_;
908
- if(_1.second_.Link) {
909
- const y_ = _1.second_.head_;
910
- const ys_ = _1.second_.tail_;
911
- {
912
- const list1_r_ = xs_;
913
- const list2_r_ = ys_;
914
- const result_r_ = ff_core_List.Link(ff_core_Pair.Pair(x_, y_), result_);
915
- list1_ = list1_r_
916
- list2_ = list2_r_
917
- result_ = result_r_
918
- continue _tailcall
919
- }
920
- return
921
- }
922
- }
923
- }
924
- {
925
- return ff_core_List.List_reverse(result_)
926
- return
927
- }
928
- }
929
- return
930
- }
931
- }
932
- return go_(self_, that_, ff_core_List.Empty())
933
- }
934
-
935
- export function List_sortBy(self_, body_, ff_core_Ordering_Order$O) {
936
- if((ff_core_List.List_size(self_) <= 1)) {
937
- return self_
938
- } else {
939
- const stack_ = ff_core_List.List_toStack(self_);
940
- ff_core_Stack.Stack_sortBy(stack_, body_, ff_core_Ordering_Order$O);
941
- return ff_core_Stack.Stack_toList(stack_, 0, 9007199254740991)
942
- }
943
- }
944
-
945
- export function List_sortWith(self_, compare_) {
946
- if((ff_core_List.List_size(self_) <= 1)) {
947
- return self_
948
- } else {
949
- const stack_ = ff_core_List.List_toStack(self_);
950
- ff_core_Stack.Stack_sortWith(stack_, compare_);
951
- return ff_core_Stack.Stack_toList(stack_, 0, 9007199254740991)
952
- }
953
- }
954
-
955
- export function List_reverse(self_) {
956
- function go_(list_, result_) {
957
- _tailcall: for(;;) {
958
- {
959
- const _1 = list_;
960
- {
961
- if(_1.Empty) {
962
- return result_
963
- return
964
- }
965
- }
966
- {
967
- if(_1.Link) {
968
- const head_ = _1.head_;
969
- const tail_ = _1.tail_;
970
- {
971
- const list_r_ = tail_;
972
- const result_r_ = ff_core_List.Link(head_, result_);
973
- list_ = list_r_
974
- result_ = result_r_
975
- continue _tailcall
976
- }
977
- return
978
- }
979
- }
980
- }
981
- return
982
- }
983
- }
984
- return go_(self_, ff_core_List.Empty())
985
- }
986
-
987
- export function List_chunk(self_, chunkSize_) {
988
- let results_ = ff_core_List.Empty();
989
- let result_ = ff_core_List.Empty();
990
- let added_ = 0;
991
- ff_core_List.List_each(self_, ((item_) => {
992
- if((added_ < chunkSize_)) {
993
- result_ = ff_core_List.Link(item_, result_);
994
- added_ += 1
995
- } else {
996
- results_ = ff_core_List.Link(ff_core_List.List_reverse(result_), results_);
997
- result_ = ff_core_List.Link(item_, ff_core_List.Empty());
998
- added_ = 1
999
- }
1000
- }));
1001
- if((added_ !== 0)) {
1002
- results_ = ff_core_List.Link(ff_core_List.List_reverse(result_), results_)
1003
- };
1004
- return ff_core_List.List_reverse(results_)
1005
- }
1006
-
1007
- export function List_toStream(self_, cycle_ = false) {
1008
- let remaining_ = self_;
1009
- return ff_core_Stream.Stream((() => {
1010
- {
1011
- const _1 = remaining_;
1012
- {
1013
- if(_1.Link) {
1014
- const head_ = _1.head_;
1015
- const tail_ = _1.tail_;
1016
- remaining_ = tail_;
1017
- return ff_core_Option.Some(head_)
1018
- return
1019
- }
1020
- }
1021
- {
1022
- if(_1.Empty) {
1023
- const _guard2 = self_;
1024
- if(_guard2.Link) {
1025
- const head_ = _guard2.head_;
1026
- const tail_ = _guard2.tail_;
1027
- const _guard1 = cycle_;
1028
- if(_guard1) {
1029
- remaining_ = tail_;
1030
- return ff_core_Option.Some(head_)
1031
- return
1032
- }
1033
- }
1034
- }
1035
- }
1036
- {
1037
- if(_1.Empty) {
1038
- return ff_core_Option.None()
1039
- return
1040
- }
1041
- }
1042
- }
1043
- }), (() => {
1044
- remaining_ = ff_core_List.Empty()
1045
- }))
1046
- }
1047
-
1048
- export function List_insertBetween(self_, separator_) {
1049
- return ff_core_List.List_dropFirst(ff_core_List.List_flatMap(self_, ((e_) => {
1050
- return ff_core_List.List_addAll(separator_, ff_core_List.Link(e_, ff_core_List.Empty()))
1051
- })), ff_core_List.List_size(separator_))
1052
- }
1053
-
1054
- export async function List_addAll$(self_, list_, $task) {
1055
- return ff_core_List.List_flatten(ff_core_List.Link(self_, ff_core_List.Link(list_, ff_core_List.Empty())))
1056
- }
1057
-
1058
- export async function List_toStack$(self_, $task) {
1059
- throw new Error('Function List_toStack is missing on this target in async context.');
1060
- }
1061
-
1062
- export async function List_toArray$(self_, $task) {
1063
- return ff_core_Stack.Stack_drain(ff_core_List.List_toStack(self_))
1064
- }
1065
-
1066
- export async function List_grab$(self_, index_, $task) {
1067
- function go_(list_, i_) {
1068
- _tailcall: for(;;) {
1069
- {
1070
- const _1 = list_;
1071
- {
1072
- if(_1.Empty) {
1073
- return ff_core_Try.internalThrowGrabException_()
1074
- return
1075
- }
1076
- }
1077
- {
1078
- if(_1.Link) {
1079
- const head_ = _1.head_;
1080
- const _guard1 = (i_ === 0);
1081
- if(_guard1) {
1082
- return head_
1083
- return
1084
- }
1085
- }
1086
- }
1087
- {
1088
- if(_1.Link) {
1089
- const tail_ = _1.tail_;
1090
- {
1091
- const list_r_ = tail_;
1092
- const i_r_ = (i_ - 1);
1093
- list_ = list_r_
1094
- i_ = i_r_
1095
- continue _tailcall
1096
- }
1097
- return
1098
- }
1099
- }
1100
- }
1101
- return
1102
- }
1103
- }
1104
- return go_(self_, index_)
1105
- }
1106
-
1107
- export async function List_first$(self_, $task) {
1108
- {
1109
- const _1 = self_;
1110
- {
1111
- if(_1.Empty) {
1112
- return ff_core_Option.None()
1113
- return
1114
- }
1115
- }
1116
- {
1117
- if(_1.Link) {
1118
- const head_ = _1.head_;
1119
- return ff_core_Option.Some(head_)
1120
- return
1121
- }
1122
- }
1123
- }
1124
- }
1125
-
1126
- export async function List_last$(self_, $task) {
1127
- _tailcall: for(;;) {
1128
- {
1129
- const _1 = self_;
1130
- {
1131
- if(_1.Empty) {
1132
- return ff_core_Option.None()
1133
- return
1134
- }
1135
- }
1136
- {
1137
- if(_1.Link) {
1138
- const head_ = _1.head_;
1139
- if(_1.tail_.Empty) {
1140
- return ff_core_Option.Some(head_)
1141
- return
1142
- }
1143
- }
1144
- }
1145
- {
1146
- if(_1.Link) {
1147
- const tail_ = _1.tail_;
1148
- {
1149
- const self_r_ = tail_;
1150
- self_ = self_r_
1151
- continue _tailcall
1152
- }
1153
- return
1154
- }
1155
- }
1156
- }
1157
- return
1158
- }
1159
- }
1160
-
1161
- export async function List_grabFirst$(self_, $task) {
1162
- return ff_core_Option.Option_else(ff_core_List.List_first(self_), (() => {
1163
- return ff_core_Try.internalThrowGrabException_()
1164
- }))
1165
- }
1166
-
1167
- export async function List_grabLast$(self_, $task) {
1168
- return ff_core_Option.Option_else(ff_core_List.List_last(self_), (() => {
1169
- return ff_core_Try.internalThrowGrabException_()
1170
- }))
1171
- }
1172
-
1173
- export async function List_dropFirst$(self_, count_ = 1, $task) {
1174
- _tailcall: for(;;) {
1175
- {
1176
- const _1 = self_;
1177
- {
1178
- const _guard1 = (count_ <= 0);
1179
- if(_guard1) {
1180
- return self_
1181
- return
1182
- }
1183
- }
1184
- {
1185
- if(_1.Empty) {
1186
- return self_
1187
- return
1188
- }
1189
- }
1190
- {
1191
- if(_1.Link) {
1192
- const tail_ = _1.tail_;
1193
- {
1194
- const self_r_ = tail_;
1195
- const count_r_ = (count_ - 1);
1196
- self_ = self_r_
1197
- count_ = count_r_
1198
- continue _tailcall
1199
- }
1200
- return
1201
- }
1202
- }
1203
- }
1204
- return
1205
- }
1206
- }
1207
-
1208
- export async function List_dropLast$(self_, count_ = 1, $task) {
1209
- return ff_core_List.List_reverse(ff_core_List.List_dropFirst(ff_core_List.List_reverse(self_), count_))
1210
- }
1211
-
1212
- export async function List_takeFirst$(self_, count_ = 1, $task) {
1213
- function go_(list_, count_, result_) {
1214
- _tailcall: for(;;) {
1215
- {
1216
- const _1 = list_;
1217
- {
1218
- const _guard1 = (count_ <= 0);
1219
- if(_guard1) {
1220
- return ff_core_List.List_reverse(result_)
1221
- return
1222
- }
1223
- }
1224
- {
1225
- if(_1.Empty) {
1226
- return ff_core_List.List_reverse(result_)
1227
- return
1228
- }
1229
- }
1230
- {
1231
- if(_1.Link) {
1232
- const head_ = _1.head_;
1233
- const tail_ = _1.tail_;
1234
- {
1235
- const list_r_ = tail_;
1236
- const count_r_ = (count_ - 1);
1237
- const result_r_ = ff_core_List.Link(head_, result_);
1238
- list_ = list_r_
1239
- count_ = count_r_
1240
- result_ = result_r_
1241
- continue _tailcall
1242
- }
1243
- return
1244
- }
1245
- }
1246
- }
1247
- return
1248
- }
1249
- }
1250
- return go_(self_, count_, ff_core_List.Empty())
1251
- }
1252
-
1253
- export async function List_takeLast$(self_, count_ = 1, $task) {
1254
- return ff_core_List.List_reverse(ff_core_List.List_takeFirst(ff_core_List.List_reverse(self_), count_))
1255
- }
1256
-
1257
- export async function List_pairs$(self_, $task) {
1258
- let i_ = 0;
1259
- return ff_core_List.List_map(self_, ((x_) => {
1260
- const r_ = ff_core_Pair.Pair(i_, x_);
1261
- i_ += 1;
1262
- return r_
1263
- }))
1264
- }
1265
-
1266
- export async function List_slice$(self_, from_, until_, $task) {
1267
- return ff_core_List.List_takeFirst(ff_core_List.List_dropFirst(self_, from_), (until_ - from_))
1268
- }
1269
-
1270
- export async function List_isEmpty$(self_, $task) {
1271
- {
1272
- const _1 = self_;
1273
- {
1274
- if(_1.Empty) {
1275
- return true
1276
- return
1277
- }
1278
- }
1279
- {
1280
- return false
1281
- return
1282
- }
1283
- }
1284
- }
1285
-
1286
- export async function List_size$(self_, $task) {
1287
- function go_(list_, result_) {
1288
- _tailcall: for(;;) {
1289
- {
1290
- const _1 = list_;
1291
- {
1292
- if(_1.Empty) {
1293
- return result_
1294
- return
1295
- }
1296
- }
1297
- {
1298
- if(_1.Link) {
1299
- const tail_ = _1.tail_;
1300
- {
1301
- const list_r_ = tail_;
1302
- const result_r_ = (result_ + 1);
1303
- list_ = list_r_
1304
- result_ = result_r_
1305
- continue _tailcall
1306
- }
1307
- return
1308
- }
1309
- }
1310
- }
1311
- return
1312
- }
1313
- }
1314
- return go_(self_, 0)
1315
- }
1316
-
1317
- export async function List_each$(self_, body_, $task) {
1318
- _tailcall: for(;;) {
1319
- {
1320
- const _1 = self_;
1321
- {
1322
- if(_1.Empty) {
1323
-
1324
- return
1325
- }
1326
- }
1327
- {
1328
- if(_1.Link) {
1329
- const head_ = _1.head_;
1330
- const tail_ = _1.tail_;
1331
- (await body_(head_, $task));
1332
- {
1333
- const self_r_ = tail_;
1334
- const body_r_ = body_;
1335
- self_ = self_r_
1336
- body_ = body_r_
1337
- continue _tailcall
1338
- }
1339
- return
1340
- }
1341
- }
1342
- }
1343
- return
1344
- }
1345
- }
1346
-
1347
- export async function List_all$(self_, body_, $task) {
1348
- _tailcall: for(;;) {
1349
- {
1350
- const _1 = self_;
1351
- {
1352
- if(_1.Empty) {
1353
- return true
1354
- return
1355
- }
1356
- }
1357
- {
1358
- if(_1.Link) {
1359
- const head_ = _1.head_;
1360
- const _guard1 = (!(await body_(head_, $task)));
1361
- if(_guard1) {
1362
- return false
1363
- return
1364
- }
1365
- }
1366
- }
1367
- {
1368
- if(_1.Link) {
1369
- const tail_ = _1.tail_;
1370
- {
1371
- const self_r_ = tail_;
1372
- const body_r_ = body_;
1373
- self_ = self_r_
1374
- body_ = body_r_
1375
- continue _tailcall
1376
- }
1377
- return
1378
- }
1379
- }
1380
- }
1381
- return
1382
- }
1383
- }
1384
-
1385
- export async function List_any$(self_, body_, $task) {
1386
- _tailcall: for(;;) {
1387
- {
1388
- const _1 = self_;
1389
- {
1390
- if(_1.Empty) {
1391
- return false
1392
- return
1393
- }
1394
- }
1395
- {
1396
- if(_1.Link) {
1397
- const head_ = _1.head_;
1398
- const _guard1 = (await body_(head_, $task));
1399
- if(_guard1) {
1400
- return true
1401
- return
1402
- }
1403
- }
1404
- }
1405
- {
1406
- if(_1.Link) {
1407
- const tail_ = _1.tail_;
1408
- {
1409
- const self_r_ = tail_;
1410
- const body_r_ = body_;
1411
- self_ = self_r_
1412
- body_ = body_r_
1413
- continue _tailcall
1414
- }
1415
- return
1416
- }
1417
- }
1418
- }
1419
- return
1420
- }
1421
- }
1422
-
1423
- export async function List_find$(self_, body_, $task) {
1424
- _tailcall: for(;;) {
1425
- {
1426
- const _1 = self_;
1427
- {
1428
- if(_1.Empty) {
1429
- return ff_core_Option.None()
1430
- return
1431
- }
1432
- }
1433
- {
1434
- if(_1.Link) {
1435
- const head_ = _1.head_;
1436
- const _guard1 = (await body_(head_, $task));
1437
- if(_guard1) {
1438
- return ff_core_Option.Some(head_)
1439
- return
1440
- }
1441
- }
1442
- }
1443
- {
1444
- if(_1.Link) {
1445
- const tail_ = _1.tail_;
1446
- {
1447
- const self_r_ = tail_;
1448
- const body_r_ = body_;
1449
- self_ = self_r_
1450
- body_ = body_r_
1451
- continue _tailcall
1452
- }
1453
- return
1454
- }
1455
- }
1456
- }
1457
- return
1458
- }
1459
- }
1460
-
1461
- export async function List_filter$(self_, body_, $task) {
1462
- async function go_$(list_, result_, $task) {
1463
- _tailcall: for(;;) {
1464
- {
1465
- const _1 = list_;
1466
- {
1467
- if(_1.Empty) {
1468
- return ff_core_List.List_reverse(result_)
1469
- return
1470
- }
1471
- }
1472
- {
1473
- if(_1.Link) {
1474
- const head_ = _1.head_;
1475
- const tail_ = _1.tail_;
1476
- const _guard1 = (await body_(head_, $task));
1477
- if(_guard1) {
1478
- {
1479
- const list_r_ = tail_;
1480
- const result_r_ = ff_core_List.Link(head_, result_);
1481
- list_ = list_r_
1482
- result_ = result_r_
1483
- continue _tailcall
1484
- }
1485
- return
1486
- }
1487
- }
1488
- }
1489
- {
1490
- if(_1.Link) {
1491
- const tail_ = _1.tail_;
1492
- {
1493
- const list_r_ = tail_;
1494
- const result_r_ = result_;
1495
- list_ = list_r_
1496
- result_ = result_r_
1497
- continue _tailcall
1498
- }
1499
- return
1500
- }
1501
- }
1502
- }
1503
- return
1504
- }
1505
- }
1506
- return (await go_$(self_, ff_core_List.Empty(), $task))
1507
- }
1508
-
1509
- export async function List_partition$(self_, body_, $task) {
1510
- return ff_core_Pair.Pair((await ff_core_List.List_filter$(self_, body_, $task)), (await ff_core_List.List_filter$(self_, (async (_w1, $task) => {
1511
- return (!(await body_(_w1, $task)))
1512
- }), $task)))
1513
- }
1514
-
1515
- export async function List_map$(self_, body_, $task) {
1516
- async function go_$(list_, result_, $task) {
1517
- _tailcall: for(;;) {
1518
- {
1519
- const _1 = list_;
1520
- {
1521
- if(_1.Empty) {
1522
- return ff_core_List.List_reverse(result_)
1523
- return
1524
- }
1525
- }
1526
- {
1527
- if(_1.Link) {
1528
- const head_ = _1.head_;
1529
- const tail_ = _1.tail_;
1530
- {
1531
- const list_r_ = tail_;
1532
- const result_r_ = ff_core_List.Link((await body_(head_, $task)), result_);
1533
- list_ = list_r_
1534
- result_ = result_r_
1535
- continue _tailcall
1536
- }
1537
- return
1538
- }
1539
- }
1540
- }
1541
- return
1542
- }
1543
- }
1544
- return (await go_$(self_, ff_core_List.Empty(), $task))
1545
- }
1546
-
1547
- export async function List_flatMap$(self_, body_, $task) {
1548
- async function go_$(list_, result_, $task) {
1549
- _tailcall: for(;;) {
1550
- {
1551
- const _1 = list_;
1552
- {
1553
- if(_1.Empty) {
1554
- return ff_core_List.List_flatten(ff_core_List.List_reverse(result_))
1555
- return
1556
- }
1557
- }
1558
- {
1559
- if(_1.Link) {
1560
- const head_ = _1.head_;
1561
- const tail_ = _1.tail_;
1562
- {
1563
- const list_r_ = tail_;
1564
- const result_r_ = ff_core_List.Link((await body_(head_, $task)), result_);
1565
- list_ = list_r_
1566
- result_ = result_r_
1567
- continue _tailcall
1568
- }
1569
- return
1570
- }
1571
- }
1572
- }
1573
- return
1574
- }
1575
- }
1576
- return (await go_$(self_, ff_core_List.Empty(), $task))
1577
- }
1578
-
1579
- export async function List_collect$(self_, body_, $task) {
1580
- return (await ff_core_Stream.Stream_toList$((await ff_core_Stream.Stream_collect$((await ff_core_List.List_toStream$(self_, false, $task)), body_, $task)), $task))
1581
- }
1582
-
1583
- export async function List_collectFirst$(self_, body_, $task) {
1584
- _tailcall: for(;;) {
1585
- {
1586
- const _1 = self_;
1587
- {
1588
- if(_1.Empty) {
1589
- return ff_core_Option.None()
1590
- return
1591
- }
1592
- }
1593
- {
1594
- if(_1.Link) {
1595
- const head_ = _1.head_;
1596
- const tail_ = _1.tail_;
1597
- {
1598
- const _1 = (await body_(head_, $task));
1599
- {
1600
- if(_1.None) {
1601
- {
1602
- const self_r_ = tail_;
1603
- const body_r_ = body_;
1604
- self_ = self_r_
1605
- body_ = body_r_
1606
- continue _tailcall
1607
- }
1608
- return
1609
- }
1610
- }
1611
- {
1612
- if(_1.Some) {
1613
- const value_ = _1.value_;
1614
- return ff_core_Option.Some(value_)
1615
- return
1616
- }
1617
- }
1618
- }
1619
- return
1620
- }
1621
- }
1622
- }
1623
- return
1624
- }
1625
- }
1626
-
1627
- export async function List_foldLeft$(self_, initial_, body_, $task) {
1628
- async function go_$(state_, list_, $task) {
1629
- _tailcall: for(;;) {
1630
- {
1631
- const _1 = list_;
1632
- {
1633
- if(_1.Empty) {
1634
- return state_
1635
- return
1636
- }
1637
- }
1638
- {
1639
- if(_1.Link) {
1640
- const head_ = _1.head_;
1641
- const tail_ = _1.tail_;
1642
- {
1643
- const state_r_ = (await body_(state_, head_, $task));
1644
- const list_r_ = tail_;
1645
- state_ = state_r_
1646
- list_ = list_r_
1647
- continue _tailcall
1648
- }
1649
- return
1650
- }
1651
- }
1652
- }
1653
- return
1654
- }
1655
- }
1656
- return (await go_$(initial_, self_, $task))
1657
- }
1658
-
1659
- export async function List_updated$(self_, index_, value_, $task) {
1660
- function go_(list_, i_, result_) {
1661
- _tailcall: for(;;) {
1662
- {
1663
- const _1 = list_;
1664
- {
1665
- if(_1.Empty) {
1666
- return ff_core_List.List_reverse(result_)
1667
- return
1668
- }
1669
- }
1670
- {
1671
- if(_1.Link) {
1672
- const head_ = _1.head_;
1673
- const tail_ = _1.tail_;
1674
- const _guard1 = (i_ === 0);
1675
- if(_guard1) {
1676
- {
1677
- const list_r_ = tail_;
1678
- const i_r_ = (i_ - 1);
1679
- const result_r_ = ff_core_List.Link(value_, result_);
1680
- list_ = list_r_
1681
- i_ = i_r_
1682
- result_ = result_r_
1683
- continue _tailcall
1684
- }
1685
- return
1686
- }
1687
- }
1688
- }
1689
- {
1690
- if(_1.Link) {
1691
- const head_ = _1.head_;
1692
- const tail_ = _1.tail_;
1693
- {
1694
- const list_r_ = tail_;
1695
- const i_r_ = (i_ - 1);
1696
- const result_r_ = ff_core_List.Link(head_, result_);
1697
- list_ = list_r_
1698
- i_ = i_r_
1699
- result_ = result_r_
1700
- continue _tailcall
1701
- }
1702
- return
1703
- }
1704
- }
1705
- }
1706
- return
1707
- }
1708
- }
1709
- return go_(self_, index_, ff_core_List.Empty())
1710
- }
1711
-
1712
- export async function List_modify$(self_, index_, body_, $task) {
1713
- async function go_$(list_, i_, result_, $task) {
1714
- _tailcall: for(;;) {
1715
- {
1716
- const _1 = list_;
1717
- {
1718
- if(_1.Empty) {
1719
- return ff_core_List.List_reverse(result_)
1720
- return
1721
- }
1722
- }
1723
- {
1724
- if(_1.Link) {
1725
- const head_ = _1.head_;
1726
- const tail_ = _1.tail_;
1727
- const _guard1 = (i_ === 0);
1728
- if(_guard1) {
1729
- {
1730
- const list_r_ = tail_;
1731
- const i_r_ = (i_ - 1);
1732
- const result_r_ = ff_core_List.Link((await body_(head_, $task)), result_);
1733
- list_ = list_r_
1734
- i_ = i_r_
1735
- result_ = result_r_
1736
- continue _tailcall
1737
- }
1738
- return
1739
- }
1740
- }
1741
- }
1742
- {
1743
- if(_1.Link) {
1744
- const head_ = _1.head_;
1745
- const tail_ = _1.tail_;
1746
- {
1747
- const list_r_ = tail_;
1748
- const i_r_ = (i_ - 1);
1749
- const result_r_ = ff_core_List.Link(head_, result_);
1750
- list_ = list_r_
1751
- i_ = i_r_
1752
- result_ = result_r_
1753
- continue _tailcall
1754
- }
1755
- return
1756
- }
1757
- }
1758
- }
1759
- return
1760
- }
1761
- }
1762
- return (await go_$(self_, index_, ff_core_List.Empty(), $task))
1763
- }
1764
-
1765
- export async function List_zip$(self_, that_, $task) {
1766
- function go_(list1_, list2_, result_) {
1767
- _tailcall: for(;;) {
1768
- {
1769
- const _1 = ff_core_Pair.Pair(list1_, list2_);
1770
- {
1771
- if(_1.first_.Link) {
1772
- const x_ = _1.first_.head_;
1773
- const xs_ = _1.first_.tail_;
1774
- if(_1.second_.Link) {
1775
- const y_ = _1.second_.head_;
1776
- const ys_ = _1.second_.tail_;
1777
- {
1778
- const list1_r_ = xs_;
1779
- const list2_r_ = ys_;
1780
- const result_r_ = ff_core_List.Link(ff_core_Pair.Pair(x_, y_), result_);
1781
- list1_ = list1_r_
1782
- list2_ = list2_r_
1783
- result_ = result_r_
1784
- continue _tailcall
1785
- }
1786
- return
1787
- }
1788
- }
1789
- }
1790
- {
1791
- return ff_core_List.List_reverse(result_)
1792
- return
1793
- }
1794
- }
1795
- return
1796
- }
1797
- }
1798
- return go_(self_, that_, ff_core_List.Empty())
1799
- }
1800
-
1801
- export async function List_sortBy$(self_, body_, ff_core_Ordering_Order$O, $task) {
1802
- if((ff_core_List.List_size(self_) <= 1)) {
1803
- return self_
1804
- } else {
1805
- const stack_ = ff_core_List.List_toStack(self_);
1806
- (await ff_core_Stack.Stack_sortBy$(stack_, body_, ff_core_Ordering_Order$O, $task));
1807
- return ff_core_Stack.Stack_toList(stack_, 0, 9007199254740991)
1808
- }
1809
- }
1810
-
1811
- export async function List_sortWith$(self_, compare_, $task) {
1812
- if((ff_core_List.List_size(self_) <= 1)) {
1813
- return self_
1814
- } else {
1815
- const stack_ = ff_core_List.List_toStack(self_);
1816
- (await ff_core_Stack.Stack_sortWith$(stack_, compare_, $task));
1817
- return ff_core_Stack.Stack_toList(stack_, 0, 9007199254740991)
1818
- }
1819
- }
1820
-
1821
- export async function List_reverse$(self_, $task) {
1822
- function go_(list_, result_) {
1823
- _tailcall: for(;;) {
1824
- {
1825
- const _1 = list_;
1826
- {
1827
- if(_1.Empty) {
1828
- return result_
1829
- return
1830
- }
1831
- }
1832
- {
1833
- if(_1.Link) {
1834
- const head_ = _1.head_;
1835
- const tail_ = _1.tail_;
1836
- {
1837
- const list_r_ = tail_;
1838
- const result_r_ = ff_core_List.Link(head_, result_);
1839
- list_ = list_r_
1840
- result_ = result_r_
1841
- continue _tailcall
1842
- }
1843
- return
1844
- }
1845
- }
1846
- }
1847
- return
1848
- }
1849
- }
1850
- return go_(self_, ff_core_List.Empty())
1851
- }
1852
-
1853
- export async function List_chunk$(self_, chunkSize_, $task) {
1854
- let results_ = ff_core_List.Empty();
1855
- let result_ = ff_core_List.Empty();
1856
- let added_ = 0;
1857
- ff_core_List.List_each(self_, ((item_) => {
1858
- if((added_ < chunkSize_)) {
1859
- result_ = ff_core_List.Link(item_, result_);
1860
- added_ += 1
1861
- } else {
1862
- results_ = ff_core_List.Link(ff_core_List.List_reverse(result_), results_);
1863
- result_ = ff_core_List.Link(item_, ff_core_List.Empty());
1864
- added_ = 1
1865
- }
1866
- }));
1867
- if((added_ !== 0)) {
1868
- results_ = ff_core_List.Link(ff_core_List.List_reverse(result_), results_)
1869
- };
1870
- return ff_core_List.List_reverse(results_)
1871
- }
1872
-
1873
- export async function List_toStream$(self_, cycle_ = false, $task) {
1874
- let remaining_ = self_;
1875
- return ff_core_Stream.Stream((async ($task) => {
1876
- {
1877
- const _1 = remaining_;
1878
- {
1879
- if(_1.Link) {
1880
- const head_ = _1.head_;
1881
- const tail_ = _1.tail_;
1882
- remaining_ = tail_;
1883
- return ff_core_Option.Some(head_)
1884
- return
1885
- }
1886
- }
1887
- {
1888
- if(_1.Empty) {
1889
- const _guard2 = self_;
1890
- if(_guard2.Link) {
1891
- const head_ = _guard2.head_;
1892
- const tail_ = _guard2.tail_;
1893
- const _guard1 = cycle_;
1894
- if(_guard1) {
1895
- remaining_ = tail_;
1896
- return ff_core_Option.Some(head_)
1897
- return
1898
- }
1899
- }
1900
- }
1901
- }
1902
- {
1903
- if(_1.Empty) {
1904
- return ff_core_Option.None()
1905
- return
1906
- }
1907
- }
1908
- }
1909
- }), (async ($task) => {
1910
- remaining_ = ff_core_List.Empty()
1911
- }))
1912
- }
1913
-
1914
- export async function List_insertBetween$(self_, separator_, $task) {
1915
- return ff_core_List.List_dropFirst(ff_core_List.List_flatMap(self_, ((e_) => {
1916
- return ff_core_List.List_addAll(separator_, ff_core_List.Link(e_, ff_core_List.Empty()))
1917
- })), ff_core_List.List_size(separator_))
1918
- }
1919
-
1920
- export function List_sort(self_, ff_core_Ordering_Order$T) {
1921
- if((ff_core_List.List_size(self_) <= 1)) {
1922
- return self_
1923
- } else {
1924
- const stack_ = ff_core_List.List_toStack(self_);
1925
- ff_core_Stack.Stack_sort(stack_, ff_core_Ordering_Order$T);
1926
- return ff_core_Stack.Stack_toList(stack_, 0, 9007199254740991)
1927
- }
1928
- }
1929
-
1930
- export function List_toSet(self_, ff_core_Ordering_Order$T) {
1931
- return ff_core_List.List_foldLeft(self_, ff_core_Set.empty_(), ((set_, value_) => {
1932
- return ff_core_Set.Set_add(set_, value_, ff_core_Ordering_Order$T)
1933
- }))
1934
- }
1935
-
1936
- export function List_distinct(self_, ff_core_Ordering_Order$T) {
1937
- let seen_ = ff_core_List.List_toSet(ff_core_List.Empty(), ff_core_Ordering_Order$T);
1938
- return ff_core_List.List_filter(self_, ((_1) => {
1939
- {
1940
- const item_ = _1;
1941
- const _guard1 = (!ff_core_Set.Set_contains(seen_, item_, ff_core_Ordering_Order$T));
1942
- if(_guard1) {
1943
- seen_ = ff_core_Set.Set_add(seen_, item_, ff_core_Ordering_Order$T);
1944
- return true
1945
- return
1946
- }
1947
- }
1948
- {
1949
- return false
1950
- return
1951
- }
1952
- }))
1953
- }
1954
-
1955
- export async function List_sort$(self_, ff_core_Ordering_Order$T, $task) {
1956
- if((ff_core_List.List_size(self_) <= 1)) {
1957
- return self_
1958
- } else {
1959
- const stack_ = ff_core_List.List_toStack(self_);
1960
- ff_core_Stack.Stack_sort(stack_, ff_core_Ordering_Order$T);
1961
- return ff_core_Stack.Stack_toList(stack_, 0, 9007199254740991)
1962
- }
1963
- }
1964
-
1965
- export async function List_toSet$(self_, ff_core_Ordering_Order$T, $task) {
1966
- return ff_core_List.List_foldLeft(self_, ff_core_Set.empty_(), ((set_, value_) => {
1967
- return ff_core_Set.Set_add(set_, value_, ff_core_Ordering_Order$T)
1968
- }))
1969
- }
1970
-
1971
- export async function List_distinct$(self_, ff_core_Ordering_Order$T, $task) {
1972
- let seen_ = ff_core_List.List_toSet(ff_core_List.Empty(), ff_core_Ordering_Order$T);
1973
- return ff_core_List.List_filter(self_, ((_1) => {
1974
- {
1975
- const item_ = _1;
1976
- const _guard1 = (!ff_core_Set.Set_contains(seen_, item_, ff_core_Ordering_Order$T));
1977
- if(_guard1) {
1978
- seen_ = ff_core_Set.Set_add(seen_, item_, ff_core_Ordering_Order$T);
1979
- return true
1980
- return
1981
- }
1982
- }
1983
- {
1984
- return false
1985
- return
1986
- }
1987
- }))
1988
- }
1989
-
1990
- export function List_show(self_, ff_core_Show_Show$T) {
1991
- return ff_core_Show.ff_core_Show_Show$ff_core_List_List(ff_core_Show_Show$T).show_(self_)
1992
- }
1993
-
1994
- export async function List_show$(self_, ff_core_Show_Show$T, $task) {
1995
- return ff_core_Show.ff_core_Show_Show$ff_core_List_List(ff_core_Show_Show$T).show_(self_)
1996
- }
1997
-
1998
- export function List_flatten(self_) {
1999
- function finish_(list_, result_) {
2000
- _tailcall: for(;;) {
2001
- {
2002
- const list_a = list_;
2003
- const result_a = result_;
2004
- {
2005
- const as_ = list_a;
2006
- if(result_a.Empty) {
2007
- return as_
2008
- return
2009
- }
2010
- }
2011
- {
2012
- const as_ = list_a;
2013
- if(result_a.Link) {
2014
- const x_ = result_a.head_;
2015
- const xs_ = result_a.tail_;
2016
- {
2017
- const list_r_ = ff_core_List.Link(x_, as_);
2018
- const result_r_ = xs_;
2019
- list_ = list_r_
2020
- result_ = result_r_
2021
- continue _tailcall
2022
- }
2023
- return
2024
- }
2025
- }
2026
- }
2027
- return
2028
- }
2029
- }
2030
- function go_(lists_, result_) {
2031
- _tailcall: for(;;) {
2032
- {
2033
- const _1 = lists_;
2034
- {
2035
- if(_1.Empty) {
2036
- return ff_core_List.Empty()
2037
- return
2038
- }
2039
- }
2040
- {
2041
- if(_1.Link) {
2042
- const as_ = _1.head_;
2043
- if(_1.tail_.Empty) {
2044
- return finish_(as_, result_)
2045
- return
2046
- }
2047
- }
2048
- }
2049
- {
2050
- if(_1.Link) {
2051
- if(_1.head_.Empty) {
2052
- const aas_ = _1.tail_;
2053
- {
2054
- const lists_r_ = aas_;
2055
- const result_r_ = result_;
2056
- lists_ = lists_r_
2057
- result_ = result_r_
2058
- continue _tailcall
2059
- }
2060
- return
2061
- }
2062
- }
2063
- }
2064
- {
2065
- if(_1.Link) {
2066
- if(_1.head_.Link) {
2067
- const a_ = _1.head_.head_;
2068
- const as_ = _1.head_.tail_;
2069
- const aas_ = _1.tail_;
2070
- {
2071
- const lists_r_ = ff_core_List.Link(as_, aas_);
2072
- const result_r_ = ff_core_List.Link(a_, result_);
2073
- lists_ = lists_r_
2074
- result_ = result_r_
2075
- continue _tailcall
2076
- }
2077
- return
2078
- }
2079
- }
2080
- }
2081
- }
2082
- return
2083
- }
2084
- }
2085
- return go_(self_, ff_core_List.Empty())
2086
- }
2087
-
2088
- export async function List_flatten$(self_, $task) {
2089
- function finish_(list_, result_) {
2090
- _tailcall: for(;;) {
2091
- {
2092
- const list_a = list_;
2093
- const result_a = result_;
2094
- {
2095
- const as_ = list_a;
2096
- if(result_a.Empty) {
2097
- return as_
2098
- return
2099
- }
2100
- }
2101
- {
2102
- const as_ = list_a;
2103
- if(result_a.Link) {
2104
- const x_ = result_a.head_;
2105
- const xs_ = result_a.tail_;
2106
- {
2107
- const list_r_ = ff_core_List.Link(x_, as_);
2108
- const result_r_ = xs_;
2109
- list_ = list_r_
2110
- result_ = result_r_
2111
- continue _tailcall
2112
- }
2113
- return
2114
- }
2115
- }
2116
- }
2117
- return
2118
- }
2119
- }
2120
- function go_(lists_, result_) {
2121
- _tailcall: for(;;) {
2122
- {
2123
- const _1 = lists_;
2124
- {
2125
- if(_1.Empty) {
2126
- return ff_core_List.Empty()
2127
- return
2128
- }
2129
- }
2130
- {
2131
- if(_1.Link) {
2132
- const as_ = _1.head_;
2133
- if(_1.tail_.Empty) {
2134
- return finish_(as_, result_)
2135
- return
2136
- }
2137
- }
2138
- }
2139
- {
2140
- if(_1.Link) {
2141
- if(_1.head_.Empty) {
2142
- const aas_ = _1.tail_;
2143
- {
2144
- const lists_r_ = aas_;
2145
- const result_r_ = result_;
2146
- lists_ = lists_r_
2147
- result_ = result_r_
2148
- continue _tailcall
2149
- }
2150
- return
2151
- }
2152
- }
2153
- }
2154
- {
2155
- if(_1.Link) {
2156
- if(_1.head_.Link) {
2157
- const a_ = _1.head_.head_;
2158
- const as_ = _1.head_.tail_;
2159
- const aas_ = _1.tail_;
2160
- {
2161
- const lists_r_ = ff_core_List.Link(as_, aas_);
2162
- const result_r_ = ff_core_List.Link(a_, result_);
2163
- lists_ = lists_r_
2164
- result_ = result_r_
2165
- continue _tailcall
2166
- }
2167
- return
2168
- }
2169
- }
2170
- }
2171
- }
2172
- return
2173
- }
2174
- }
2175
- return go_(self_, ff_core_List.Empty())
2176
- }
2177
-
2178
- export function List_toMap(self_, ff_core_Ordering_Order$K) {
2179
- return ff_core_List.List_foldLeft(self_, ff_core_Map.empty_(), ((map_, pair_) => {
2180
- return ff_core_Map.Map_add(map_, pair_.first_, pair_.second_, ff_core_Ordering_Order$K)
2181
- }))
2182
- }
2183
-
2184
- export function List_group(self_, ff_core_Ordering_Order$K) {
2185
- const initial_ = ff_core_List.Empty();
2186
- return ff_core_List.List_foldLeft(self_, ff_core_List.List_toMap(initial_, ff_core_Ordering_Order$K), ((map_, pair_) => {
2187
- return ff_core_Map.Map_addToList(map_, pair_.first_, pair_.second_, ff_core_Ordering_Order$K)
2188
- }))
2189
- }
2190
-
2191
- export async function List_toMap$(self_, ff_core_Ordering_Order$K, $task) {
2192
- return ff_core_List.List_foldLeft(self_, ff_core_Map.empty_(), ((map_, pair_) => {
2193
- return ff_core_Map.Map_add(map_, pair_.first_, pair_.second_, ff_core_Ordering_Order$K)
2194
- }))
2195
- }
2196
-
2197
- export async function List_group$(self_, ff_core_Ordering_Order$K, $task) {
2198
- const initial_ = ff_core_List.Empty();
2199
- return ff_core_List.List_foldLeft(self_, ff_core_List.List_toMap(initial_, ff_core_Ordering_Order$K), ((map_, pair_) => {
2200
- return ff_core_Map.Map_addToList(map_, pair_.first_, pair_.second_, ff_core_Ordering_Order$K)
2201
- }))
2202
- }
2203
-
2204
- export function List_unzip(self_) {
2205
- function go_(pairs_, ks_, vs_) {
2206
- _tailcall: for(;;) {
2207
- {
2208
- const _1 = pairs_;
2209
- {
2210
- if(_1.Empty) {
2211
- return ff_core_Pair.Pair(ff_core_List.List_reverse(ks_), ff_core_List.List_reverse(vs_))
2212
- return
2213
- }
2214
- }
2215
- {
2216
- if(_1.Link) {
2217
- const k_ = _1.head_.first_;
2218
- const v_ = _1.head_.second_;
2219
- const tail_ = _1.tail_;
2220
- {
2221
- const pairs_r_ = tail_;
2222
- const ks_r_ = ff_core_List.Link(k_, ks_);
2223
- const vs_r_ = ff_core_List.Link(v_, vs_);
2224
- pairs_ = pairs_r_
2225
- ks_ = ks_r_
2226
- vs_ = vs_r_
2227
- continue _tailcall
2228
- }
2229
- return
2230
- }
2231
- }
2232
- }
2233
- return
2234
- }
2235
- }
2236
- return go_(self_, ff_core_List.Empty(), ff_core_List.Empty())
2237
- }
2238
-
2239
- export async function List_unzip$(self_, $task) {
2240
- function go_(pairs_, ks_, vs_) {
2241
- _tailcall: for(;;) {
2242
- {
2243
- const _1 = pairs_;
2244
- {
2245
- if(_1.Empty) {
2246
- return ff_core_Pair.Pair(ff_core_List.List_reverse(ks_), ff_core_List.List_reverse(vs_))
2247
- return
2248
- }
2249
- }
2250
- {
2251
- if(_1.Link) {
2252
- const k_ = _1.head_.first_;
2253
- const v_ = _1.head_.second_;
2254
- const tail_ = _1.tail_;
2255
- {
2256
- const pairs_r_ = tail_;
2257
- const ks_r_ = ff_core_List.Link(k_, ks_);
2258
- const vs_r_ = ff_core_List.Link(v_, vs_);
2259
- pairs_ = pairs_r_
2260
- ks_ = ks_r_
2261
- vs_ = vs_r_
2262
- continue _tailcall
2263
- }
2264
- return
2265
- }
2266
- }
2267
- }
2268
- return
2269
- }
2270
- }
2271
- return go_(self_, ff_core_List.Empty(), ff_core_List.Empty())
2272
- }
2273
-
2274
- export function List_join(self_, separator_ = "") {
2275
- return ff_core_Array.Array_join(ff_core_List.List_toArray(self_), separator_)
2276
- }
2277
-
2278
- export async function List_join$(self_, separator_ = "", $task) {
2279
- return ff_core_Array.Array_join(ff_core_List.List_toArray(self_), separator_)
2280
- }
2281
-
2282
- export function ff_core_Any_HasAnyTag$ff_core_List_List(ff_core_Any_HasAnyTag$T) { return {
2283
- anyTag_() {
2284
- return ff_core_Any.internalAnyTag_(((("ff:core/List.List" + "[") + ff_core_Any.AnyTag_show(ff_core_Any_HasAnyTag$T.anyTag_())) + "]"))
2285
- },
2286
- async anyTag_$($task) {
2287
- return ff_core_Any.internalAnyTag_(((("ff:core/List.List" + "[") + ff_core_Any.AnyTag_show(ff_core_Any_HasAnyTag$T.anyTag_())) + "]"))
2288
- }
2289
- }}
2290
-
2291
- export function ff_core_Equal_Equal$ff_core_List_List(ff_core_Equal_Equal$T) { return {
2292
- equals_(x_, y_) {
2293
- {
2294
- const x_a = x_;
2295
- const y_a = y_;
2296
- {
2297
- const _guard1 = (x_ === y_);
2298
- if(_guard1) {
2299
- return true
2300
- return
2301
- }
2302
- }
2303
- {
2304
- if(x_a.Link) {
2305
- const x_ = x_a;
2306
- if(y_a.Link) {
2307
- const y_ = y_a;
2308
- return (ff_core_Equal_Equal$T.equals_(x_.head_, y_.head_) && ff_core_List.ff_core_Equal_Equal$ff_core_List_List(ff_core_Equal_Equal$T).equals_(x_.tail_, y_.tail_))
2309
- return
2310
- }
2311
- }
2312
- }
2313
- {
2314
- return false
2315
- return
2316
- }
2317
- }
2318
- },
2319
- async equals_$(x_, y_, $task) {
2320
- {
2321
- const x_a = x_;
2322
- const y_a = y_;
2323
- {
2324
- const _guard1 = (x_ === y_);
2325
- if(_guard1) {
2326
- return true
2327
- return
2328
- }
2329
- }
2330
- {
2331
- if(x_a.Link) {
2332
- const x_ = x_a;
2333
- if(y_a.Link) {
2334
- const y_ = y_a;
2335
- return (ff_core_Equal_Equal$T.equals_(x_.head_, y_.head_) && ff_core_List.ff_core_Equal_Equal$ff_core_List_List(ff_core_Equal_Equal$T).equals_(x_.tail_, y_.tail_))
2336
- return
2337
- }
2338
- }
2339
- }
2340
- {
2341
- return false
2342
- return
2343
- }
2344
- }
2345
- }
2346
- }}
2347
-
2348
-
197
+
198
+ }
199
+
200
+ export function List_toArray(self_) {
201
+ return ff_core_Stack.Stack_drain(ff_core_List.List_toStack(self_))
202
+ }
203
+
204
+ export function List_grab(self_, index_) {
205
+ function go_(list_, i_) {
206
+ _tailcall: for(;;) {
207
+ {
208
+ const _1 = list_;
209
+ {
210
+ if(_1.Empty) {
211
+ return ff_core_Try.internalThrowGrabException_()
212
+ return
213
+ }
214
+ }
215
+ {
216
+ if(_1.Link) {
217
+ const head_ = _1.head_;
218
+ const _guard1 = (i_ === 0);
219
+ if(_guard1) {
220
+ return head_
221
+ return
222
+ }
223
+ }
224
+ }
225
+ {
226
+ if(_1.Link) {
227
+ const tail_ = _1.tail_;
228
+ {
229
+ const list_r_ = tail_;
230
+ const i_r_ = (i_ - 1);
231
+ list_ = list_r_
232
+ i_ = i_r_
233
+ continue _tailcall
234
+ }
235
+ return
236
+ }
237
+ }
238
+ }
239
+ return
240
+ }
241
+ }
242
+ return go_(self_, index_)
243
+ }
244
+
245
+ export function List_first(self_) {
246
+ {
247
+ const _1 = self_;
248
+ {
249
+ if(_1.Empty) {
250
+ return ff_core_Option.None()
251
+ return
252
+ }
253
+ }
254
+ {
255
+ if(_1.Link) {
256
+ const head_ = _1.head_;
257
+ return ff_core_Option.Some(head_)
258
+ return
259
+ }
260
+ }
261
+ }
262
+ }
263
+
264
+ export function List_last(self_) {
265
+ _tailcall: for(;;) {
266
+ {
267
+ const _1 = self_;
268
+ {
269
+ if(_1.Empty) {
270
+ return ff_core_Option.None()
271
+ return
272
+ }
273
+ }
274
+ {
275
+ if(_1.Link) {
276
+ const head_ = _1.head_;
277
+ if(_1.tail_.Empty) {
278
+ return ff_core_Option.Some(head_)
279
+ return
280
+ }
281
+ }
282
+ }
283
+ {
284
+ if(_1.Link) {
285
+ const tail_ = _1.tail_;
286
+ {
287
+ const self_r_ = tail_;
288
+ self_ = self_r_
289
+ continue _tailcall
290
+ }
291
+ return
292
+ }
293
+ }
294
+ }
295
+ return
296
+ }
297
+ }
298
+
299
+ export function List_grabFirst(self_) {
300
+ return ff_core_Option.Option_else(ff_core_List.List_first(self_), (() => {
301
+ return ff_core_Try.internalThrowGrabException_()
302
+ }))
303
+ }
304
+
305
+ export function List_grabLast(self_) {
306
+ return ff_core_Option.Option_else(ff_core_List.List_last(self_), (() => {
307
+ return ff_core_Try.internalThrowGrabException_()
308
+ }))
309
+ }
310
+
311
+ export function List_dropFirst(self_, count_ = 1) {
312
+ _tailcall: for(;;) {
313
+ {
314
+ const _1 = self_;
315
+ {
316
+ const _guard1 = (count_ <= 0);
317
+ if(_guard1) {
318
+ return self_
319
+ return
320
+ }
321
+ }
322
+ {
323
+ if(_1.Empty) {
324
+ return self_
325
+ return
326
+ }
327
+ }
328
+ {
329
+ if(_1.Link) {
330
+ const tail_ = _1.tail_;
331
+ {
332
+ const self_r_ = tail_;
333
+ const count_r_ = (count_ - 1);
334
+ self_ = self_r_
335
+ count_ = count_r_
336
+ continue _tailcall
337
+ }
338
+ return
339
+ }
340
+ }
341
+ }
342
+ return
343
+ }
344
+ }
345
+
346
+ export function List_dropLast(self_, count_ = 1) {
347
+ return ff_core_List.List_reverse(ff_core_List.List_dropFirst(ff_core_List.List_reverse(self_), count_))
348
+ }
349
+
350
+ export function List_takeFirst(self_, count_ = 1) {
351
+ function go_(list_, count_, result_) {
352
+ _tailcall: for(;;) {
353
+ {
354
+ const _1 = list_;
355
+ {
356
+ const _guard1 = (count_ <= 0);
357
+ if(_guard1) {
358
+ return ff_core_List.List_reverse(result_)
359
+ return
360
+ }
361
+ }
362
+ {
363
+ if(_1.Empty) {
364
+ return ff_core_List.List_reverse(result_)
365
+ return
366
+ }
367
+ }
368
+ {
369
+ if(_1.Link) {
370
+ const head_ = _1.head_;
371
+ const tail_ = _1.tail_;
372
+ {
373
+ const list_r_ = tail_;
374
+ const count_r_ = (count_ - 1);
375
+ const result_r_ = ff_core_List.Link(head_, result_);
376
+ list_ = list_r_
377
+ count_ = count_r_
378
+ result_ = result_r_
379
+ continue _tailcall
380
+ }
381
+ return
382
+ }
383
+ }
384
+ }
385
+ return
386
+ }
387
+ }
388
+ return go_(self_, count_, ff_core_List.Empty())
389
+ }
390
+
391
+ export function List_takeLast(self_, count_ = 1) {
392
+ return ff_core_List.List_reverse(ff_core_List.List_takeFirst(ff_core_List.List_reverse(self_), count_))
393
+ }
394
+
395
+ export function List_pairs(self_) {
396
+ let i_ = 0;
397
+ return ff_core_List.List_map(self_, ((x_) => {
398
+ const r_ = ff_core_Pair.Pair(i_, x_);
399
+ i_ += 1;
400
+ return r_
401
+ }))
402
+ }
403
+
404
+ export function List_slice(self_, from_, until_) {
405
+ return ff_core_List.List_takeFirst(ff_core_List.List_dropFirst(self_, from_), (until_ - from_))
406
+ }
407
+
408
+ export function List_isEmpty(self_) {
409
+ {
410
+ const _1 = self_;
411
+ {
412
+ if(_1.Empty) {
413
+ return true
414
+ return
415
+ }
416
+ }
417
+ {
418
+ return false
419
+ return
420
+ }
421
+ }
422
+ }
423
+
424
+ export function List_size(self_) {
425
+ function go_(list_, result_) {
426
+ _tailcall: for(;;) {
427
+ {
428
+ const _1 = list_;
429
+ {
430
+ if(_1.Empty) {
431
+ return result_
432
+ return
433
+ }
434
+ }
435
+ {
436
+ if(_1.Link) {
437
+ const tail_ = _1.tail_;
438
+ {
439
+ const list_r_ = tail_;
440
+ const result_r_ = (result_ + 1);
441
+ list_ = list_r_
442
+ result_ = result_r_
443
+ continue _tailcall
444
+ }
445
+ return
446
+ }
447
+ }
448
+ }
449
+ return
450
+ }
451
+ }
452
+ return go_(self_, 0)
453
+ }
454
+
455
+ export function List_each(self_, body_) {
456
+ _tailcall: for(;;) {
457
+ {
458
+ const _1 = self_;
459
+ {
460
+ if(_1.Empty) {
461
+
462
+ return
463
+ }
464
+ }
465
+ {
466
+ if(_1.Link) {
467
+ const head_ = _1.head_;
468
+ const tail_ = _1.tail_;
469
+ body_(head_);
470
+ {
471
+ const self_r_ = tail_;
472
+ const body_r_ = body_;
473
+ self_ = self_r_
474
+ body_ = body_r_
475
+ continue _tailcall
476
+ }
477
+ return
478
+ }
479
+ }
480
+ }
481
+ return
482
+ }
483
+ }
484
+
485
+ export function List_eachWhile(self_, body_) {
486
+ return ff_core_List.List_all(self_, body_)
487
+ }
488
+
489
+ export function List_all(self_, body_) {
490
+ _tailcall: for(;;) {
491
+ {
492
+ const _1 = self_;
493
+ {
494
+ if(_1.Empty) {
495
+ return true
496
+ return
497
+ }
498
+ }
499
+ {
500
+ if(_1.Link) {
501
+ const head_ = _1.head_;
502
+ const _guard1 = (!body_(head_));
503
+ if(_guard1) {
504
+ return false
505
+ return
506
+ }
507
+ }
508
+ }
509
+ {
510
+ if(_1.Link) {
511
+ const tail_ = _1.tail_;
512
+ {
513
+ const self_r_ = tail_;
514
+ const body_r_ = body_;
515
+ self_ = self_r_
516
+ body_ = body_r_
517
+ continue _tailcall
518
+ }
519
+ return
520
+ }
521
+ }
522
+ }
523
+ return
524
+ }
525
+ }
526
+
527
+ export function List_any(self_, body_) {
528
+ _tailcall: for(;;) {
529
+ {
530
+ const _1 = self_;
531
+ {
532
+ if(_1.Empty) {
533
+ return false
534
+ return
535
+ }
536
+ }
537
+ {
538
+ if(_1.Link) {
539
+ const head_ = _1.head_;
540
+ const _guard1 = body_(head_);
541
+ if(_guard1) {
542
+ return true
543
+ return
544
+ }
545
+ }
546
+ }
547
+ {
548
+ if(_1.Link) {
549
+ const tail_ = _1.tail_;
550
+ {
551
+ const self_r_ = tail_;
552
+ const body_r_ = body_;
553
+ self_ = self_r_
554
+ body_ = body_r_
555
+ continue _tailcall
556
+ }
557
+ return
558
+ }
559
+ }
560
+ }
561
+ return
562
+ }
563
+ }
564
+
565
+ export function List_find(self_, body_) {
566
+ _tailcall: for(;;) {
567
+ {
568
+ const _1 = self_;
569
+ {
570
+ if(_1.Empty) {
571
+ return ff_core_Option.None()
572
+ return
573
+ }
574
+ }
575
+ {
576
+ if(_1.Link) {
577
+ const head_ = _1.head_;
578
+ const _guard1 = body_(head_);
579
+ if(_guard1) {
580
+ return ff_core_Option.Some(head_)
581
+ return
582
+ }
583
+ }
584
+ }
585
+ {
586
+ if(_1.Link) {
587
+ const tail_ = _1.tail_;
588
+ {
589
+ const self_r_ = tail_;
590
+ const body_r_ = body_;
591
+ self_ = self_r_
592
+ body_ = body_r_
593
+ continue _tailcall
594
+ }
595
+ return
596
+ }
597
+ }
598
+ }
599
+ return
600
+ }
601
+ }
602
+
603
+ export function List_filter(self_, body_) {
604
+ function go_(list_, result_) {
605
+ _tailcall: for(;;) {
606
+ {
607
+ const _1 = list_;
608
+ {
609
+ if(_1.Empty) {
610
+ return ff_core_List.List_reverse(result_)
611
+ return
612
+ }
613
+ }
614
+ {
615
+ if(_1.Link) {
616
+ const head_ = _1.head_;
617
+ const tail_ = _1.tail_;
618
+ const _guard1 = body_(head_);
619
+ if(_guard1) {
620
+ {
621
+ const list_r_ = tail_;
622
+ const result_r_ = ff_core_List.Link(head_, result_);
623
+ list_ = list_r_
624
+ result_ = result_r_
625
+ continue _tailcall
626
+ }
627
+ return
628
+ }
629
+ }
630
+ }
631
+ {
632
+ if(_1.Link) {
633
+ const tail_ = _1.tail_;
634
+ {
635
+ const list_r_ = tail_;
636
+ const result_r_ = result_;
637
+ list_ = list_r_
638
+ result_ = result_r_
639
+ continue _tailcall
640
+ }
641
+ return
642
+ }
643
+ }
644
+ }
645
+ return
646
+ }
647
+ }
648
+ return go_(self_, ff_core_List.Empty())
649
+ }
650
+
651
+ export function List_partition(self_, body_) {
652
+ return ff_core_Pair.Pair(ff_core_List.List_filter(self_, body_), ff_core_List.List_filter(self_, ((_w1) => {
653
+ return (!body_(_w1))
654
+ })))
655
+ }
656
+
657
+ export function List_map(self_, body_) {
658
+ function go_(list_, result_) {
659
+ _tailcall: for(;;) {
660
+ {
661
+ const _1 = list_;
662
+ {
663
+ if(_1.Empty) {
664
+ return ff_core_List.List_reverse(result_)
665
+ return
666
+ }
667
+ }
668
+ {
669
+ if(_1.Link) {
670
+ const head_ = _1.head_;
671
+ const tail_ = _1.tail_;
672
+ {
673
+ const list_r_ = tail_;
674
+ const result_r_ = ff_core_List.Link(body_(head_), result_);
675
+ list_ = list_r_
676
+ result_ = result_r_
677
+ continue _tailcall
678
+ }
679
+ return
680
+ }
681
+ }
682
+ }
683
+ return
684
+ }
685
+ }
686
+ return go_(self_, ff_core_List.Empty())
687
+ }
688
+
689
+ export function List_flatMap(self_, body_) {
690
+ function go_(list_, result_) {
691
+ _tailcall: for(;;) {
692
+ {
693
+ const _1 = list_;
694
+ {
695
+ if(_1.Empty) {
696
+ return ff_core_List.List_flatten(ff_core_List.List_reverse(result_))
697
+ return
698
+ }
699
+ }
700
+ {
701
+ if(_1.Link) {
702
+ const head_ = _1.head_;
703
+ const tail_ = _1.tail_;
704
+ {
705
+ const list_r_ = tail_;
706
+ const result_r_ = ff_core_List.Link(body_(head_), result_);
707
+ list_ = list_r_
708
+ result_ = result_r_
709
+ continue _tailcall
710
+ }
711
+ return
712
+ }
713
+ }
714
+ }
715
+ return
716
+ }
717
+ }
718
+ return go_(self_, ff_core_List.Empty())
719
+ }
720
+
721
+ export function List_collect(self_, body_) {
722
+ return ff_core_Stream.Stream_toList(ff_core_Stream.Stream_collect(ff_core_List.List_toStream(self_, false), body_))
723
+ }
724
+
725
+ export function List_collectFirst(self_, body_) {
726
+ _tailcall: for(;;) {
727
+ {
728
+ const _1 = self_;
729
+ {
730
+ if(_1.Empty) {
731
+ return ff_core_Option.None()
732
+ return
733
+ }
734
+ }
735
+ {
736
+ if(_1.Link) {
737
+ const head_ = _1.head_;
738
+ const tail_ = _1.tail_;
739
+ {
740
+ const _1 = body_(head_);
741
+ {
742
+ if(_1.None) {
743
+ {
744
+ const self_r_ = tail_;
745
+ const body_r_ = body_;
746
+ self_ = self_r_
747
+ body_ = body_r_
748
+ continue _tailcall
749
+ }
750
+ return
751
+ }
752
+ }
753
+ {
754
+ if(_1.Some) {
755
+ const value_ = _1.value_;
756
+ return ff_core_Option.Some(value_)
757
+ return
758
+ }
759
+ }
760
+ }
761
+ return
762
+ }
763
+ }
764
+ }
765
+ return
766
+ }
767
+ }
768
+
769
+ export function List_foldLeft(self_, initial_, body_) {
770
+ function go_(state_, list_) {
771
+ _tailcall: for(;;) {
772
+ {
773
+ const _1 = list_;
774
+ {
775
+ if(_1.Empty) {
776
+ return state_
777
+ return
778
+ }
779
+ }
780
+ {
781
+ if(_1.Link) {
782
+ const head_ = _1.head_;
783
+ const tail_ = _1.tail_;
784
+ {
785
+ const state_r_ = body_(state_, head_);
786
+ const list_r_ = tail_;
787
+ state_ = state_r_
788
+ list_ = list_r_
789
+ continue _tailcall
790
+ }
791
+ return
792
+ }
793
+ }
794
+ }
795
+ return
796
+ }
797
+ }
798
+ return go_(initial_, self_)
799
+ }
800
+
801
+ export function List_updated(self_, index_, value_) {
802
+ function go_(list_, i_, result_) {
803
+ _tailcall: for(;;) {
804
+ {
805
+ const _1 = list_;
806
+ {
807
+ if(_1.Empty) {
808
+ return ff_core_List.List_reverse(result_)
809
+ return
810
+ }
811
+ }
812
+ {
813
+ if(_1.Link) {
814
+ const head_ = _1.head_;
815
+ const tail_ = _1.tail_;
816
+ const _guard1 = (i_ === 0);
817
+ if(_guard1) {
818
+ {
819
+ const list_r_ = tail_;
820
+ const i_r_ = (i_ - 1);
821
+ const result_r_ = ff_core_List.Link(value_, result_);
822
+ list_ = list_r_
823
+ i_ = i_r_
824
+ result_ = result_r_
825
+ continue _tailcall
826
+ }
827
+ return
828
+ }
829
+ }
830
+ }
831
+ {
832
+ if(_1.Link) {
833
+ const head_ = _1.head_;
834
+ const tail_ = _1.tail_;
835
+ {
836
+ const list_r_ = tail_;
837
+ const i_r_ = (i_ - 1);
838
+ const result_r_ = ff_core_List.Link(head_, result_);
839
+ list_ = list_r_
840
+ i_ = i_r_
841
+ result_ = result_r_
842
+ continue _tailcall
843
+ }
844
+ return
845
+ }
846
+ }
847
+ }
848
+ return
849
+ }
850
+ }
851
+ return go_(self_, index_, ff_core_List.Empty())
852
+ }
853
+
854
+ export function List_modify(self_, index_, body_) {
855
+ function go_(list_, i_, result_) {
856
+ _tailcall: for(;;) {
857
+ {
858
+ const _1 = list_;
859
+ {
860
+ if(_1.Empty) {
861
+ return ff_core_List.List_reverse(result_)
862
+ return
863
+ }
864
+ }
865
+ {
866
+ if(_1.Link) {
867
+ const head_ = _1.head_;
868
+ const tail_ = _1.tail_;
869
+ const _guard1 = (i_ === 0);
870
+ if(_guard1) {
871
+ {
872
+ const list_r_ = tail_;
873
+ const i_r_ = (i_ - 1);
874
+ const result_r_ = ff_core_List.Link(body_(head_), result_);
875
+ list_ = list_r_
876
+ i_ = i_r_
877
+ result_ = result_r_
878
+ continue _tailcall
879
+ }
880
+ return
881
+ }
882
+ }
883
+ }
884
+ {
885
+ if(_1.Link) {
886
+ const head_ = _1.head_;
887
+ const tail_ = _1.tail_;
888
+ {
889
+ const list_r_ = tail_;
890
+ const i_r_ = (i_ - 1);
891
+ const result_r_ = ff_core_List.Link(head_, result_);
892
+ list_ = list_r_
893
+ i_ = i_r_
894
+ result_ = result_r_
895
+ continue _tailcall
896
+ }
897
+ return
898
+ }
899
+ }
900
+ }
901
+ return
902
+ }
903
+ }
904
+ return go_(self_, index_, ff_core_List.Empty())
905
+ }
906
+
907
+ export function List_zip(self_, that_) {
908
+ function go_(list1_, list2_, result_) {
909
+ _tailcall: for(;;) {
910
+ {
911
+ const _1 = ff_core_Pair.Pair(list1_, list2_);
912
+ {
913
+ if(_1.first_.Link) {
914
+ const x_ = _1.first_.head_;
915
+ const xs_ = _1.first_.tail_;
916
+ if(_1.second_.Link) {
917
+ const y_ = _1.second_.head_;
918
+ const ys_ = _1.second_.tail_;
919
+ {
920
+ const list1_r_ = xs_;
921
+ const list2_r_ = ys_;
922
+ const result_r_ = ff_core_List.Link(ff_core_Pair.Pair(x_, y_), result_);
923
+ list1_ = list1_r_
924
+ list2_ = list2_r_
925
+ result_ = result_r_
926
+ continue _tailcall
927
+ }
928
+ return
929
+ }
930
+ }
931
+ }
932
+ {
933
+ return ff_core_List.List_reverse(result_)
934
+ return
935
+ }
936
+ }
937
+ return
938
+ }
939
+ }
940
+ return go_(self_, that_, ff_core_List.Empty())
941
+ }
942
+
943
+ export function List_sortBy(self_, body_, ff_core_Ordering_Order$O) {
944
+ if((ff_core_List.List_size(self_) <= 1)) {
945
+ return self_
946
+ } else {
947
+ const stack_ = ff_core_List.List_toStack(self_);
948
+ ff_core_Stack.Stack_sortBy(stack_, body_, ff_core_Ordering_Order$O);
949
+ return ff_core_Stack.Stack_toList(stack_, 0, 9007199254740991)
950
+ }
951
+ }
952
+
953
+ export function List_sortWith(self_, compare_) {
954
+ if((ff_core_List.List_size(self_) <= 1)) {
955
+ return self_
956
+ } else {
957
+ const stack_ = ff_core_List.List_toStack(self_);
958
+ ff_core_Stack.Stack_sortWith(stack_, compare_);
959
+ return ff_core_Stack.Stack_toList(stack_, 0, 9007199254740991)
960
+ }
961
+ }
962
+
963
+ export function List_reverse(self_) {
964
+ function go_(list_, result_) {
965
+ _tailcall: for(;;) {
966
+ {
967
+ const _1 = list_;
968
+ {
969
+ if(_1.Empty) {
970
+ return result_
971
+ return
972
+ }
973
+ }
974
+ {
975
+ if(_1.Link) {
976
+ const head_ = _1.head_;
977
+ const tail_ = _1.tail_;
978
+ {
979
+ const list_r_ = tail_;
980
+ const result_r_ = ff_core_List.Link(head_, result_);
981
+ list_ = list_r_
982
+ result_ = result_r_
983
+ continue _tailcall
984
+ }
985
+ return
986
+ }
987
+ }
988
+ }
989
+ return
990
+ }
991
+ }
992
+ return go_(self_, ff_core_List.Empty())
993
+ }
994
+
995
+ export function List_chunk(self_, chunkSize_) {
996
+ let results_ = ff_core_List.Empty();
997
+ let result_ = ff_core_List.Empty();
998
+ let added_ = 0;
999
+ ff_core_List.List_each(self_, ((item_) => {
1000
+ if((added_ < chunkSize_)) {
1001
+ result_ = ff_core_List.Link(item_, result_);
1002
+ added_ += 1
1003
+ } else {
1004
+ results_ = ff_core_List.Link(ff_core_List.List_reverse(result_), results_);
1005
+ result_ = ff_core_List.Link(item_, ff_core_List.Empty());
1006
+ added_ = 1
1007
+ }
1008
+ }));
1009
+ if((added_ !== 0)) {
1010
+ results_ = ff_core_List.Link(ff_core_List.List_reverse(result_), results_)
1011
+ };
1012
+ return ff_core_List.List_reverse(results_)
1013
+ }
1014
+
1015
+ export function List_toStream(self_, cycle_ = false) {
1016
+ let remaining_ = self_;
1017
+ return ff_core_Stream.Stream((() => {
1018
+ {
1019
+ const _1 = remaining_;
1020
+ {
1021
+ if(_1.Link) {
1022
+ const head_ = _1.head_;
1023
+ const tail_ = _1.tail_;
1024
+ remaining_ = tail_;
1025
+ return ff_core_Option.Some(head_)
1026
+ return
1027
+ }
1028
+ }
1029
+ {
1030
+ if(_1.Empty) {
1031
+ const _guard2 = self_;
1032
+ if(_guard2.Link) {
1033
+ const head_ = _guard2.head_;
1034
+ const tail_ = _guard2.tail_;
1035
+ const _guard1 = cycle_;
1036
+ if(_guard1) {
1037
+ remaining_ = tail_;
1038
+ return ff_core_Option.Some(head_)
1039
+ return
1040
+ }
1041
+ }
1042
+ }
1043
+ }
1044
+ {
1045
+ if(_1.Empty) {
1046
+ return ff_core_Option.None()
1047
+ return
1048
+ }
1049
+ }
1050
+ }
1051
+ }), (() => {
1052
+ remaining_ = ff_core_List.Empty()
1053
+ }))
1054
+ }
1055
+
1056
+ export function List_insertBetween(self_, separator_) {
1057
+ return ff_core_List.List_dropFirst(ff_core_List.List_flatMap(self_, ((e_) => {
1058
+ return ff_core_List.List_addAll(separator_, ff_core_List.Link(e_, ff_core_List.Empty()))
1059
+ })), ff_core_List.List_size(separator_))
1060
+ }
1061
+
1062
+ export async function List_addAll$(self_, list_, $task) {
1063
+ return ff_core_List.List_flatten(ff_core_List.Link(self_, ff_core_List.Link(list_, ff_core_List.Empty())))
1064
+ }
1065
+
1066
+ export async function List_toStack$(self_, $task) {
1067
+ throw new Error('Function List_toStack is missing on this target in async context.');
1068
+ }
1069
+
1070
+ export async function List_toArray$(self_, $task) {
1071
+ return ff_core_Stack.Stack_drain(ff_core_List.List_toStack(self_))
1072
+ }
1073
+
1074
+ export async function List_grab$(self_, index_, $task) {
1075
+ function go_(list_, i_) {
1076
+ _tailcall: for(;;) {
1077
+ {
1078
+ const _1 = list_;
1079
+ {
1080
+ if(_1.Empty) {
1081
+ return ff_core_Try.internalThrowGrabException_()
1082
+ return
1083
+ }
1084
+ }
1085
+ {
1086
+ if(_1.Link) {
1087
+ const head_ = _1.head_;
1088
+ const _guard1 = (i_ === 0);
1089
+ if(_guard1) {
1090
+ return head_
1091
+ return
1092
+ }
1093
+ }
1094
+ }
1095
+ {
1096
+ if(_1.Link) {
1097
+ const tail_ = _1.tail_;
1098
+ {
1099
+ const list_r_ = tail_;
1100
+ const i_r_ = (i_ - 1);
1101
+ list_ = list_r_
1102
+ i_ = i_r_
1103
+ continue _tailcall
1104
+ }
1105
+ return
1106
+ }
1107
+ }
1108
+ }
1109
+ return
1110
+ }
1111
+ }
1112
+ return go_(self_, index_)
1113
+ }
1114
+
1115
+ export async function List_first$(self_, $task) {
1116
+ {
1117
+ const _1 = self_;
1118
+ {
1119
+ if(_1.Empty) {
1120
+ return ff_core_Option.None()
1121
+ return
1122
+ }
1123
+ }
1124
+ {
1125
+ if(_1.Link) {
1126
+ const head_ = _1.head_;
1127
+ return ff_core_Option.Some(head_)
1128
+ return
1129
+ }
1130
+ }
1131
+ }
1132
+ }
1133
+
1134
+ export async function List_last$(self_, $task) {
1135
+ _tailcall: for(;;) {
1136
+ {
1137
+ const _1 = self_;
1138
+ {
1139
+ if(_1.Empty) {
1140
+ return ff_core_Option.None()
1141
+ return
1142
+ }
1143
+ }
1144
+ {
1145
+ if(_1.Link) {
1146
+ const head_ = _1.head_;
1147
+ if(_1.tail_.Empty) {
1148
+ return ff_core_Option.Some(head_)
1149
+ return
1150
+ }
1151
+ }
1152
+ }
1153
+ {
1154
+ if(_1.Link) {
1155
+ const tail_ = _1.tail_;
1156
+ {
1157
+ const self_r_ = tail_;
1158
+ self_ = self_r_
1159
+ continue _tailcall
1160
+ }
1161
+ return
1162
+ }
1163
+ }
1164
+ }
1165
+ return
1166
+ }
1167
+ }
1168
+
1169
+ export async function List_grabFirst$(self_, $task) {
1170
+ return ff_core_Option.Option_else(ff_core_List.List_first(self_), (() => {
1171
+ return ff_core_Try.internalThrowGrabException_()
1172
+ }))
1173
+ }
1174
+
1175
+ export async function List_grabLast$(self_, $task) {
1176
+ return ff_core_Option.Option_else(ff_core_List.List_last(self_), (() => {
1177
+ return ff_core_Try.internalThrowGrabException_()
1178
+ }))
1179
+ }
1180
+
1181
+ export async function List_dropFirst$(self_, count_ = 1, $task) {
1182
+ _tailcall: for(;;) {
1183
+ {
1184
+ const _1 = self_;
1185
+ {
1186
+ const _guard1 = (count_ <= 0);
1187
+ if(_guard1) {
1188
+ return self_
1189
+ return
1190
+ }
1191
+ }
1192
+ {
1193
+ if(_1.Empty) {
1194
+ return self_
1195
+ return
1196
+ }
1197
+ }
1198
+ {
1199
+ if(_1.Link) {
1200
+ const tail_ = _1.tail_;
1201
+ {
1202
+ const self_r_ = tail_;
1203
+ const count_r_ = (count_ - 1);
1204
+ self_ = self_r_
1205
+ count_ = count_r_
1206
+ continue _tailcall
1207
+ }
1208
+ return
1209
+ }
1210
+ }
1211
+ }
1212
+ return
1213
+ }
1214
+ }
1215
+
1216
+ export async function List_dropLast$(self_, count_ = 1, $task) {
1217
+ return ff_core_List.List_reverse(ff_core_List.List_dropFirst(ff_core_List.List_reverse(self_), count_))
1218
+ }
1219
+
1220
+ export async function List_takeFirst$(self_, count_ = 1, $task) {
1221
+ function go_(list_, count_, result_) {
1222
+ _tailcall: for(;;) {
1223
+ {
1224
+ const _1 = list_;
1225
+ {
1226
+ const _guard1 = (count_ <= 0);
1227
+ if(_guard1) {
1228
+ return ff_core_List.List_reverse(result_)
1229
+ return
1230
+ }
1231
+ }
1232
+ {
1233
+ if(_1.Empty) {
1234
+ return ff_core_List.List_reverse(result_)
1235
+ return
1236
+ }
1237
+ }
1238
+ {
1239
+ if(_1.Link) {
1240
+ const head_ = _1.head_;
1241
+ const tail_ = _1.tail_;
1242
+ {
1243
+ const list_r_ = tail_;
1244
+ const count_r_ = (count_ - 1);
1245
+ const result_r_ = ff_core_List.Link(head_, result_);
1246
+ list_ = list_r_
1247
+ count_ = count_r_
1248
+ result_ = result_r_
1249
+ continue _tailcall
1250
+ }
1251
+ return
1252
+ }
1253
+ }
1254
+ }
1255
+ return
1256
+ }
1257
+ }
1258
+ return go_(self_, count_, ff_core_List.Empty())
1259
+ }
1260
+
1261
+ export async function List_takeLast$(self_, count_ = 1, $task) {
1262
+ return ff_core_List.List_reverse(ff_core_List.List_takeFirst(ff_core_List.List_reverse(self_), count_))
1263
+ }
1264
+
1265
+ export async function List_pairs$(self_, $task) {
1266
+ let i_ = 0;
1267
+ return ff_core_List.List_map(self_, ((x_) => {
1268
+ const r_ = ff_core_Pair.Pair(i_, x_);
1269
+ i_ += 1;
1270
+ return r_
1271
+ }))
1272
+ }
1273
+
1274
+ export async function List_slice$(self_, from_, until_, $task) {
1275
+ return ff_core_List.List_takeFirst(ff_core_List.List_dropFirst(self_, from_), (until_ - from_))
1276
+ }
1277
+
1278
+ export async function List_isEmpty$(self_, $task) {
1279
+ {
1280
+ const _1 = self_;
1281
+ {
1282
+ if(_1.Empty) {
1283
+ return true
1284
+ return
1285
+ }
1286
+ }
1287
+ {
1288
+ return false
1289
+ return
1290
+ }
1291
+ }
1292
+ }
1293
+
1294
+ export async function List_size$(self_, $task) {
1295
+ function go_(list_, result_) {
1296
+ _tailcall: for(;;) {
1297
+ {
1298
+ const _1 = list_;
1299
+ {
1300
+ if(_1.Empty) {
1301
+ return result_
1302
+ return
1303
+ }
1304
+ }
1305
+ {
1306
+ if(_1.Link) {
1307
+ const tail_ = _1.tail_;
1308
+ {
1309
+ const list_r_ = tail_;
1310
+ const result_r_ = (result_ + 1);
1311
+ list_ = list_r_
1312
+ result_ = result_r_
1313
+ continue _tailcall
1314
+ }
1315
+ return
1316
+ }
1317
+ }
1318
+ }
1319
+ return
1320
+ }
1321
+ }
1322
+ return go_(self_, 0)
1323
+ }
1324
+
1325
+ export async function List_each$(self_, body_, $task) {
1326
+ _tailcall: for(;;) {
1327
+ {
1328
+ const _1 = self_;
1329
+ {
1330
+ if(_1.Empty) {
1331
+
1332
+ return
1333
+ }
1334
+ }
1335
+ {
1336
+ if(_1.Link) {
1337
+ const head_ = _1.head_;
1338
+ const tail_ = _1.tail_;
1339
+ (await body_(head_, $task));
1340
+ {
1341
+ const self_r_ = tail_;
1342
+ const body_r_ = body_;
1343
+ self_ = self_r_
1344
+ body_ = body_r_
1345
+ continue _tailcall
1346
+ }
1347
+ return
1348
+ }
1349
+ }
1350
+ }
1351
+ return
1352
+ }
1353
+ }
1354
+
1355
+ export async function List_eachWhile$(self_, body_, $task) {
1356
+ return (await ff_core_List.List_all$(self_, body_, $task))
1357
+ }
1358
+
1359
+ export async function List_all$(self_, body_, $task) {
1360
+ _tailcall: for(;;) {
1361
+ {
1362
+ const _1 = self_;
1363
+ {
1364
+ if(_1.Empty) {
1365
+ return true
1366
+ return
1367
+ }
1368
+ }
1369
+ {
1370
+ if(_1.Link) {
1371
+ const head_ = _1.head_;
1372
+ const _guard1 = (!(await body_(head_, $task)));
1373
+ if(_guard1) {
1374
+ return false
1375
+ return
1376
+ }
1377
+ }
1378
+ }
1379
+ {
1380
+ if(_1.Link) {
1381
+ const tail_ = _1.tail_;
1382
+ {
1383
+ const self_r_ = tail_;
1384
+ const body_r_ = body_;
1385
+ self_ = self_r_
1386
+ body_ = body_r_
1387
+ continue _tailcall
1388
+ }
1389
+ return
1390
+ }
1391
+ }
1392
+ }
1393
+ return
1394
+ }
1395
+ }
1396
+
1397
+ export async function List_any$(self_, body_, $task) {
1398
+ _tailcall: for(;;) {
1399
+ {
1400
+ const _1 = self_;
1401
+ {
1402
+ if(_1.Empty) {
1403
+ return false
1404
+ return
1405
+ }
1406
+ }
1407
+ {
1408
+ if(_1.Link) {
1409
+ const head_ = _1.head_;
1410
+ const _guard1 = (await body_(head_, $task));
1411
+ if(_guard1) {
1412
+ return true
1413
+ return
1414
+ }
1415
+ }
1416
+ }
1417
+ {
1418
+ if(_1.Link) {
1419
+ const tail_ = _1.tail_;
1420
+ {
1421
+ const self_r_ = tail_;
1422
+ const body_r_ = body_;
1423
+ self_ = self_r_
1424
+ body_ = body_r_
1425
+ continue _tailcall
1426
+ }
1427
+ return
1428
+ }
1429
+ }
1430
+ }
1431
+ return
1432
+ }
1433
+ }
1434
+
1435
+ export async function List_find$(self_, body_, $task) {
1436
+ _tailcall: for(;;) {
1437
+ {
1438
+ const _1 = self_;
1439
+ {
1440
+ if(_1.Empty) {
1441
+ return ff_core_Option.None()
1442
+ return
1443
+ }
1444
+ }
1445
+ {
1446
+ if(_1.Link) {
1447
+ const head_ = _1.head_;
1448
+ const _guard1 = (await body_(head_, $task));
1449
+ if(_guard1) {
1450
+ return ff_core_Option.Some(head_)
1451
+ return
1452
+ }
1453
+ }
1454
+ }
1455
+ {
1456
+ if(_1.Link) {
1457
+ const tail_ = _1.tail_;
1458
+ {
1459
+ const self_r_ = tail_;
1460
+ const body_r_ = body_;
1461
+ self_ = self_r_
1462
+ body_ = body_r_
1463
+ continue _tailcall
1464
+ }
1465
+ return
1466
+ }
1467
+ }
1468
+ }
1469
+ return
1470
+ }
1471
+ }
1472
+
1473
+ export async function List_filter$(self_, body_, $task) {
1474
+ async function go_$(list_, result_, $task) {
1475
+ _tailcall: for(;;) {
1476
+ {
1477
+ const _1 = list_;
1478
+ {
1479
+ if(_1.Empty) {
1480
+ return ff_core_List.List_reverse(result_)
1481
+ return
1482
+ }
1483
+ }
1484
+ {
1485
+ if(_1.Link) {
1486
+ const head_ = _1.head_;
1487
+ const tail_ = _1.tail_;
1488
+ const _guard1 = (await body_(head_, $task));
1489
+ if(_guard1) {
1490
+ {
1491
+ const list_r_ = tail_;
1492
+ const result_r_ = ff_core_List.Link(head_, result_);
1493
+ list_ = list_r_
1494
+ result_ = result_r_
1495
+ continue _tailcall
1496
+ }
1497
+ return
1498
+ }
1499
+ }
1500
+ }
1501
+ {
1502
+ if(_1.Link) {
1503
+ const tail_ = _1.tail_;
1504
+ {
1505
+ const list_r_ = tail_;
1506
+ const result_r_ = result_;
1507
+ list_ = list_r_
1508
+ result_ = result_r_
1509
+ continue _tailcall
1510
+ }
1511
+ return
1512
+ }
1513
+ }
1514
+ }
1515
+ return
1516
+ }
1517
+ }
1518
+ return (await go_$(self_, ff_core_List.Empty(), $task))
1519
+ }
1520
+
1521
+ export async function List_partition$(self_, body_, $task) {
1522
+ return ff_core_Pair.Pair((await ff_core_List.List_filter$(self_, body_, $task)), (await ff_core_List.List_filter$(self_, (async (_w1, $task) => {
1523
+ return (!(await body_(_w1, $task)))
1524
+ }), $task)))
1525
+ }
1526
+
1527
+ export async function List_map$(self_, body_, $task) {
1528
+ async function go_$(list_, result_, $task) {
1529
+ _tailcall: for(;;) {
1530
+ {
1531
+ const _1 = list_;
1532
+ {
1533
+ if(_1.Empty) {
1534
+ return ff_core_List.List_reverse(result_)
1535
+ return
1536
+ }
1537
+ }
1538
+ {
1539
+ if(_1.Link) {
1540
+ const head_ = _1.head_;
1541
+ const tail_ = _1.tail_;
1542
+ {
1543
+ const list_r_ = tail_;
1544
+ const result_r_ = ff_core_List.Link((await body_(head_, $task)), result_);
1545
+ list_ = list_r_
1546
+ result_ = result_r_
1547
+ continue _tailcall
1548
+ }
1549
+ return
1550
+ }
1551
+ }
1552
+ }
1553
+ return
1554
+ }
1555
+ }
1556
+ return (await go_$(self_, ff_core_List.Empty(), $task))
1557
+ }
1558
+
1559
+ export async function List_flatMap$(self_, body_, $task) {
1560
+ async function go_$(list_, result_, $task) {
1561
+ _tailcall: for(;;) {
1562
+ {
1563
+ const _1 = list_;
1564
+ {
1565
+ if(_1.Empty) {
1566
+ return ff_core_List.List_flatten(ff_core_List.List_reverse(result_))
1567
+ return
1568
+ }
1569
+ }
1570
+ {
1571
+ if(_1.Link) {
1572
+ const head_ = _1.head_;
1573
+ const tail_ = _1.tail_;
1574
+ {
1575
+ const list_r_ = tail_;
1576
+ const result_r_ = ff_core_List.Link((await body_(head_, $task)), result_);
1577
+ list_ = list_r_
1578
+ result_ = result_r_
1579
+ continue _tailcall
1580
+ }
1581
+ return
1582
+ }
1583
+ }
1584
+ }
1585
+ return
1586
+ }
1587
+ }
1588
+ return (await go_$(self_, ff_core_List.Empty(), $task))
1589
+ }
1590
+
1591
+ export async function List_collect$(self_, body_, $task) {
1592
+ return (await ff_core_Stream.Stream_toList$((await ff_core_Stream.Stream_collect$((await ff_core_List.List_toStream$(self_, false, $task)), body_, $task)), $task))
1593
+ }
1594
+
1595
+ export async function List_collectFirst$(self_, body_, $task) {
1596
+ _tailcall: for(;;) {
1597
+ {
1598
+ const _1 = self_;
1599
+ {
1600
+ if(_1.Empty) {
1601
+ return ff_core_Option.None()
1602
+ return
1603
+ }
1604
+ }
1605
+ {
1606
+ if(_1.Link) {
1607
+ const head_ = _1.head_;
1608
+ const tail_ = _1.tail_;
1609
+ {
1610
+ const _1 = (await body_(head_, $task));
1611
+ {
1612
+ if(_1.None) {
1613
+ {
1614
+ const self_r_ = tail_;
1615
+ const body_r_ = body_;
1616
+ self_ = self_r_
1617
+ body_ = body_r_
1618
+ continue _tailcall
1619
+ }
1620
+ return
1621
+ }
1622
+ }
1623
+ {
1624
+ if(_1.Some) {
1625
+ const value_ = _1.value_;
1626
+ return ff_core_Option.Some(value_)
1627
+ return
1628
+ }
1629
+ }
1630
+ }
1631
+ return
1632
+ }
1633
+ }
1634
+ }
1635
+ return
1636
+ }
1637
+ }
1638
+
1639
+ export async function List_foldLeft$(self_, initial_, body_, $task) {
1640
+ async function go_$(state_, list_, $task) {
1641
+ _tailcall: for(;;) {
1642
+ {
1643
+ const _1 = list_;
1644
+ {
1645
+ if(_1.Empty) {
1646
+ return state_
1647
+ return
1648
+ }
1649
+ }
1650
+ {
1651
+ if(_1.Link) {
1652
+ const head_ = _1.head_;
1653
+ const tail_ = _1.tail_;
1654
+ {
1655
+ const state_r_ = (await body_(state_, head_, $task));
1656
+ const list_r_ = tail_;
1657
+ state_ = state_r_
1658
+ list_ = list_r_
1659
+ continue _tailcall
1660
+ }
1661
+ return
1662
+ }
1663
+ }
1664
+ }
1665
+ return
1666
+ }
1667
+ }
1668
+ return (await go_$(initial_, self_, $task))
1669
+ }
1670
+
1671
+ export async function List_updated$(self_, index_, value_, $task) {
1672
+ function go_(list_, i_, result_) {
1673
+ _tailcall: for(;;) {
1674
+ {
1675
+ const _1 = list_;
1676
+ {
1677
+ if(_1.Empty) {
1678
+ return ff_core_List.List_reverse(result_)
1679
+ return
1680
+ }
1681
+ }
1682
+ {
1683
+ if(_1.Link) {
1684
+ const head_ = _1.head_;
1685
+ const tail_ = _1.tail_;
1686
+ const _guard1 = (i_ === 0);
1687
+ if(_guard1) {
1688
+ {
1689
+ const list_r_ = tail_;
1690
+ const i_r_ = (i_ - 1);
1691
+ const result_r_ = ff_core_List.Link(value_, result_);
1692
+ list_ = list_r_
1693
+ i_ = i_r_
1694
+ result_ = result_r_
1695
+ continue _tailcall
1696
+ }
1697
+ return
1698
+ }
1699
+ }
1700
+ }
1701
+ {
1702
+ if(_1.Link) {
1703
+ const head_ = _1.head_;
1704
+ const tail_ = _1.tail_;
1705
+ {
1706
+ const list_r_ = tail_;
1707
+ const i_r_ = (i_ - 1);
1708
+ const result_r_ = ff_core_List.Link(head_, result_);
1709
+ list_ = list_r_
1710
+ i_ = i_r_
1711
+ result_ = result_r_
1712
+ continue _tailcall
1713
+ }
1714
+ return
1715
+ }
1716
+ }
1717
+ }
1718
+ return
1719
+ }
1720
+ }
1721
+ return go_(self_, index_, ff_core_List.Empty())
1722
+ }
1723
+
1724
+ export async function List_modify$(self_, index_, body_, $task) {
1725
+ async function go_$(list_, i_, result_, $task) {
1726
+ _tailcall: for(;;) {
1727
+ {
1728
+ const _1 = list_;
1729
+ {
1730
+ if(_1.Empty) {
1731
+ return ff_core_List.List_reverse(result_)
1732
+ return
1733
+ }
1734
+ }
1735
+ {
1736
+ if(_1.Link) {
1737
+ const head_ = _1.head_;
1738
+ const tail_ = _1.tail_;
1739
+ const _guard1 = (i_ === 0);
1740
+ if(_guard1) {
1741
+ {
1742
+ const list_r_ = tail_;
1743
+ const i_r_ = (i_ - 1);
1744
+ const result_r_ = ff_core_List.Link((await body_(head_, $task)), result_);
1745
+ list_ = list_r_
1746
+ i_ = i_r_
1747
+ result_ = result_r_
1748
+ continue _tailcall
1749
+ }
1750
+ return
1751
+ }
1752
+ }
1753
+ }
1754
+ {
1755
+ if(_1.Link) {
1756
+ const head_ = _1.head_;
1757
+ const tail_ = _1.tail_;
1758
+ {
1759
+ const list_r_ = tail_;
1760
+ const i_r_ = (i_ - 1);
1761
+ const result_r_ = ff_core_List.Link(head_, result_);
1762
+ list_ = list_r_
1763
+ i_ = i_r_
1764
+ result_ = result_r_
1765
+ continue _tailcall
1766
+ }
1767
+ return
1768
+ }
1769
+ }
1770
+ }
1771
+ return
1772
+ }
1773
+ }
1774
+ return (await go_$(self_, index_, ff_core_List.Empty(), $task))
1775
+ }
1776
+
1777
+ export async function List_zip$(self_, that_, $task) {
1778
+ function go_(list1_, list2_, result_) {
1779
+ _tailcall: for(;;) {
1780
+ {
1781
+ const _1 = ff_core_Pair.Pair(list1_, list2_);
1782
+ {
1783
+ if(_1.first_.Link) {
1784
+ const x_ = _1.first_.head_;
1785
+ const xs_ = _1.first_.tail_;
1786
+ if(_1.second_.Link) {
1787
+ const y_ = _1.second_.head_;
1788
+ const ys_ = _1.second_.tail_;
1789
+ {
1790
+ const list1_r_ = xs_;
1791
+ const list2_r_ = ys_;
1792
+ const result_r_ = ff_core_List.Link(ff_core_Pair.Pair(x_, y_), result_);
1793
+ list1_ = list1_r_
1794
+ list2_ = list2_r_
1795
+ result_ = result_r_
1796
+ continue _tailcall
1797
+ }
1798
+ return
1799
+ }
1800
+ }
1801
+ }
1802
+ {
1803
+ return ff_core_List.List_reverse(result_)
1804
+ return
1805
+ }
1806
+ }
1807
+ return
1808
+ }
1809
+ }
1810
+ return go_(self_, that_, ff_core_List.Empty())
1811
+ }
1812
+
1813
+ export async function List_sortBy$(self_, body_, ff_core_Ordering_Order$O, $task) {
1814
+ if((ff_core_List.List_size(self_) <= 1)) {
1815
+ return self_
1816
+ } else {
1817
+ const stack_ = ff_core_List.List_toStack(self_);
1818
+ (await ff_core_Stack.Stack_sortBy$(stack_, body_, ff_core_Ordering_Order$O, $task));
1819
+ return ff_core_Stack.Stack_toList(stack_, 0, 9007199254740991)
1820
+ }
1821
+ }
1822
+
1823
+ export async function List_sortWith$(self_, compare_, $task) {
1824
+ if((ff_core_List.List_size(self_) <= 1)) {
1825
+ return self_
1826
+ } else {
1827
+ const stack_ = ff_core_List.List_toStack(self_);
1828
+ (await ff_core_Stack.Stack_sortWith$(stack_, compare_, $task));
1829
+ return ff_core_Stack.Stack_toList(stack_, 0, 9007199254740991)
1830
+ }
1831
+ }
1832
+
1833
+ export async function List_reverse$(self_, $task) {
1834
+ function go_(list_, result_) {
1835
+ _tailcall: for(;;) {
1836
+ {
1837
+ const _1 = list_;
1838
+ {
1839
+ if(_1.Empty) {
1840
+ return result_
1841
+ return
1842
+ }
1843
+ }
1844
+ {
1845
+ if(_1.Link) {
1846
+ const head_ = _1.head_;
1847
+ const tail_ = _1.tail_;
1848
+ {
1849
+ const list_r_ = tail_;
1850
+ const result_r_ = ff_core_List.Link(head_, result_);
1851
+ list_ = list_r_
1852
+ result_ = result_r_
1853
+ continue _tailcall
1854
+ }
1855
+ return
1856
+ }
1857
+ }
1858
+ }
1859
+ return
1860
+ }
1861
+ }
1862
+ return go_(self_, ff_core_List.Empty())
1863
+ }
1864
+
1865
+ export async function List_chunk$(self_, chunkSize_, $task) {
1866
+ let results_ = ff_core_List.Empty();
1867
+ let result_ = ff_core_List.Empty();
1868
+ let added_ = 0;
1869
+ ff_core_List.List_each(self_, ((item_) => {
1870
+ if((added_ < chunkSize_)) {
1871
+ result_ = ff_core_List.Link(item_, result_);
1872
+ added_ += 1
1873
+ } else {
1874
+ results_ = ff_core_List.Link(ff_core_List.List_reverse(result_), results_);
1875
+ result_ = ff_core_List.Link(item_, ff_core_List.Empty());
1876
+ added_ = 1
1877
+ }
1878
+ }));
1879
+ if((added_ !== 0)) {
1880
+ results_ = ff_core_List.Link(ff_core_List.List_reverse(result_), results_)
1881
+ };
1882
+ return ff_core_List.List_reverse(results_)
1883
+ }
1884
+
1885
+ export async function List_toStream$(self_, cycle_ = false, $task) {
1886
+ let remaining_ = self_;
1887
+ return ff_core_Stream.Stream((async ($task) => {
1888
+ {
1889
+ const _1 = remaining_;
1890
+ {
1891
+ if(_1.Link) {
1892
+ const head_ = _1.head_;
1893
+ const tail_ = _1.tail_;
1894
+ remaining_ = tail_;
1895
+ return ff_core_Option.Some(head_)
1896
+ return
1897
+ }
1898
+ }
1899
+ {
1900
+ if(_1.Empty) {
1901
+ const _guard2 = self_;
1902
+ if(_guard2.Link) {
1903
+ const head_ = _guard2.head_;
1904
+ const tail_ = _guard2.tail_;
1905
+ const _guard1 = cycle_;
1906
+ if(_guard1) {
1907
+ remaining_ = tail_;
1908
+ return ff_core_Option.Some(head_)
1909
+ return
1910
+ }
1911
+ }
1912
+ }
1913
+ }
1914
+ {
1915
+ if(_1.Empty) {
1916
+ return ff_core_Option.None()
1917
+ return
1918
+ }
1919
+ }
1920
+ }
1921
+ }), (async ($task) => {
1922
+ remaining_ = ff_core_List.Empty()
1923
+ }))
1924
+ }
1925
+
1926
+ export async function List_insertBetween$(self_, separator_, $task) {
1927
+ return ff_core_List.List_dropFirst(ff_core_List.List_flatMap(self_, ((e_) => {
1928
+ return ff_core_List.List_addAll(separator_, ff_core_List.Link(e_, ff_core_List.Empty()))
1929
+ })), ff_core_List.List_size(separator_))
1930
+ }
1931
+
1932
+ export function List_sort(self_, ff_core_Ordering_Order$T) {
1933
+ if((ff_core_List.List_size(self_) <= 1)) {
1934
+ return self_
1935
+ } else {
1936
+ const stack_ = ff_core_List.List_toStack(self_);
1937
+ ff_core_Stack.Stack_sort(stack_, ff_core_Ordering_Order$T);
1938
+ return ff_core_Stack.Stack_toList(stack_, 0, 9007199254740991)
1939
+ }
1940
+ }
1941
+
1942
+ export function List_toSet(self_, ff_core_Ordering_Order$T) {
1943
+ return ff_core_List.List_foldLeft(self_, ff_core_Set.empty_(), ((set_, value_) => {
1944
+ return ff_core_Set.Set_add(set_, value_, ff_core_Ordering_Order$T)
1945
+ }))
1946
+ }
1947
+
1948
+ export function List_distinct(self_, ff_core_Ordering_Order$T) {
1949
+ let seen_ = ff_core_List.List_toSet(ff_core_List.Empty(), ff_core_Ordering_Order$T);
1950
+ return ff_core_List.List_filter(self_, ((_1) => {
1951
+ {
1952
+ const item_ = _1;
1953
+ const _guard1 = (!ff_core_Set.Set_contains(seen_, item_, ff_core_Ordering_Order$T));
1954
+ if(_guard1) {
1955
+ seen_ = ff_core_Set.Set_add(seen_, item_, ff_core_Ordering_Order$T);
1956
+ return true
1957
+ return
1958
+ }
1959
+ }
1960
+ {
1961
+ return false
1962
+ return
1963
+ }
1964
+ }))
1965
+ }
1966
+
1967
+ export async function List_sort$(self_, ff_core_Ordering_Order$T, $task) {
1968
+ if((ff_core_List.List_size(self_) <= 1)) {
1969
+ return self_
1970
+ } else {
1971
+ const stack_ = ff_core_List.List_toStack(self_);
1972
+ ff_core_Stack.Stack_sort(stack_, ff_core_Ordering_Order$T);
1973
+ return ff_core_Stack.Stack_toList(stack_, 0, 9007199254740991)
1974
+ }
1975
+ }
1976
+
1977
+ export async function List_toSet$(self_, ff_core_Ordering_Order$T, $task) {
1978
+ return ff_core_List.List_foldLeft(self_, ff_core_Set.empty_(), ((set_, value_) => {
1979
+ return ff_core_Set.Set_add(set_, value_, ff_core_Ordering_Order$T)
1980
+ }))
1981
+ }
1982
+
1983
+ export async function List_distinct$(self_, ff_core_Ordering_Order$T, $task) {
1984
+ let seen_ = ff_core_List.List_toSet(ff_core_List.Empty(), ff_core_Ordering_Order$T);
1985
+ return ff_core_List.List_filter(self_, ((_1) => {
1986
+ {
1987
+ const item_ = _1;
1988
+ const _guard1 = (!ff_core_Set.Set_contains(seen_, item_, ff_core_Ordering_Order$T));
1989
+ if(_guard1) {
1990
+ seen_ = ff_core_Set.Set_add(seen_, item_, ff_core_Ordering_Order$T);
1991
+ return true
1992
+ return
1993
+ }
1994
+ }
1995
+ {
1996
+ return false
1997
+ return
1998
+ }
1999
+ }))
2000
+ }
2001
+
2002
+ export function List_show(self_, ff_core_Show_Show$T) {
2003
+ return ff_core_Show.ff_core_Show_Show$ff_core_List_List(ff_core_Show_Show$T).show_(self_)
2004
+ }
2005
+
2006
+ export async function List_show$(self_, ff_core_Show_Show$T, $task) {
2007
+ return ff_core_Show.ff_core_Show_Show$ff_core_List_List(ff_core_Show_Show$T).show_(self_)
2008
+ }
2009
+
2010
+ export function List_flatten(self_) {
2011
+ function finish_(list_, result_) {
2012
+ _tailcall: for(;;) {
2013
+ {
2014
+ const list_a = list_;
2015
+ const result_a = result_;
2016
+ {
2017
+ const as_ = list_a;
2018
+ if(result_a.Empty) {
2019
+ return as_
2020
+ return
2021
+ }
2022
+ }
2023
+ {
2024
+ const as_ = list_a;
2025
+ if(result_a.Link) {
2026
+ const x_ = result_a.head_;
2027
+ const xs_ = result_a.tail_;
2028
+ {
2029
+ const list_r_ = ff_core_List.Link(x_, as_);
2030
+ const result_r_ = xs_;
2031
+ list_ = list_r_
2032
+ result_ = result_r_
2033
+ continue _tailcall
2034
+ }
2035
+ return
2036
+ }
2037
+ }
2038
+ }
2039
+ return
2040
+ }
2041
+ }
2042
+ function go_(lists_, result_) {
2043
+ _tailcall: for(;;) {
2044
+ {
2045
+ const _1 = lists_;
2046
+ {
2047
+ if(_1.Empty) {
2048
+ return ff_core_List.Empty()
2049
+ return
2050
+ }
2051
+ }
2052
+ {
2053
+ if(_1.Link) {
2054
+ const as_ = _1.head_;
2055
+ if(_1.tail_.Empty) {
2056
+ return finish_(as_, result_)
2057
+ return
2058
+ }
2059
+ }
2060
+ }
2061
+ {
2062
+ if(_1.Link) {
2063
+ if(_1.head_.Empty) {
2064
+ const aas_ = _1.tail_;
2065
+ {
2066
+ const lists_r_ = aas_;
2067
+ const result_r_ = result_;
2068
+ lists_ = lists_r_
2069
+ result_ = result_r_
2070
+ continue _tailcall
2071
+ }
2072
+ return
2073
+ }
2074
+ }
2075
+ }
2076
+ {
2077
+ if(_1.Link) {
2078
+ if(_1.head_.Link) {
2079
+ const a_ = _1.head_.head_;
2080
+ const as_ = _1.head_.tail_;
2081
+ const aas_ = _1.tail_;
2082
+ {
2083
+ const lists_r_ = ff_core_List.Link(as_, aas_);
2084
+ const result_r_ = ff_core_List.Link(a_, result_);
2085
+ lists_ = lists_r_
2086
+ result_ = result_r_
2087
+ continue _tailcall
2088
+ }
2089
+ return
2090
+ }
2091
+ }
2092
+ }
2093
+ }
2094
+ return
2095
+ }
2096
+ }
2097
+ return go_(self_, ff_core_List.Empty())
2098
+ }
2099
+
2100
+ export async function List_flatten$(self_, $task) {
2101
+ function finish_(list_, result_) {
2102
+ _tailcall: for(;;) {
2103
+ {
2104
+ const list_a = list_;
2105
+ const result_a = result_;
2106
+ {
2107
+ const as_ = list_a;
2108
+ if(result_a.Empty) {
2109
+ return as_
2110
+ return
2111
+ }
2112
+ }
2113
+ {
2114
+ const as_ = list_a;
2115
+ if(result_a.Link) {
2116
+ const x_ = result_a.head_;
2117
+ const xs_ = result_a.tail_;
2118
+ {
2119
+ const list_r_ = ff_core_List.Link(x_, as_);
2120
+ const result_r_ = xs_;
2121
+ list_ = list_r_
2122
+ result_ = result_r_
2123
+ continue _tailcall
2124
+ }
2125
+ return
2126
+ }
2127
+ }
2128
+ }
2129
+ return
2130
+ }
2131
+ }
2132
+ function go_(lists_, result_) {
2133
+ _tailcall: for(;;) {
2134
+ {
2135
+ const _1 = lists_;
2136
+ {
2137
+ if(_1.Empty) {
2138
+ return ff_core_List.Empty()
2139
+ return
2140
+ }
2141
+ }
2142
+ {
2143
+ if(_1.Link) {
2144
+ const as_ = _1.head_;
2145
+ if(_1.tail_.Empty) {
2146
+ return finish_(as_, result_)
2147
+ return
2148
+ }
2149
+ }
2150
+ }
2151
+ {
2152
+ if(_1.Link) {
2153
+ if(_1.head_.Empty) {
2154
+ const aas_ = _1.tail_;
2155
+ {
2156
+ const lists_r_ = aas_;
2157
+ const result_r_ = result_;
2158
+ lists_ = lists_r_
2159
+ result_ = result_r_
2160
+ continue _tailcall
2161
+ }
2162
+ return
2163
+ }
2164
+ }
2165
+ }
2166
+ {
2167
+ if(_1.Link) {
2168
+ if(_1.head_.Link) {
2169
+ const a_ = _1.head_.head_;
2170
+ const as_ = _1.head_.tail_;
2171
+ const aas_ = _1.tail_;
2172
+ {
2173
+ const lists_r_ = ff_core_List.Link(as_, aas_);
2174
+ const result_r_ = ff_core_List.Link(a_, result_);
2175
+ lists_ = lists_r_
2176
+ result_ = result_r_
2177
+ continue _tailcall
2178
+ }
2179
+ return
2180
+ }
2181
+ }
2182
+ }
2183
+ }
2184
+ return
2185
+ }
2186
+ }
2187
+ return go_(self_, ff_core_List.Empty())
2188
+ }
2189
+
2190
+ export function List_toMap(self_, ff_core_Ordering_Order$K) {
2191
+ return ff_core_List.List_foldLeft(self_, ff_core_Map.empty_(), ((map_, pair_) => {
2192
+ return ff_core_Map.Map_add(map_, pair_.first_, pair_.second_, ff_core_Ordering_Order$K)
2193
+ }))
2194
+ }
2195
+
2196
+ export function List_group(self_, ff_core_Ordering_Order$K) {
2197
+ const initial_ = ff_core_List.Empty();
2198
+ return ff_core_List.List_foldLeft(self_, ff_core_List.List_toMap(initial_, ff_core_Ordering_Order$K), ((map_, pair_) => {
2199
+ return ff_core_Map.Map_addToList(map_, pair_.first_, pair_.second_, ff_core_Ordering_Order$K)
2200
+ }))
2201
+ }
2202
+
2203
+ export async function List_toMap$(self_, ff_core_Ordering_Order$K, $task) {
2204
+ return ff_core_List.List_foldLeft(self_, ff_core_Map.empty_(), ((map_, pair_) => {
2205
+ return ff_core_Map.Map_add(map_, pair_.first_, pair_.second_, ff_core_Ordering_Order$K)
2206
+ }))
2207
+ }
2208
+
2209
+ export async function List_group$(self_, ff_core_Ordering_Order$K, $task) {
2210
+ const initial_ = ff_core_List.Empty();
2211
+ return ff_core_List.List_foldLeft(self_, ff_core_List.List_toMap(initial_, ff_core_Ordering_Order$K), ((map_, pair_) => {
2212
+ return ff_core_Map.Map_addToList(map_, pair_.first_, pair_.second_, ff_core_Ordering_Order$K)
2213
+ }))
2214
+ }
2215
+
2216
+ export function List_unzip(self_) {
2217
+ function go_(pairs_, ks_, vs_) {
2218
+ _tailcall: for(;;) {
2219
+ {
2220
+ const _1 = pairs_;
2221
+ {
2222
+ if(_1.Empty) {
2223
+ return ff_core_Pair.Pair(ff_core_List.List_reverse(ks_), ff_core_List.List_reverse(vs_))
2224
+ return
2225
+ }
2226
+ }
2227
+ {
2228
+ if(_1.Link) {
2229
+ const k_ = _1.head_.first_;
2230
+ const v_ = _1.head_.second_;
2231
+ const tail_ = _1.tail_;
2232
+ {
2233
+ const pairs_r_ = tail_;
2234
+ const ks_r_ = ff_core_List.Link(k_, ks_);
2235
+ const vs_r_ = ff_core_List.Link(v_, vs_);
2236
+ pairs_ = pairs_r_
2237
+ ks_ = ks_r_
2238
+ vs_ = vs_r_
2239
+ continue _tailcall
2240
+ }
2241
+ return
2242
+ }
2243
+ }
2244
+ }
2245
+ return
2246
+ }
2247
+ }
2248
+ return go_(self_, ff_core_List.Empty(), ff_core_List.Empty())
2249
+ }
2250
+
2251
+ export async function List_unzip$(self_, $task) {
2252
+ function go_(pairs_, ks_, vs_) {
2253
+ _tailcall: for(;;) {
2254
+ {
2255
+ const _1 = pairs_;
2256
+ {
2257
+ if(_1.Empty) {
2258
+ return ff_core_Pair.Pair(ff_core_List.List_reverse(ks_), ff_core_List.List_reverse(vs_))
2259
+ return
2260
+ }
2261
+ }
2262
+ {
2263
+ if(_1.Link) {
2264
+ const k_ = _1.head_.first_;
2265
+ const v_ = _1.head_.second_;
2266
+ const tail_ = _1.tail_;
2267
+ {
2268
+ const pairs_r_ = tail_;
2269
+ const ks_r_ = ff_core_List.Link(k_, ks_);
2270
+ const vs_r_ = ff_core_List.Link(v_, vs_);
2271
+ pairs_ = pairs_r_
2272
+ ks_ = ks_r_
2273
+ vs_ = vs_r_
2274
+ continue _tailcall
2275
+ }
2276
+ return
2277
+ }
2278
+ }
2279
+ }
2280
+ return
2281
+ }
2282
+ }
2283
+ return go_(self_, ff_core_List.Empty(), ff_core_List.Empty())
2284
+ }
2285
+
2286
+ export function List_join(self_, separator_ = "") {
2287
+ return ff_core_Array.Array_join(ff_core_List.List_toArray(self_), separator_)
2288
+ }
2289
+
2290
+ export async function List_join$(self_, separator_ = "", $task) {
2291
+ return ff_core_Array.Array_join(ff_core_List.List_toArray(self_), separator_)
2292
+ }
2293
+
2294
+ export function ff_core_Any_HasAnyTag$ff_core_List_List(ff_core_Any_HasAnyTag$T) { return {
2295
+ anyTag_() {
2296
+ return ff_core_Any.internalAnyTag_(((("ff:core/List.List" + "[") + ff_core_Any.AnyTag_show(ff_core_Any_HasAnyTag$T.anyTag_())) + "]"))
2297
+ },
2298
+ async anyTag_$($task) {
2299
+ return ff_core_Any.internalAnyTag_(((("ff:core/List.List" + "[") + ff_core_Any.AnyTag_show(ff_core_Any_HasAnyTag$T.anyTag_())) + "]"))
2300
+ }
2301
+ }}
2302
+
2303
+ export function ff_core_Equal_Equal$ff_core_List_List(ff_core_Equal_Equal$T) { return {
2304
+ equals_(x_, y_) {
2305
+ {
2306
+ const x_a = x_;
2307
+ const y_a = y_;
2308
+ {
2309
+ const _guard1 = (x_ === y_);
2310
+ if(_guard1) {
2311
+ return true
2312
+ return
2313
+ }
2314
+ }
2315
+ {
2316
+ if(x_a.Link) {
2317
+ const x_ = x_a;
2318
+ if(y_a.Link) {
2319
+ const y_ = y_a;
2320
+ return (ff_core_Equal_Equal$T.equals_(x_.head_, y_.head_) && ff_core_List.ff_core_Equal_Equal$ff_core_List_List(ff_core_Equal_Equal$T).equals_(x_.tail_, y_.tail_))
2321
+ return
2322
+ }
2323
+ }
2324
+ }
2325
+ {
2326
+ return false
2327
+ return
2328
+ }
2329
+ }
2330
+ },
2331
+ async equals_$(x_, y_, $task) {
2332
+ {
2333
+ const x_a = x_;
2334
+ const y_a = y_;
2335
+ {
2336
+ const _guard1 = (x_ === y_);
2337
+ if(_guard1) {
2338
+ return true
2339
+ return
2340
+ }
2341
+ }
2342
+ {
2343
+ if(x_a.Link) {
2344
+ const x_ = x_a;
2345
+ if(y_a.Link) {
2346
+ const y_ = y_a;
2347
+ return (ff_core_Equal_Equal$T.equals_(x_.head_, y_.head_) && ff_core_List.ff_core_Equal_Equal$ff_core_List_List(ff_core_Equal_Equal$T).equals_(x_.tail_, y_.tail_))
2348
+ return
2349
+ }
2350
+ }
2351
+ }
2352
+ {
2353
+ return false
2354
+ return
2355
+ }
2356
+ }
2357
+ }
2358
+ }}
2359
+
2360
+