firefly-compiler 0.4.6 → 0.4.7

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 (68) hide show
  1. package/output/js/ff/compiler/Builder.mjs +444 -444
  2. package/output/js/ff/compiler/Compiler.mjs +416 -416
  3. package/output/js/ff/compiler/Dependencies.mjs +389 -389
  4. package/output/js/ff/compiler/Deriver.mjs +1170 -1170
  5. package/output/js/ff/compiler/Dictionaries.mjs +1309 -1309
  6. package/output/js/ff/compiler/Environment.mjs +1015 -1015
  7. package/output/js/ff/compiler/Inference.mjs +4268 -4268
  8. package/output/js/ff/compiler/JsEmitter.mjs +5391 -5391
  9. package/output/js/ff/compiler/JsImporter.mjs +266 -266
  10. package/output/js/ff/compiler/LspHook.mjs +793 -793
  11. package/output/js/ff/compiler/Main.mjs +1675 -1675
  12. package/output/js/ff/compiler/Parser.mjs +4008 -4008
  13. package/output/js/ff/compiler/Patterns.mjs +927 -927
  14. package/output/js/ff/compiler/Resolver.mjs +2307 -2307
  15. package/output/js/ff/compiler/Substitution.mjs +1150 -1150
  16. package/output/js/ff/compiler/Syntax.mjs +12434 -12434
  17. package/output/js/ff/compiler/Token.mjs +3096 -3096
  18. package/output/js/ff/compiler/Tokenizer.mjs +593 -593
  19. package/output/js/ff/compiler/Unification.mjs +1752 -1752
  20. package/output/js/ff/compiler/Wildcards.mjs +608 -608
  21. package/output/js/ff/compiler/Workspace.mjs +687 -687
  22. package/output/js/ff/core/Any.mjs +143 -143
  23. package/output/js/ff/core/Array.mjs +547 -547
  24. package/output/js/ff/core/AssetSystem.mjs +274 -274
  25. package/output/js/ff/core/Atomic.mjs +154 -154
  26. package/output/js/ff/core/Bool.mjs +152 -152
  27. package/output/js/ff/core/Box.mjs +112 -112
  28. package/output/js/ff/core/BrowserSystem.mjs +126 -126
  29. package/output/js/ff/core/Buffer.mjs +395 -395
  30. package/output/js/ff/core/BuildSystem.mjs +296 -296
  31. package/output/js/ff/core/Channel.mjs +189 -189
  32. package/output/js/ff/core/Char.mjs +149 -149
  33. package/output/js/ff/core/Core.mjs +300 -300
  34. package/output/js/ff/core/Duration.mjs +116 -116
  35. package/output/js/ff/core/Equal.mjs +179 -179
  36. package/output/js/ff/core/Error.mjs +142 -142
  37. package/output/js/ff/core/FileHandle.mjs +150 -150
  38. package/output/js/ff/core/Float.mjs +225 -225
  39. package/output/js/ff/core/HttpClient.mjs +191 -191
  40. package/output/js/ff/core/Instant.mjs +109 -109
  41. package/output/js/ff/core/Int.mjs +265 -265
  42. package/output/js/ff/core/IntMap.mjs +280 -280
  43. package/output/js/ff/core/JsSystem.mjs +238 -238
  44. package/output/js/ff/core/JsValue.mjs +708 -708
  45. package/output/js/ff/core/List.mjs +2334 -2334
  46. package/output/js/ff/core/Lock.mjs +229 -229
  47. package/output/js/ff/core/Log.mjs +163 -163
  48. package/output/js/ff/core/Map.mjs +362 -362
  49. package/output/js/ff/core/NodeSystem.mjs +294 -294
  50. package/output/js/ff/core/Nothing.mjs +104 -104
  51. package/output/js/ff/core/Option.mjs +1015 -1015
  52. package/output/js/ff/core/Ordering.mjs +730 -730
  53. package/output/js/ff/core/Pair.mjs +331 -331
  54. package/output/js/ff/core/Path.mjs +545 -545
  55. package/output/js/ff/core/RbMap.mjs +1940 -1940
  56. package/output/js/ff/core/Serializable.mjs +428 -428
  57. package/output/js/ff/core/Set.mjs +254 -254
  58. package/output/js/ff/core/Show.mjs +205 -205
  59. package/output/js/ff/core/SourceLocation.mjs +229 -229
  60. package/output/js/ff/core/Stack.mjs +529 -529
  61. package/output/js/ff/core/Stream.mjs +1304 -1304
  62. package/output/js/ff/core/String.mjs +365 -365
  63. package/output/js/ff/core/StringMap.mjs +280 -280
  64. package/output/js/ff/core/Task.mjs +320 -320
  65. package/output/js/ff/core/Try.mjs +507 -507
  66. package/output/js/ff/core/Unit.mjs +151 -151
  67. package/package.json +1 -1
  68. package/vscode/package.json +1 -1
@@ -1,187 +1,187 @@
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_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_) {
103
103
 
104
104
  let result = ff_core_List.Empty();
105
105
  for(let i = size_ - 1; i >= 0; i--) {
106
106
  result = ff_core_List.Link(i, result);
107
107
  }
108
108
  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_) {
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_) {
185
185
 
186
186
  let current = self_;
187
187
  let result = [];
@@ -190,2159 +190,2159 @@ export function List_toStack(self_) {
190
190
  current = current.tail_;
191
191
  }
192
192
  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
-
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
+