firefly-compiler 0.4.5 → 0.4.6

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 (78) hide show
  1. package/.hintrc +4 -4
  2. package/README.md +1 -1
  3. package/core/HttpClient.ff +1 -1
  4. package/lsp/LanguageServer.ff +32 -7
  5. package/lsp/stderr.txt +1 -0
  6. package/lsp/stdin.txt +11 -0
  7. package/lsp/stdout.txt +41 -0
  8. package/lux/Main.ff +56 -2
  9. package/meetup/AutoCompletion.ff +6 -0
  10. package/output/js/ff/compiler/Builder.mjs +444 -444
  11. package/output/js/ff/compiler/Compiler.mjs +416 -416
  12. package/output/js/ff/compiler/Dependencies.mjs +389 -389
  13. package/output/js/ff/compiler/Deriver.mjs +1170 -1170
  14. package/output/js/ff/compiler/Dictionaries.mjs +1309 -1309
  15. package/output/js/ff/compiler/Environment.mjs +1015 -1015
  16. package/output/js/ff/compiler/Inference.mjs +4268 -4268
  17. package/output/js/ff/compiler/JsEmitter.mjs +5391 -5391
  18. package/output/js/ff/compiler/JsImporter.mjs +266 -266
  19. package/output/js/ff/compiler/LspHook.mjs +793 -793
  20. package/output/js/ff/compiler/Main.mjs +1675 -1675
  21. package/output/js/ff/compiler/Parser.mjs +4008 -4008
  22. package/output/js/ff/compiler/Patterns.mjs +927 -927
  23. package/output/js/ff/compiler/Resolver.mjs +2307 -2307
  24. package/output/js/ff/compiler/Substitution.mjs +1150 -1150
  25. package/output/js/ff/compiler/Syntax.mjs +12434 -12434
  26. package/output/js/ff/compiler/Token.mjs +3096 -3096
  27. package/output/js/ff/compiler/Tokenizer.mjs +593 -593
  28. package/output/js/ff/compiler/Unification.mjs +1752 -1752
  29. package/output/js/ff/compiler/Wildcards.mjs +608 -608
  30. package/output/js/ff/compiler/Workspace.mjs +687 -687
  31. package/output/js/ff/core/Any.mjs +143 -143
  32. package/output/js/ff/core/Array.mjs +547 -547
  33. package/output/js/ff/core/AssetSystem.mjs +274 -274
  34. package/output/js/ff/core/Atomic.mjs +154 -154
  35. package/output/js/ff/core/Bool.mjs +152 -152
  36. package/output/js/ff/core/Box.mjs +112 -112
  37. package/output/js/ff/core/BrowserSystem.mjs +126 -126
  38. package/output/js/ff/core/Buffer.mjs +395 -395
  39. package/output/js/ff/core/BuildSystem.mjs +296 -296
  40. package/output/js/ff/core/Channel.mjs +189 -189
  41. package/output/js/ff/core/Char.mjs +149 -149
  42. package/output/js/ff/core/Core.mjs +300 -300
  43. package/output/js/ff/core/Duration.mjs +116 -116
  44. package/output/js/ff/core/Equal.mjs +179 -179
  45. package/output/js/ff/core/Error.mjs +142 -142
  46. package/output/js/ff/core/FileHandle.mjs +150 -150
  47. package/output/js/ff/core/Float.mjs +225 -225
  48. package/output/js/ff/core/HttpClient.mjs +190 -190
  49. package/output/js/ff/core/Instant.mjs +109 -109
  50. package/output/js/ff/core/Int.mjs +265 -265
  51. package/output/js/ff/core/IntMap.mjs +280 -280
  52. package/output/js/ff/core/JsSystem.mjs +238 -238
  53. package/output/js/ff/core/JsValue.mjs +708 -708
  54. package/output/js/ff/core/List.mjs +2334 -2334
  55. package/output/js/ff/core/Lock.mjs +229 -229
  56. package/output/js/ff/core/Log.mjs +163 -163
  57. package/output/js/ff/core/Map.mjs +362 -362
  58. package/output/js/ff/core/NodeSystem.mjs +294 -294
  59. package/output/js/ff/core/Nothing.mjs +104 -104
  60. package/output/js/ff/core/Option.mjs +1015 -1015
  61. package/output/js/ff/core/Ordering.mjs +730 -730
  62. package/output/js/ff/core/Pair.mjs +331 -331
  63. package/output/js/ff/core/Path.mjs +545 -545
  64. package/output/js/ff/core/RbMap.mjs +1940 -1940
  65. package/output/js/ff/core/Serializable.mjs +428 -428
  66. package/output/js/ff/core/Set.mjs +254 -254
  67. package/output/js/ff/core/Show.mjs +205 -205
  68. package/output/js/ff/core/SourceLocation.mjs +229 -229
  69. package/output/js/ff/core/Stack.mjs +529 -529
  70. package/output/js/ff/core/Stream.mjs +1304 -1304
  71. package/output/js/ff/core/String.mjs +365 -365
  72. package/output/js/ff/core/StringMap.mjs +280 -280
  73. package/output/js/ff/core/Task.mjs +320 -320
  74. package/output/js/ff/core/Try.mjs +507 -507
  75. package/output/js/ff/core/Unit.mjs +151 -151
  76. package/package.json +29 -29
  77. package/vscode/package-lock.json +5 -5
  78. package/vscode/package.json +1 -1
@@ -1,1940 +1,1940 @@
1
-
2
-
3
- import * as ff_core_RbMap from "../../ff/core/RbMap.mjs"
4
-
5
- import * as ff_core_Any from "../../ff/core/Any.mjs"
6
-
7
- import * as ff_core_Array from "../../ff/core/Array.mjs"
8
-
9
- import * as ff_core_AssetSystem from "../../ff/core/AssetSystem.mjs"
10
-
11
- import * as ff_core_Atomic from "../../ff/core/Atomic.mjs"
12
-
13
- import * as ff_core_Bool from "../../ff/core/Bool.mjs"
14
-
15
- import * as ff_core_Box from "../../ff/core/Box.mjs"
16
-
17
- import * as ff_core_BrowserSystem from "../../ff/core/BrowserSystem.mjs"
18
-
19
- import * as ff_core_Buffer from "../../ff/core/Buffer.mjs"
20
-
21
- import * as ff_core_BuildSystem from "../../ff/core/BuildSystem.mjs"
22
-
23
- import * as ff_core_Channel from "../../ff/core/Channel.mjs"
24
-
25
- import * as ff_core_Char from "../../ff/core/Char.mjs"
26
-
27
- import * as ff_core_Core from "../../ff/core/Core.mjs"
28
-
29
- import * as ff_core_Duration from "../../ff/core/Duration.mjs"
30
-
31
- import * as ff_core_Equal from "../../ff/core/Equal.mjs"
32
-
33
- import * as ff_core_Error from "../../ff/core/Error.mjs"
34
-
35
- import * as ff_core_FileHandle from "../../ff/core/FileHandle.mjs"
36
-
37
- import * as ff_core_Float from "../../ff/core/Float.mjs"
38
-
39
- import * as ff_core_HttpClient from "../../ff/core/HttpClient.mjs"
40
-
41
- import * as ff_core_Instant from "../../ff/core/Instant.mjs"
42
-
43
- import * as ff_core_Int from "../../ff/core/Int.mjs"
44
-
45
- import * as ff_core_IntMap from "../../ff/core/IntMap.mjs"
46
-
47
- import * as ff_core_JsSystem from "../../ff/core/JsSystem.mjs"
48
-
49
- import * as ff_core_JsValue from "../../ff/core/JsValue.mjs"
50
-
51
- import * as ff_core_List from "../../ff/core/List.mjs"
52
-
53
- import * as ff_core_Lock from "../../ff/core/Lock.mjs"
54
-
55
- import * as ff_core_Log from "../../ff/core/Log.mjs"
56
-
57
- import * as ff_core_Map from "../../ff/core/Map.mjs"
58
-
59
- import * as ff_core_NodeSystem from "../../ff/core/NodeSystem.mjs"
60
-
61
- import * as ff_core_Nothing from "../../ff/core/Nothing.mjs"
62
-
63
- import * as ff_core_Option from "../../ff/core/Option.mjs"
64
-
65
- import * as ff_core_Ordering from "../../ff/core/Ordering.mjs"
66
-
67
- import * as ff_core_Pair from "../../ff/core/Pair.mjs"
68
-
69
- import * as ff_core_Path from "../../ff/core/Path.mjs"
70
-
71
- import * as ff_core_Serializable from "../../ff/core/Serializable.mjs"
72
-
73
- import * as ff_core_Set from "../../ff/core/Set.mjs"
74
-
75
- import * as ff_core_Show from "../../ff/core/Show.mjs"
76
-
77
- import * as ff_core_SourceLocation from "../../ff/core/SourceLocation.mjs"
78
-
79
- import * as ff_core_Stack from "../../ff/core/Stack.mjs"
80
-
81
- import * as ff_core_Stream from "../../ff/core/Stream.mjs"
82
-
83
- import * as ff_core_String from "../../ff/core/String.mjs"
84
-
85
- import * as ff_core_StringMap from "../../ff/core/StringMap.mjs"
86
-
87
- import * as ff_core_Task from "../../ff/core/Task.mjs"
88
-
89
- import * as ff_core_Try from "../../ff/core/Try.mjs"
90
-
91
- import * as ff_core_Unit from "../../ff/core/Unit.mjs"
92
-
93
- // type Color
94
- const R$ = {R: true};
95
- export function R() {
96
- return R$;
97
- }
98
- const B$ = {B: true};
99
- export function B() {
100
- return B$;
101
- }
102
-
103
- // type RB
104
- const E$ = {E: true};
105
- export function E() {
106
- return E$;
107
- }
108
- export function T(color_, left_, key_, value_, right_) {
109
- return {T: true, color_, left_, key_, value_, right_};
110
- }
111
-
112
-
113
-
114
- export function insert_(x_, xv_, s_, ff_core_Ordering_Order$K) {
115
- function ins_(s_) {
116
- {
117
- const s_a = s_;
118
- {
119
- if(s_a.E) {
120
- return ff_core_RbMap.T(ff_core_RbMap.R(), ff_core_RbMap.E(), x_, xv_, ff_core_RbMap.E())
121
- return
122
- }
123
- }
124
- {
125
- if(s_a.T) {
126
- if(s_a.color_.B) {
127
- const a_ = s_a.left_;
128
- const y_ = s_a.key_;
129
- const yv_ = s_a.value_;
130
- const b_ = s_a.right_;
131
- {
132
- const _1 = ff_core_Ordering_Order$K.compare_(x_, y_);
133
- {
134
- if(_1.OrderingBefore) {
135
- return ff_core_RbMap.balance_(ins_(a_), y_, yv_, b_, ff_core_Ordering_Order$K)
136
- return
137
- }
138
- }
139
- {
140
- if(_1.OrderingAfter) {
141
- return ff_core_RbMap.balance_(a_, y_, yv_, ins_(b_), ff_core_Ordering_Order$K)
142
- return
143
- }
144
- }
145
- {
146
- if(_1.OrderingSame) {
147
- return ff_core_RbMap.T(ff_core_RbMap.B(), a_, x_, xv_, b_)
148
- return
149
- }
150
- }
151
- }
152
- return
153
- }
154
- }
155
- }
156
- {
157
- if(s_a.T) {
158
- if(s_a.color_.R) {
159
- const a_ = s_a.left_;
160
- const y_ = s_a.key_;
161
- const yv_ = s_a.value_;
162
- const b_ = s_a.right_;
163
- {
164
- const _1 = ff_core_Ordering_Order$K.compare_(x_, y_);
165
- {
166
- if(_1.OrderingBefore) {
167
- return ff_core_RbMap.T(ff_core_RbMap.R(), ins_(a_), y_, yv_, b_)
168
- return
169
- }
170
- }
171
- {
172
- if(_1.OrderingAfter) {
173
- return ff_core_RbMap.T(ff_core_RbMap.R(), a_, y_, yv_, ins_(b_))
174
- return
175
- }
176
- }
177
- {
178
- if(_1.OrderingSame) {
179
- return ff_core_RbMap.T(ff_core_RbMap.R(), a_, x_, xv_, b_)
180
- return
181
- }
182
- }
183
- }
184
- return
185
- }
186
- }
187
- }
188
- }
189
- }
190
- {
191
- const _1 = ins_(s_);
192
- {
193
- if(_1.E) {
194
- return ff_core_Core.panic_("Unexpected empty tree")
195
- return
196
- }
197
- }
198
- {
199
- if(_1.T) {
200
- const a_ = _1.left_;
201
- const z_ = _1.key_;
202
- const zv_ = _1.value_;
203
- const b_ = _1.right_;
204
- return ff_core_RbMap.T(ff_core_RbMap.B(), a_, z_, zv_, b_)
205
- return
206
- }
207
- }
208
- }
209
- }
210
-
211
- export function member_(key_, tree_, ff_core_Ordering_Order$K) {
212
- {
213
- const key_a = key_;
214
- const tree_a = tree_;
215
- {
216
- const x_ = key_a;
217
- if(tree_a.E) {
218
- return false
219
- return
220
- }
221
- }
222
- {
223
- const x_ = key_a;
224
- if(tree_a.T) {
225
- const a_ = tree_a.left_;
226
- const y_ = tree_a.key_;
227
- const b_ = tree_a.right_;
228
- {
229
- const _1 = ff_core_Ordering_Order$K.compare_(x_, y_);
230
- {
231
- if(_1.OrderingBefore) {
232
- return ff_core_RbMap.member_(x_, a_, ff_core_Ordering_Order$K)
233
- return
234
- }
235
- }
236
- {
237
- if(_1.OrderingAfter) {
238
- return ff_core_RbMap.member_(x_, b_, ff_core_Ordering_Order$K)
239
- return
240
- }
241
- }
242
- {
243
- if(_1.OrderingSame) {
244
- return true
245
- return
246
- }
247
- }
248
- }
249
- return
250
- }
251
- }
252
- }
253
- }
254
-
255
- export function balance_(tree1_, key_, value_, tree2_, ff_core_Ordering_Order$K) {
256
- {
257
- const tree1_a = tree1_;
258
- const key_a = key_;
259
- const value_a = value_;
260
- const tree2_a = tree2_;
261
- {
262
- if(tree1_a.T) {
263
- if(tree1_a.color_.R) {
264
- const a_ = tree1_a.left_;
265
- const x_ = tree1_a.key_;
266
- const xv_ = tree1_a.value_;
267
- const b_ = tree1_a.right_;
268
- const y_ = key_a;
269
- const yv_ = value_a;
270
- if(tree2_a.T) {
271
- if(tree2_a.color_.R) {
272
- const c_ = tree2_a.left_;
273
- const z_ = tree2_a.key_;
274
- const zv_ = tree2_a.value_;
275
- const d_ = tree2_a.right_;
276
- return ff_core_RbMap.T(ff_core_RbMap.R(), ff_core_RbMap.T(ff_core_RbMap.B(), a_, x_, xv_, b_), y_, yv_, ff_core_RbMap.T(ff_core_RbMap.B(), c_, z_, zv_, d_))
277
- return
278
- }
279
- }
280
- }
281
- }
282
- }
283
- {
284
- if(tree1_a.T) {
285
- if(tree1_a.color_.R) {
286
- if(tree1_a.left_.T) {
287
- if(tree1_a.left_.color_.R) {
288
- const a_ = tree1_a.left_.left_;
289
- const x_ = tree1_a.left_.key_;
290
- const xv_ = tree1_a.left_.value_;
291
- const b_ = tree1_a.left_.right_;
292
- const y_ = tree1_a.key_;
293
- const yv_ = tree1_a.value_;
294
- const c_ = tree1_a.right_;
295
- const z_ = key_a;
296
- const zv_ = value_a;
297
- const d_ = tree2_a;
298
- return ff_core_RbMap.T(ff_core_RbMap.R(), ff_core_RbMap.T(ff_core_RbMap.B(), a_, x_, xv_, b_), y_, yv_, ff_core_RbMap.T(ff_core_RbMap.B(), c_, z_, zv_, d_))
299
- return
300
- }
301
- }
302
- }
303
- }
304
- }
305
- {
306
- if(tree1_a.T) {
307
- if(tree1_a.color_.R) {
308
- const a_ = tree1_a.left_;
309
- const x_ = tree1_a.key_;
310
- const xv_ = tree1_a.value_;
311
- if(tree1_a.right_.T) {
312
- if(tree1_a.right_.color_.R) {
313
- const b_ = tree1_a.right_.left_;
314
- const y_ = tree1_a.right_.key_;
315
- const yv_ = tree1_a.right_.value_;
316
- const c_ = tree1_a.right_.right_;
317
- const z_ = key_a;
318
- const zv_ = value_a;
319
- const d_ = tree2_a;
320
- return ff_core_RbMap.T(ff_core_RbMap.R(), ff_core_RbMap.T(ff_core_RbMap.B(), a_, x_, xv_, b_), y_, yv_, ff_core_RbMap.T(ff_core_RbMap.B(), c_, z_, zv_, d_))
321
- return
322
- }
323
- }
324
- }
325
- }
326
- }
327
- {
328
- const a_ = tree1_a;
329
- const x_ = key_a;
330
- const xv_ = value_a;
331
- if(tree2_a.T) {
332
- if(tree2_a.color_.R) {
333
- const b_ = tree2_a.left_;
334
- const y_ = tree2_a.key_;
335
- const yv_ = tree2_a.value_;
336
- if(tree2_a.right_.T) {
337
- if(tree2_a.right_.color_.R) {
338
- const c_ = tree2_a.right_.left_;
339
- const z_ = tree2_a.right_.key_;
340
- const zv_ = tree2_a.right_.value_;
341
- const d_ = tree2_a.right_.right_;
342
- return ff_core_RbMap.T(ff_core_RbMap.R(), ff_core_RbMap.T(ff_core_RbMap.B(), a_, x_, xv_, b_), y_, yv_, ff_core_RbMap.T(ff_core_RbMap.B(), c_, z_, zv_, d_))
343
- return
344
- }
345
- }
346
- }
347
- }
348
- }
349
- {
350
- const a_ = tree1_a;
351
- const x_ = key_a;
352
- const xv_ = value_a;
353
- if(tree2_a.T) {
354
- if(tree2_a.color_.R) {
355
- if(tree2_a.left_.T) {
356
- if(tree2_a.left_.color_.R) {
357
- const b_ = tree2_a.left_.left_;
358
- const y_ = tree2_a.left_.key_;
359
- const yv_ = tree2_a.left_.value_;
360
- const c_ = tree2_a.left_.right_;
361
- const z_ = tree2_a.key_;
362
- const zv_ = tree2_a.value_;
363
- const d_ = tree2_a.right_;
364
- return ff_core_RbMap.T(ff_core_RbMap.R(), ff_core_RbMap.T(ff_core_RbMap.B(), a_, x_, xv_, b_), y_, yv_, ff_core_RbMap.T(ff_core_RbMap.B(), c_, z_, zv_, d_))
365
- return
366
- }
367
- }
368
- }
369
- }
370
- }
371
- {
372
- const a_ = tree1_a;
373
- const x_ = key_a;
374
- const xv_ = value_a;
375
- const b_ = tree2_a;
376
- return ff_core_RbMap.T(ff_core_RbMap.B(), a_, x_, xv_, b_)
377
- return
378
- }
379
- }
380
- }
381
-
382
- export function delete_(x_, t_, ff_core_Ordering_Order$K) {
383
- function del_(ss_) {
384
- {
385
- const ss_a = ss_;
386
- {
387
- if(ss_a.E) {
388
- return ff_core_RbMap.E()
389
- return
390
- }
391
- }
392
- {
393
- if(ss_a.T) {
394
- const a_ = ss_a.left_;
395
- const y_ = ss_a.key_;
396
- const yv_ = ss_a.value_;
397
- const b_ = ss_a.right_;
398
- {
399
- const _1 = ff_core_Ordering_Order$K.compare_(x_, y_);
400
- {
401
- if(_1.OrderingBefore) {
402
- return delformLeft_(a_, y_, yv_, b_)
403
- return
404
- }
405
- }
406
- {
407
- if(_1.OrderingAfter) {
408
- return delformRight_(a_, y_, yv_, b_)
409
- return
410
- }
411
- }
412
- {
413
- if(_1.OrderingSame) {
414
- return ff_core_RbMap.app_(a_, b_, ff_core_Ordering_Order$K)
415
- return
416
- }
417
- }
418
- }
419
- return
420
- }
421
- }
422
- }
423
- }
424
- function delformLeft_(left_, key_, value_, right_) {
425
- {
426
- const left_a = left_;
427
- const key_a = key_;
428
- const value_a = value_;
429
- const right_a = right_;
430
- {
431
- if(left_a.T) {
432
- if(left_a.color_.B) {
433
- const y_ = key_a;
434
- const yv_ = value_a;
435
- const b_ = right_a;
436
- return ff_core_RbMap.balleft_(del_(left_), y_, yv_, b_, ff_core_Ordering_Order$K)
437
- return
438
- }
439
- }
440
- }
441
- {
442
- const a_ = left_a;
443
- const y_ = key_a;
444
- const yv_ = value_a;
445
- const b_ = right_a;
446
- return ff_core_RbMap.T(ff_core_RbMap.R(), del_(a_), y_, yv_, b_)
447
- return
448
- }
449
- }
450
- }
451
- function delformRight_(left_, key_, value_, right_) {
452
- {
453
- const left_a = left_;
454
- const key_a = key_;
455
- const value_a = value_;
456
- const right_a = right_;
457
- {
458
- const a_ = left_a;
459
- const y_ = key_a;
460
- const yv_ = value_a;
461
- if(right_a.T) {
462
- if(right_a.color_.B) {
463
- return ff_core_RbMap.balright_(a_, y_, yv_, del_(right_), ff_core_Ordering_Order$K)
464
- return
465
- }
466
- }
467
- }
468
- {
469
- const a_ = left_a;
470
- const y_ = key_a;
471
- const yv_ = value_a;
472
- const b_ = right_a;
473
- return ff_core_RbMap.T(ff_core_RbMap.R(), a_, y_, yv_, del_(b_))
474
- return
475
- }
476
- }
477
- }
478
- {
479
- const _1 = del_(t_);
480
- {
481
- if(_1.T) {
482
- const a_ = _1.left_;
483
- const y_ = _1.key_;
484
- const yv_ = _1.value_;
485
- const b_ = _1.right_;
486
- return ff_core_RbMap.T(ff_core_RbMap.B(), a_, y_, yv_, b_)
487
- return
488
- }
489
- }
490
- {
491
- return ff_core_RbMap.E()
492
- return
493
- }
494
- }
495
- }
496
-
497
- export function balleft_(tree1_, key_, value_, tree2_, ff_core_Ordering_Order$K) {
498
- {
499
- const tree1_a = tree1_;
500
- const key_a = key_;
501
- const value_a = value_;
502
- const tree2_a = tree2_;
503
- {
504
- if(tree1_a.T) {
505
- if(tree1_a.color_.R) {
506
- const a_ = tree1_a.left_;
507
- const x_ = tree1_a.key_;
508
- const xv_ = tree1_a.value_;
509
- const b_ = tree1_a.right_;
510
- const y_ = key_a;
511
- const yv_ = value_a;
512
- const c_ = tree2_a;
513
- return ff_core_RbMap.T(ff_core_RbMap.R(), ff_core_RbMap.T(ff_core_RbMap.B(), a_, x_, xv_, b_), y_, yv_, c_)
514
- return
515
- }
516
- }
517
- }
518
- {
519
- const bl_ = tree1_a;
520
- const x_ = key_a;
521
- const xv_ = value_a;
522
- if(tree2_a.T) {
523
- if(tree2_a.color_.B) {
524
- const a_ = tree2_a.left_;
525
- const y_ = tree2_a.key_;
526
- const yv_ = tree2_a.value_;
527
- const b_ = tree2_a.right_;
528
- return ff_core_RbMap.balance_(bl_, x_, xv_, ff_core_RbMap.T(ff_core_RbMap.R(), a_, y_, yv_, b_), ff_core_Ordering_Order$K)
529
- return
530
- }
531
- }
532
- }
533
- {
534
- const bl_ = tree1_a;
535
- const x_ = key_a;
536
- const xv_ = value_a;
537
- if(tree2_a.T) {
538
- if(tree2_a.color_.R) {
539
- if(tree2_a.left_.T) {
540
- if(tree2_a.left_.color_.B) {
541
- const a_ = tree2_a.left_.left_;
542
- const y_ = tree2_a.left_.key_;
543
- const yv_ = tree2_a.left_.value_;
544
- const b_ = tree2_a.left_.right_;
545
- const z_ = tree2_a.key_;
546
- const zv_ = tree2_a.value_;
547
- const c_ = tree2_a.right_;
548
- return ff_core_RbMap.T(ff_core_RbMap.R(), ff_core_RbMap.T(ff_core_RbMap.B(), bl_, x_, xv_, a_), y_, yv_, ff_core_RbMap.balance_(b_, z_, zv_, ff_core_RbMap.sub1_(c_, ff_core_Ordering_Order$K), ff_core_Ordering_Order$K))
549
- return
550
- }
551
- }
552
- }
553
- }
554
- }
555
- {
556
- return ff_core_Core.panic_("Unexhaustive match in balleft")
557
- return
558
- }
559
- }
560
- }
561
-
562
- export function balright_(tree1_, key_, value_, tree2_, ff_core_Ordering_Order$K) {
563
- {
564
- const tree1_a = tree1_;
565
- const key_a = key_;
566
- const value_a = value_;
567
- const tree2_a = tree2_;
568
- {
569
- const a_ = tree1_a;
570
- const x_ = key_a;
571
- const xv_ = value_a;
572
- if(tree2_a.T) {
573
- if(tree2_a.color_.R) {
574
- const b_ = tree2_a.left_;
575
- const y_ = tree2_a.key_;
576
- const yv_ = tree2_a.value_;
577
- const c_ = tree2_a.right_;
578
- return ff_core_RbMap.T(ff_core_RbMap.R(), a_, x_, xv_, ff_core_RbMap.T(ff_core_RbMap.B(), b_, y_, yv_, c_))
579
- return
580
- }
581
- }
582
- }
583
- {
584
- if(tree1_a.T) {
585
- if(tree1_a.color_.B) {
586
- const a_ = tree1_a.left_;
587
- const x_ = tree1_a.key_;
588
- const xv_ = tree1_a.value_;
589
- const b_ = tree1_a.right_;
590
- const y_ = key_a;
591
- const yv_ = value_a;
592
- const bl_ = tree2_a;
593
- return ff_core_RbMap.balance_(ff_core_RbMap.T(ff_core_RbMap.R(), a_, x_, xv_, b_), y_, yv_, bl_, ff_core_Ordering_Order$K)
594
- return
595
- }
596
- }
597
- }
598
- {
599
- if(tree1_a.T) {
600
- if(tree1_a.color_.R) {
601
- const a_ = tree1_a.left_;
602
- const x_ = tree1_a.key_;
603
- const xv_ = tree1_a.value_;
604
- if(tree1_a.right_.T) {
605
- if(tree1_a.right_.color_.B) {
606
- const b_ = tree1_a.right_.left_;
607
- const y_ = tree1_a.right_.key_;
608
- const yv_ = tree1_a.right_.value_;
609
- const c_ = tree1_a.right_.right_;
610
- const z_ = key_a;
611
- const zv_ = value_a;
612
- const bl_ = tree2_a;
613
- return ff_core_RbMap.T(ff_core_RbMap.R(), ff_core_RbMap.balance_(ff_core_RbMap.sub1_(a_, ff_core_Ordering_Order$K), x_, xv_, b_, ff_core_Ordering_Order$K), y_, yv_, ff_core_RbMap.T(ff_core_RbMap.B(), c_, z_, zv_, bl_))
614
- return
615
- }
616
- }
617
- }
618
- }
619
- }
620
- {
621
- return ff_core_Core.panic_("Unexhaustive match in balright")
622
- return
623
- }
624
- }
625
- }
626
-
627
- export function sub1_(tree_, ff_core_Ordering_Order$K) {
628
- {
629
- const tree_a = tree_;
630
- {
631
- if(tree_a.T) {
632
- if(tree_a.color_.B) {
633
- const a_ = tree_a.left_;
634
- const x_ = tree_a.key_;
635
- const xv_ = tree_a.value_;
636
- const b_ = tree_a.right_;
637
- return ff_core_RbMap.T(ff_core_RbMap.R(), a_, x_, xv_, b_)
638
- return
639
- }
640
- }
641
- }
642
- {
643
- return ff_core_Core.panic_("invariance violation")
644
- return
645
- }
646
- }
647
- }
648
-
649
- export function app_(tree1_, tree2_, ff_core_Ordering_Order$K) {
650
- {
651
- const tree1_a = tree1_;
652
- const tree2_a = tree2_;
653
- {
654
- if(tree1_a.E) {
655
- const b_ = tree2_a;
656
- return b_
657
- return
658
- }
659
- }
660
- {
661
- const a_ = tree1_a;
662
- if(tree2_a.E) {
663
- return a_
664
- return
665
- }
666
- }
667
- {
668
- if(tree1_a.T) {
669
- if(tree1_a.color_.R) {
670
- const a_ = tree1_a.left_;
671
- const x_ = tree1_a.key_;
672
- const xv_ = tree1_a.value_;
673
- const b_ = tree1_a.right_;
674
- if(tree2_a.T) {
675
- if(tree2_a.color_.R) {
676
- const c_ = tree2_a.left_;
677
- const y_ = tree2_a.key_;
678
- const yv_ = tree2_a.value_;
679
- const d_ = tree2_a.right_;
680
- {
681
- const _1 = ff_core_RbMap.app_(b_, c_, ff_core_Ordering_Order$K);
682
- {
683
- if(_1.T) {
684
- if(_1.color_.R) {
685
- const b2_ = _1.left_;
686
- const z_ = _1.key_;
687
- const zv_ = _1.value_;
688
- const c2_ = _1.right_;
689
- return ff_core_RbMap.T(ff_core_RbMap.R(), ff_core_RbMap.T(ff_core_RbMap.R(), a_, x_, xv_, b2_), z_, zv_, ff_core_RbMap.T(ff_core_RbMap.R(), c2_, y_, yv_, d_))
690
- return
691
- }
692
- }
693
- }
694
- {
695
- const bc_ = _1;
696
- return ff_core_RbMap.T(ff_core_RbMap.R(), a_, x_, xv_, ff_core_RbMap.T(ff_core_RbMap.R(), bc_, y_, yv_, d_))
697
- return
698
- }
699
- }
700
- return
701
- }
702
- }
703
- }
704
- }
705
- }
706
- {
707
- if(tree1_a.T) {
708
- if(tree1_a.color_.B) {
709
- const a_ = tree1_a.left_;
710
- const x_ = tree1_a.key_;
711
- const xv_ = tree1_a.value_;
712
- const b_ = tree1_a.right_;
713
- if(tree2_a.T) {
714
- if(tree2_a.color_.B) {
715
- const c_ = tree2_a.left_;
716
- const y_ = tree2_a.key_;
717
- const yv_ = tree2_a.value_;
718
- const d_ = tree2_a.right_;
719
- {
720
- const _1 = ff_core_RbMap.app_(b_, c_, ff_core_Ordering_Order$K);
721
- {
722
- if(_1.T) {
723
- if(_1.color_.R) {
724
- const b2_ = _1.left_;
725
- const z_ = _1.key_;
726
- const zv_ = _1.value_;
727
- const c2_ = _1.right_;
728
- return ff_core_RbMap.T(ff_core_RbMap.R(), ff_core_RbMap.T(ff_core_RbMap.B(), a_, x_, xv_, b2_), z_, zv_, ff_core_RbMap.T(ff_core_RbMap.B(), c2_, y_, yv_, d_))
729
- return
730
- }
731
- }
732
- }
733
- {
734
- const bc_ = _1;
735
- return ff_core_RbMap.balleft_(a_, x_, xv_, ff_core_RbMap.T(ff_core_RbMap.B(), bc_, y_, yv_, d_), ff_core_Ordering_Order$K)
736
- return
737
- }
738
- }
739
- return
740
- }
741
- }
742
- }
743
- }
744
- }
745
- {
746
- const a_ = tree1_a;
747
- if(tree2_a.T) {
748
- if(tree2_a.color_.R) {
749
- const b_ = tree2_a.left_;
750
- const x_ = tree2_a.key_;
751
- const xv_ = tree2_a.value_;
752
- const c_ = tree2_a.right_;
753
- return ff_core_RbMap.T(ff_core_RbMap.R(), ff_core_RbMap.app_(a_, b_, ff_core_Ordering_Order$K), x_, xv_, c_)
754
- return
755
- }
756
- }
757
- }
758
- {
759
- if(tree1_a.T) {
760
- if(tree1_a.color_.R) {
761
- const a_ = tree1_a.left_;
762
- const x_ = tree1_a.key_;
763
- const xv_ = tree1_a.value_;
764
- const b_ = tree1_a.right_;
765
- const c_ = tree2_a;
766
- return ff_core_RbMap.T(ff_core_RbMap.R(), a_, x_, xv_, ff_core_RbMap.app_(b_, c_, ff_core_Ordering_Order$K))
767
- return
768
- }
769
- }
770
- }
771
- }
772
- }
773
-
774
- export async function insert_$(x_, xv_, s_, ff_core_Ordering_Order$K, $task) {
775
- function ins_(s_) {
776
- {
777
- const s_a = s_;
778
- {
779
- if(s_a.E) {
780
- return ff_core_RbMap.T(ff_core_RbMap.R(), ff_core_RbMap.E(), x_, xv_, ff_core_RbMap.E())
781
- return
782
- }
783
- }
784
- {
785
- if(s_a.T) {
786
- if(s_a.color_.B) {
787
- const a_ = s_a.left_;
788
- const y_ = s_a.key_;
789
- const yv_ = s_a.value_;
790
- const b_ = s_a.right_;
791
- {
792
- const _1 = ff_core_Ordering_Order$K.compare_(x_, y_);
793
- {
794
- if(_1.OrderingBefore) {
795
- return ff_core_RbMap.balance_(ins_(a_), y_, yv_, b_, ff_core_Ordering_Order$K)
796
- return
797
- }
798
- }
799
- {
800
- if(_1.OrderingAfter) {
801
- return ff_core_RbMap.balance_(a_, y_, yv_, ins_(b_), ff_core_Ordering_Order$K)
802
- return
803
- }
804
- }
805
- {
806
- if(_1.OrderingSame) {
807
- return ff_core_RbMap.T(ff_core_RbMap.B(), a_, x_, xv_, b_)
808
- return
809
- }
810
- }
811
- }
812
- return
813
- }
814
- }
815
- }
816
- {
817
- if(s_a.T) {
818
- if(s_a.color_.R) {
819
- const a_ = s_a.left_;
820
- const y_ = s_a.key_;
821
- const yv_ = s_a.value_;
822
- const b_ = s_a.right_;
823
- {
824
- const _1 = ff_core_Ordering_Order$K.compare_(x_, y_);
825
- {
826
- if(_1.OrderingBefore) {
827
- return ff_core_RbMap.T(ff_core_RbMap.R(), ins_(a_), y_, yv_, b_)
828
- return
829
- }
830
- }
831
- {
832
- if(_1.OrderingAfter) {
833
- return ff_core_RbMap.T(ff_core_RbMap.R(), a_, y_, yv_, ins_(b_))
834
- return
835
- }
836
- }
837
- {
838
- if(_1.OrderingSame) {
839
- return ff_core_RbMap.T(ff_core_RbMap.R(), a_, x_, xv_, b_)
840
- return
841
- }
842
- }
843
- }
844
- return
845
- }
846
- }
847
- }
848
- }
849
- }
850
- {
851
- const _1 = ins_(s_);
852
- {
853
- if(_1.E) {
854
- return ff_core_Core.panic_("Unexpected empty tree")
855
- return
856
- }
857
- }
858
- {
859
- if(_1.T) {
860
- const a_ = _1.left_;
861
- const z_ = _1.key_;
862
- const zv_ = _1.value_;
863
- const b_ = _1.right_;
864
- return ff_core_RbMap.T(ff_core_RbMap.B(), a_, z_, zv_, b_)
865
- return
866
- }
867
- }
868
- }
869
- }
870
-
871
- export async function member_$(key_, tree_, ff_core_Ordering_Order$K, $task) {
872
- {
873
- const key_a = key_;
874
- const tree_a = tree_;
875
- {
876
- const x_ = key_a;
877
- if(tree_a.E) {
878
- return false
879
- return
880
- }
881
- }
882
- {
883
- const x_ = key_a;
884
- if(tree_a.T) {
885
- const a_ = tree_a.left_;
886
- const y_ = tree_a.key_;
887
- const b_ = tree_a.right_;
888
- {
889
- const _1 = ff_core_Ordering_Order$K.compare_(x_, y_);
890
- {
891
- if(_1.OrderingBefore) {
892
- return ff_core_RbMap.member_(x_, a_, ff_core_Ordering_Order$K)
893
- return
894
- }
895
- }
896
- {
897
- if(_1.OrderingAfter) {
898
- return ff_core_RbMap.member_(x_, b_, ff_core_Ordering_Order$K)
899
- return
900
- }
901
- }
902
- {
903
- if(_1.OrderingSame) {
904
- return true
905
- return
906
- }
907
- }
908
- }
909
- return
910
- }
911
- }
912
- }
913
- }
914
-
915
- export async function balance_$(tree1_, key_, value_, tree2_, ff_core_Ordering_Order$K, $task) {
916
- {
917
- const tree1_a = tree1_;
918
- const key_a = key_;
919
- const value_a = value_;
920
- const tree2_a = tree2_;
921
- {
922
- if(tree1_a.T) {
923
- if(tree1_a.color_.R) {
924
- const a_ = tree1_a.left_;
925
- const x_ = tree1_a.key_;
926
- const xv_ = tree1_a.value_;
927
- const b_ = tree1_a.right_;
928
- const y_ = key_a;
929
- const yv_ = value_a;
930
- if(tree2_a.T) {
931
- if(tree2_a.color_.R) {
932
- const c_ = tree2_a.left_;
933
- const z_ = tree2_a.key_;
934
- const zv_ = tree2_a.value_;
935
- const d_ = tree2_a.right_;
936
- return ff_core_RbMap.T(ff_core_RbMap.R(), ff_core_RbMap.T(ff_core_RbMap.B(), a_, x_, xv_, b_), y_, yv_, ff_core_RbMap.T(ff_core_RbMap.B(), c_, z_, zv_, d_))
937
- return
938
- }
939
- }
940
- }
941
- }
942
- }
943
- {
944
- if(tree1_a.T) {
945
- if(tree1_a.color_.R) {
946
- if(tree1_a.left_.T) {
947
- if(tree1_a.left_.color_.R) {
948
- const a_ = tree1_a.left_.left_;
949
- const x_ = tree1_a.left_.key_;
950
- const xv_ = tree1_a.left_.value_;
951
- const b_ = tree1_a.left_.right_;
952
- const y_ = tree1_a.key_;
953
- const yv_ = tree1_a.value_;
954
- const c_ = tree1_a.right_;
955
- const z_ = key_a;
956
- const zv_ = value_a;
957
- const d_ = tree2_a;
958
- return ff_core_RbMap.T(ff_core_RbMap.R(), ff_core_RbMap.T(ff_core_RbMap.B(), a_, x_, xv_, b_), y_, yv_, ff_core_RbMap.T(ff_core_RbMap.B(), c_, z_, zv_, d_))
959
- return
960
- }
961
- }
962
- }
963
- }
964
- }
965
- {
966
- if(tree1_a.T) {
967
- if(tree1_a.color_.R) {
968
- const a_ = tree1_a.left_;
969
- const x_ = tree1_a.key_;
970
- const xv_ = tree1_a.value_;
971
- if(tree1_a.right_.T) {
972
- if(tree1_a.right_.color_.R) {
973
- const b_ = tree1_a.right_.left_;
974
- const y_ = tree1_a.right_.key_;
975
- const yv_ = tree1_a.right_.value_;
976
- const c_ = tree1_a.right_.right_;
977
- const z_ = key_a;
978
- const zv_ = value_a;
979
- const d_ = tree2_a;
980
- return ff_core_RbMap.T(ff_core_RbMap.R(), ff_core_RbMap.T(ff_core_RbMap.B(), a_, x_, xv_, b_), y_, yv_, ff_core_RbMap.T(ff_core_RbMap.B(), c_, z_, zv_, d_))
981
- return
982
- }
983
- }
984
- }
985
- }
986
- }
987
- {
988
- const a_ = tree1_a;
989
- const x_ = key_a;
990
- const xv_ = value_a;
991
- if(tree2_a.T) {
992
- if(tree2_a.color_.R) {
993
- const b_ = tree2_a.left_;
994
- const y_ = tree2_a.key_;
995
- const yv_ = tree2_a.value_;
996
- if(tree2_a.right_.T) {
997
- if(tree2_a.right_.color_.R) {
998
- const c_ = tree2_a.right_.left_;
999
- const z_ = tree2_a.right_.key_;
1000
- const zv_ = tree2_a.right_.value_;
1001
- const d_ = tree2_a.right_.right_;
1002
- return ff_core_RbMap.T(ff_core_RbMap.R(), ff_core_RbMap.T(ff_core_RbMap.B(), a_, x_, xv_, b_), y_, yv_, ff_core_RbMap.T(ff_core_RbMap.B(), c_, z_, zv_, d_))
1003
- return
1004
- }
1005
- }
1006
- }
1007
- }
1008
- }
1009
- {
1010
- const a_ = tree1_a;
1011
- const x_ = key_a;
1012
- const xv_ = value_a;
1013
- if(tree2_a.T) {
1014
- if(tree2_a.color_.R) {
1015
- if(tree2_a.left_.T) {
1016
- if(tree2_a.left_.color_.R) {
1017
- const b_ = tree2_a.left_.left_;
1018
- const y_ = tree2_a.left_.key_;
1019
- const yv_ = tree2_a.left_.value_;
1020
- const c_ = tree2_a.left_.right_;
1021
- const z_ = tree2_a.key_;
1022
- const zv_ = tree2_a.value_;
1023
- const d_ = tree2_a.right_;
1024
- return ff_core_RbMap.T(ff_core_RbMap.R(), ff_core_RbMap.T(ff_core_RbMap.B(), a_, x_, xv_, b_), y_, yv_, ff_core_RbMap.T(ff_core_RbMap.B(), c_, z_, zv_, d_))
1025
- return
1026
- }
1027
- }
1028
- }
1029
- }
1030
- }
1031
- {
1032
- const a_ = tree1_a;
1033
- const x_ = key_a;
1034
- const xv_ = value_a;
1035
- const b_ = tree2_a;
1036
- return ff_core_RbMap.T(ff_core_RbMap.B(), a_, x_, xv_, b_)
1037
- return
1038
- }
1039
- }
1040
- }
1041
-
1042
- export async function delete_$(x_, t_, ff_core_Ordering_Order$K, $task) {
1043
- function del_(ss_) {
1044
- {
1045
- const ss_a = ss_;
1046
- {
1047
- if(ss_a.E) {
1048
- return ff_core_RbMap.E()
1049
- return
1050
- }
1051
- }
1052
- {
1053
- if(ss_a.T) {
1054
- const a_ = ss_a.left_;
1055
- const y_ = ss_a.key_;
1056
- const yv_ = ss_a.value_;
1057
- const b_ = ss_a.right_;
1058
- {
1059
- const _1 = ff_core_Ordering_Order$K.compare_(x_, y_);
1060
- {
1061
- if(_1.OrderingBefore) {
1062
- return delformLeft_(a_, y_, yv_, b_)
1063
- return
1064
- }
1065
- }
1066
- {
1067
- if(_1.OrderingAfter) {
1068
- return delformRight_(a_, y_, yv_, b_)
1069
- return
1070
- }
1071
- }
1072
- {
1073
- if(_1.OrderingSame) {
1074
- return ff_core_RbMap.app_(a_, b_, ff_core_Ordering_Order$K)
1075
- return
1076
- }
1077
- }
1078
- }
1079
- return
1080
- }
1081
- }
1082
- }
1083
- }
1084
- function delformLeft_(left_, key_, value_, right_) {
1085
- {
1086
- const left_a = left_;
1087
- const key_a = key_;
1088
- const value_a = value_;
1089
- const right_a = right_;
1090
- {
1091
- if(left_a.T) {
1092
- if(left_a.color_.B) {
1093
- const y_ = key_a;
1094
- const yv_ = value_a;
1095
- const b_ = right_a;
1096
- return ff_core_RbMap.balleft_(del_(left_), y_, yv_, b_, ff_core_Ordering_Order$K)
1097
- return
1098
- }
1099
- }
1100
- }
1101
- {
1102
- const a_ = left_a;
1103
- const y_ = key_a;
1104
- const yv_ = value_a;
1105
- const b_ = right_a;
1106
- return ff_core_RbMap.T(ff_core_RbMap.R(), del_(a_), y_, yv_, b_)
1107
- return
1108
- }
1109
- }
1110
- }
1111
- function delformRight_(left_, key_, value_, right_) {
1112
- {
1113
- const left_a = left_;
1114
- const key_a = key_;
1115
- const value_a = value_;
1116
- const right_a = right_;
1117
- {
1118
- const a_ = left_a;
1119
- const y_ = key_a;
1120
- const yv_ = value_a;
1121
- if(right_a.T) {
1122
- if(right_a.color_.B) {
1123
- return ff_core_RbMap.balright_(a_, y_, yv_, del_(right_), ff_core_Ordering_Order$K)
1124
- return
1125
- }
1126
- }
1127
- }
1128
- {
1129
- const a_ = left_a;
1130
- const y_ = key_a;
1131
- const yv_ = value_a;
1132
- const b_ = right_a;
1133
- return ff_core_RbMap.T(ff_core_RbMap.R(), a_, y_, yv_, del_(b_))
1134
- return
1135
- }
1136
- }
1137
- }
1138
- {
1139
- const _1 = del_(t_);
1140
- {
1141
- if(_1.T) {
1142
- const a_ = _1.left_;
1143
- const y_ = _1.key_;
1144
- const yv_ = _1.value_;
1145
- const b_ = _1.right_;
1146
- return ff_core_RbMap.T(ff_core_RbMap.B(), a_, y_, yv_, b_)
1147
- return
1148
- }
1149
- }
1150
- {
1151
- return ff_core_RbMap.E()
1152
- return
1153
- }
1154
- }
1155
- }
1156
-
1157
- export async function balleft_$(tree1_, key_, value_, tree2_, ff_core_Ordering_Order$K, $task) {
1158
- {
1159
- const tree1_a = tree1_;
1160
- const key_a = key_;
1161
- const value_a = value_;
1162
- const tree2_a = tree2_;
1163
- {
1164
- if(tree1_a.T) {
1165
- if(tree1_a.color_.R) {
1166
- const a_ = tree1_a.left_;
1167
- const x_ = tree1_a.key_;
1168
- const xv_ = tree1_a.value_;
1169
- const b_ = tree1_a.right_;
1170
- const y_ = key_a;
1171
- const yv_ = value_a;
1172
- const c_ = tree2_a;
1173
- return ff_core_RbMap.T(ff_core_RbMap.R(), ff_core_RbMap.T(ff_core_RbMap.B(), a_, x_, xv_, b_), y_, yv_, c_)
1174
- return
1175
- }
1176
- }
1177
- }
1178
- {
1179
- const bl_ = tree1_a;
1180
- const x_ = key_a;
1181
- const xv_ = value_a;
1182
- if(tree2_a.T) {
1183
- if(tree2_a.color_.B) {
1184
- const a_ = tree2_a.left_;
1185
- const y_ = tree2_a.key_;
1186
- const yv_ = tree2_a.value_;
1187
- const b_ = tree2_a.right_;
1188
- return ff_core_RbMap.balance_(bl_, x_, xv_, ff_core_RbMap.T(ff_core_RbMap.R(), a_, y_, yv_, b_), ff_core_Ordering_Order$K)
1189
- return
1190
- }
1191
- }
1192
- }
1193
- {
1194
- const bl_ = tree1_a;
1195
- const x_ = key_a;
1196
- const xv_ = value_a;
1197
- if(tree2_a.T) {
1198
- if(tree2_a.color_.R) {
1199
- if(tree2_a.left_.T) {
1200
- if(tree2_a.left_.color_.B) {
1201
- const a_ = tree2_a.left_.left_;
1202
- const y_ = tree2_a.left_.key_;
1203
- const yv_ = tree2_a.left_.value_;
1204
- const b_ = tree2_a.left_.right_;
1205
- const z_ = tree2_a.key_;
1206
- const zv_ = tree2_a.value_;
1207
- const c_ = tree2_a.right_;
1208
- return ff_core_RbMap.T(ff_core_RbMap.R(), ff_core_RbMap.T(ff_core_RbMap.B(), bl_, x_, xv_, a_), y_, yv_, ff_core_RbMap.balance_(b_, z_, zv_, ff_core_RbMap.sub1_(c_, ff_core_Ordering_Order$K), ff_core_Ordering_Order$K))
1209
- return
1210
- }
1211
- }
1212
- }
1213
- }
1214
- }
1215
- {
1216
- return ff_core_Core.panic_("Unexhaustive match in balleft")
1217
- return
1218
- }
1219
- }
1220
- }
1221
-
1222
- export async function balright_$(tree1_, key_, value_, tree2_, ff_core_Ordering_Order$K, $task) {
1223
- {
1224
- const tree1_a = tree1_;
1225
- const key_a = key_;
1226
- const value_a = value_;
1227
- const tree2_a = tree2_;
1228
- {
1229
- const a_ = tree1_a;
1230
- const x_ = key_a;
1231
- const xv_ = value_a;
1232
- if(tree2_a.T) {
1233
- if(tree2_a.color_.R) {
1234
- const b_ = tree2_a.left_;
1235
- const y_ = tree2_a.key_;
1236
- const yv_ = tree2_a.value_;
1237
- const c_ = tree2_a.right_;
1238
- return ff_core_RbMap.T(ff_core_RbMap.R(), a_, x_, xv_, ff_core_RbMap.T(ff_core_RbMap.B(), b_, y_, yv_, c_))
1239
- return
1240
- }
1241
- }
1242
- }
1243
- {
1244
- if(tree1_a.T) {
1245
- if(tree1_a.color_.B) {
1246
- const a_ = tree1_a.left_;
1247
- const x_ = tree1_a.key_;
1248
- const xv_ = tree1_a.value_;
1249
- const b_ = tree1_a.right_;
1250
- const y_ = key_a;
1251
- const yv_ = value_a;
1252
- const bl_ = tree2_a;
1253
- return ff_core_RbMap.balance_(ff_core_RbMap.T(ff_core_RbMap.R(), a_, x_, xv_, b_), y_, yv_, bl_, ff_core_Ordering_Order$K)
1254
- return
1255
- }
1256
- }
1257
- }
1258
- {
1259
- if(tree1_a.T) {
1260
- if(tree1_a.color_.R) {
1261
- const a_ = tree1_a.left_;
1262
- const x_ = tree1_a.key_;
1263
- const xv_ = tree1_a.value_;
1264
- if(tree1_a.right_.T) {
1265
- if(tree1_a.right_.color_.B) {
1266
- const b_ = tree1_a.right_.left_;
1267
- const y_ = tree1_a.right_.key_;
1268
- const yv_ = tree1_a.right_.value_;
1269
- const c_ = tree1_a.right_.right_;
1270
- const z_ = key_a;
1271
- const zv_ = value_a;
1272
- const bl_ = tree2_a;
1273
- return ff_core_RbMap.T(ff_core_RbMap.R(), ff_core_RbMap.balance_(ff_core_RbMap.sub1_(a_, ff_core_Ordering_Order$K), x_, xv_, b_, ff_core_Ordering_Order$K), y_, yv_, ff_core_RbMap.T(ff_core_RbMap.B(), c_, z_, zv_, bl_))
1274
- return
1275
- }
1276
- }
1277
- }
1278
- }
1279
- }
1280
- {
1281
- return ff_core_Core.panic_("Unexhaustive match in balright")
1282
- return
1283
- }
1284
- }
1285
- }
1286
-
1287
- export async function sub1_$(tree_, ff_core_Ordering_Order$K, $task) {
1288
- {
1289
- const tree_a = tree_;
1290
- {
1291
- if(tree_a.T) {
1292
- if(tree_a.color_.B) {
1293
- const a_ = tree_a.left_;
1294
- const x_ = tree_a.key_;
1295
- const xv_ = tree_a.value_;
1296
- const b_ = tree_a.right_;
1297
- return ff_core_RbMap.T(ff_core_RbMap.R(), a_, x_, xv_, b_)
1298
- return
1299
- }
1300
- }
1301
- }
1302
- {
1303
- return ff_core_Core.panic_("invariance violation")
1304
- return
1305
- }
1306
- }
1307
- }
1308
-
1309
- export async function app_$(tree1_, tree2_, ff_core_Ordering_Order$K, $task) {
1310
- {
1311
- const tree1_a = tree1_;
1312
- const tree2_a = tree2_;
1313
- {
1314
- if(tree1_a.E) {
1315
- const b_ = tree2_a;
1316
- return b_
1317
- return
1318
- }
1319
- }
1320
- {
1321
- const a_ = tree1_a;
1322
- if(tree2_a.E) {
1323
- return a_
1324
- return
1325
- }
1326
- }
1327
- {
1328
- if(tree1_a.T) {
1329
- if(tree1_a.color_.R) {
1330
- const a_ = tree1_a.left_;
1331
- const x_ = tree1_a.key_;
1332
- const xv_ = tree1_a.value_;
1333
- const b_ = tree1_a.right_;
1334
- if(tree2_a.T) {
1335
- if(tree2_a.color_.R) {
1336
- const c_ = tree2_a.left_;
1337
- const y_ = tree2_a.key_;
1338
- const yv_ = tree2_a.value_;
1339
- const d_ = tree2_a.right_;
1340
- {
1341
- const _1 = ff_core_RbMap.app_(b_, c_, ff_core_Ordering_Order$K);
1342
- {
1343
- if(_1.T) {
1344
- if(_1.color_.R) {
1345
- const b2_ = _1.left_;
1346
- const z_ = _1.key_;
1347
- const zv_ = _1.value_;
1348
- const c2_ = _1.right_;
1349
- return ff_core_RbMap.T(ff_core_RbMap.R(), ff_core_RbMap.T(ff_core_RbMap.R(), a_, x_, xv_, b2_), z_, zv_, ff_core_RbMap.T(ff_core_RbMap.R(), c2_, y_, yv_, d_))
1350
- return
1351
- }
1352
- }
1353
- }
1354
- {
1355
- const bc_ = _1;
1356
- return ff_core_RbMap.T(ff_core_RbMap.R(), a_, x_, xv_, ff_core_RbMap.T(ff_core_RbMap.R(), bc_, y_, yv_, d_))
1357
- return
1358
- }
1359
- }
1360
- return
1361
- }
1362
- }
1363
- }
1364
- }
1365
- }
1366
- {
1367
- if(tree1_a.T) {
1368
- if(tree1_a.color_.B) {
1369
- const a_ = tree1_a.left_;
1370
- const x_ = tree1_a.key_;
1371
- const xv_ = tree1_a.value_;
1372
- const b_ = tree1_a.right_;
1373
- if(tree2_a.T) {
1374
- if(tree2_a.color_.B) {
1375
- const c_ = tree2_a.left_;
1376
- const y_ = tree2_a.key_;
1377
- const yv_ = tree2_a.value_;
1378
- const d_ = tree2_a.right_;
1379
- {
1380
- const _1 = ff_core_RbMap.app_(b_, c_, ff_core_Ordering_Order$K);
1381
- {
1382
- if(_1.T) {
1383
- if(_1.color_.R) {
1384
- const b2_ = _1.left_;
1385
- const z_ = _1.key_;
1386
- const zv_ = _1.value_;
1387
- const c2_ = _1.right_;
1388
- return ff_core_RbMap.T(ff_core_RbMap.R(), ff_core_RbMap.T(ff_core_RbMap.B(), a_, x_, xv_, b2_), z_, zv_, ff_core_RbMap.T(ff_core_RbMap.B(), c2_, y_, yv_, d_))
1389
- return
1390
- }
1391
- }
1392
- }
1393
- {
1394
- const bc_ = _1;
1395
- return ff_core_RbMap.balleft_(a_, x_, xv_, ff_core_RbMap.T(ff_core_RbMap.B(), bc_, y_, yv_, d_), ff_core_Ordering_Order$K)
1396
- return
1397
- }
1398
- }
1399
- return
1400
- }
1401
- }
1402
- }
1403
- }
1404
- }
1405
- {
1406
- const a_ = tree1_a;
1407
- if(tree2_a.T) {
1408
- if(tree2_a.color_.R) {
1409
- const b_ = tree2_a.left_;
1410
- const x_ = tree2_a.key_;
1411
- const xv_ = tree2_a.value_;
1412
- const c_ = tree2_a.right_;
1413
- return ff_core_RbMap.T(ff_core_RbMap.R(), ff_core_RbMap.app_(a_, b_, ff_core_Ordering_Order$K), x_, xv_, c_)
1414
- return
1415
- }
1416
- }
1417
- }
1418
- {
1419
- if(tree1_a.T) {
1420
- if(tree1_a.color_.R) {
1421
- const a_ = tree1_a.left_;
1422
- const x_ = tree1_a.key_;
1423
- const xv_ = tree1_a.value_;
1424
- const b_ = tree1_a.right_;
1425
- const c_ = tree2_a;
1426
- return ff_core_RbMap.T(ff_core_RbMap.R(), a_, x_, xv_, ff_core_RbMap.app_(b_, c_, ff_core_Ordering_Order$K))
1427
- return
1428
- }
1429
- }
1430
- }
1431
- }
1432
- }
1433
-
1434
- export function RB_get(self_, key_, ff_core_Ordering_Order$K) {
1435
- {
1436
- const _1 = self_;
1437
- {
1438
- if(_1.E) {
1439
- return ff_core_Option.None()
1440
- return
1441
- }
1442
- }
1443
- {
1444
- if(_1.T) {
1445
- const a_ = _1.left_;
1446
- const y_ = _1.key_;
1447
- const yv_ = _1.value_;
1448
- const b_ = _1.right_;
1449
- {
1450
- const _1 = ff_core_Ordering_Order$K.compare_(key_, y_);
1451
- {
1452
- if(_1.OrderingBefore) {
1453
- return ff_core_RbMap.RB_get(a_, key_, ff_core_Ordering_Order$K)
1454
- return
1455
- }
1456
- }
1457
- {
1458
- if(_1.OrderingAfter) {
1459
- return ff_core_RbMap.RB_get(b_, key_, ff_core_Ordering_Order$K)
1460
- return
1461
- }
1462
- }
1463
- {
1464
- if(_1.OrderingSame) {
1465
- return ff_core_Option.Some(yv_)
1466
- return
1467
- }
1468
- }
1469
- }
1470
- return
1471
- }
1472
- }
1473
- }
1474
- }
1475
-
1476
- export function RB_size(self_, ff_core_Ordering_Order$K) {
1477
- {
1478
- const _1 = self_;
1479
- {
1480
- if(_1.E) {
1481
- return 0
1482
- return
1483
- }
1484
- }
1485
- {
1486
- if(_1.T) {
1487
- const l_ = _1.left_;
1488
- const r_ = _1.right_;
1489
- return ((ff_core_RbMap.RB_size(l_, ff_core_Ordering_Order$K) + 1) + ff_core_RbMap.RB_size(r_, ff_core_Ordering_Order$K))
1490
- return
1491
- }
1492
- }
1493
- }
1494
- }
1495
-
1496
- export function RB_pairs(self_, ff_core_Ordering_Order$K) {
1497
- let result_ = ff_core_List.Empty();
1498
- ff_core_RbMap.RB_each(self_, ((k_, v_) => {
1499
- result_ = ff_core_List.Link(ff_core_Pair.Pair(k_, v_), result_)
1500
- }), ff_core_Ordering_Order$K);
1501
- return ff_core_List.List_reverse(result_)
1502
- }
1503
-
1504
- export function RB_toStream(self_, cycle_, ff_core_Ordering_Order$K) {
1505
- let stack_ = ff_core_List.Link(self_, ff_core_List.Empty());
1506
- function next_() {
1507
- _tailcall: for(;;) {
1508
- {
1509
- const _1 = stack_;
1510
- {
1511
- if(_1.Empty) {
1512
- if((cycle_ && (((_1) => {
1513
- {
1514
- if(_1.E) {
1515
- return false
1516
- return
1517
- }
1518
- }
1519
- {
1520
- return true
1521
- return
1522
- }
1523
- }))(self_))) {
1524
- stack_ = ff_core_List.Link(self_, ff_core_List.Empty());
1525
- {
1526
-
1527
-
1528
- continue _tailcall
1529
- }
1530
- } else {
1531
- return ff_core_Option.None()
1532
- }
1533
- return
1534
- }
1535
- }
1536
- {
1537
- if(_1.Link) {
1538
- if(_1.head_.E) {
1539
- const tail_ = _1.tail_;
1540
- stack_ = tail_;
1541
- {
1542
-
1543
-
1544
- continue _tailcall
1545
- }
1546
- return
1547
- }
1548
- }
1549
- }
1550
- {
1551
- if(_1.Link) {
1552
- if(_1.head_.T) {
1553
- if(_1.head_.left_.E) {
1554
- const k_ = _1.head_.key_;
1555
- const v_ = _1.head_.value_;
1556
- if(_1.head_.right_.E) {
1557
- const tail_ = _1.tail_;
1558
- stack_ = tail_;
1559
- return ff_core_Option.Some(ff_core_Pair.Pair(k_, v_))
1560
- return
1561
- }
1562
- }
1563
- }
1564
- }
1565
- }
1566
- {
1567
- if(_1.Link) {
1568
- if(_1.head_.T) {
1569
- const l_ = _1.head_.left_;
1570
- const k_ = _1.head_.key_;
1571
- const v_ = _1.head_.value_;
1572
- const r_ = _1.head_.right_;
1573
- const tail_ = _1.tail_;
1574
- stack_ = ff_core_List.Link(l_, ff_core_List.Link(ff_core_RbMap.T(ff_core_RbMap.B(), ff_core_RbMap.E(), k_, v_, ff_core_RbMap.E()), ff_core_List.Link(r_, tail_)));
1575
- {
1576
-
1577
-
1578
- continue _tailcall
1579
- }
1580
- return
1581
- }
1582
- }
1583
- }
1584
- }
1585
- return
1586
- }
1587
- }
1588
- return ff_core_Stream.make_((() => {
1589
- return next_()
1590
- }), (() => {
1591
-
1592
- }))
1593
- }
1594
-
1595
- export function RB_each(self_, body_, ff_core_Ordering_Order$K) {
1596
- {
1597
- const _1 = self_;
1598
- {
1599
- if(_1.E) {
1600
-
1601
- return
1602
- }
1603
- }
1604
- {
1605
- if(_1.T) {
1606
- const l_ = _1.left_;
1607
- const k_ = _1.key_;
1608
- const v_ = _1.value_;
1609
- const r_ = _1.right_;
1610
- ff_core_RbMap.RB_each(l_, body_, ff_core_Ordering_Order$K);
1611
- body_(k_, v_);
1612
- ff_core_RbMap.RB_each(r_, body_, ff_core_Ordering_Order$K)
1613
- return
1614
- }
1615
- }
1616
- }
1617
- }
1618
-
1619
- export function RB_eachWhile(self_, body_, ff_core_Ordering_Order$K) {
1620
- {
1621
- const _1 = self_;
1622
- {
1623
- if(_1.E) {
1624
- return true
1625
- return
1626
- }
1627
- }
1628
- {
1629
- if(_1.T) {
1630
- const l_ = _1.left_;
1631
- const k_ = _1.key_;
1632
- const v_ = _1.value_;
1633
- const r_ = _1.right_;
1634
- return ((ff_core_RbMap.RB_eachWhile(l_, body_, ff_core_Ordering_Order$K) && body_(k_, v_)) && ff_core_RbMap.RB_eachWhile(r_, body_, ff_core_Ordering_Order$K))
1635
- return
1636
- }
1637
- }
1638
- }
1639
- }
1640
-
1641
- export function RB_map(self_, body_, ff_core_Ordering_Order$K, ff_core_Ordering_Order$K2) {
1642
- let result_ = ff_core_RbMap.E();
1643
- ff_core_RbMap.RB_each(self_, ((k_, v_) => {
1644
- const pair_ = body_(k_, v_);
1645
- result_ = ff_core_RbMap.insert_(pair_.first_, pair_.second_, result_, ff_core_Ordering_Order$K2)
1646
- }), ff_core_Ordering_Order$K);
1647
- return result_
1648
- }
1649
-
1650
- export function RB_mapValues(self_, body_, ff_core_Ordering_Order$K) {
1651
- {
1652
- const _1 = self_;
1653
- {
1654
- if(_1.E) {
1655
- return ff_core_RbMap.E()
1656
- return
1657
- }
1658
- }
1659
- {
1660
- if(_1.T) {
1661
- const c_ = _1.color_;
1662
- const l_ = _1.left_;
1663
- const k_ = _1.key_;
1664
- const v_ = _1.value_;
1665
- const r_ = _1.right_;
1666
- return ff_core_RbMap.T(c_, ff_core_RbMap.RB_mapValues(l_, body_, ff_core_Ordering_Order$K), k_, body_(k_, v_), ff_core_RbMap.RB_mapValues(r_, body_, ff_core_Ordering_Order$K))
1667
- return
1668
- }
1669
- }
1670
- }
1671
- }
1672
-
1673
- export function RB_find(self_, body_, ff_core_Ordering_Order$K) {
1674
- let result_ = ff_core_Option.None();
1675
- ff_core_RbMap.RB_eachWhile(self_, ((k_, v_) => {
1676
- if(body_(k_, v_)) {
1677
- result_ = ff_core_Option.Some(ff_core_Pair.Pair(k_, v_));
1678
- return false
1679
- } else {
1680
- return true
1681
- }
1682
- }), ff_core_Ordering_Order$K);
1683
- return result_
1684
- }
1685
-
1686
- export async function RB_get$(self_, key_, ff_core_Ordering_Order$K, $task) {
1687
- {
1688
- const _1 = self_;
1689
- {
1690
- if(_1.E) {
1691
- return ff_core_Option.None()
1692
- return
1693
- }
1694
- }
1695
- {
1696
- if(_1.T) {
1697
- const a_ = _1.left_;
1698
- const y_ = _1.key_;
1699
- const yv_ = _1.value_;
1700
- const b_ = _1.right_;
1701
- {
1702
- const _1 = ff_core_Ordering_Order$K.compare_(key_, y_);
1703
- {
1704
- if(_1.OrderingBefore) {
1705
- return ff_core_RbMap.RB_get(a_, key_, ff_core_Ordering_Order$K)
1706
- return
1707
- }
1708
- }
1709
- {
1710
- if(_1.OrderingAfter) {
1711
- return ff_core_RbMap.RB_get(b_, key_, ff_core_Ordering_Order$K)
1712
- return
1713
- }
1714
- }
1715
- {
1716
- if(_1.OrderingSame) {
1717
- return ff_core_Option.Some(yv_)
1718
- return
1719
- }
1720
- }
1721
- }
1722
- return
1723
- }
1724
- }
1725
- }
1726
- }
1727
-
1728
- export async function RB_size$(self_, ff_core_Ordering_Order$K, $task) {
1729
- {
1730
- const _1 = self_;
1731
- {
1732
- if(_1.E) {
1733
- return 0
1734
- return
1735
- }
1736
- }
1737
- {
1738
- if(_1.T) {
1739
- const l_ = _1.left_;
1740
- const r_ = _1.right_;
1741
- return ((ff_core_RbMap.RB_size(l_, ff_core_Ordering_Order$K) + 1) + ff_core_RbMap.RB_size(r_, ff_core_Ordering_Order$K))
1742
- return
1743
- }
1744
- }
1745
- }
1746
- }
1747
-
1748
- export async function RB_pairs$(self_, ff_core_Ordering_Order$K, $task) {
1749
- let result_ = ff_core_List.Empty();
1750
- ff_core_RbMap.RB_each(self_, ((k_, v_) => {
1751
- result_ = ff_core_List.Link(ff_core_Pair.Pair(k_, v_), result_)
1752
- }), ff_core_Ordering_Order$K);
1753
- return ff_core_List.List_reverse(result_)
1754
- }
1755
-
1756
- export async function RB_toStream$(self_, cycle_, ff_core_Ordering_Order$K, $task) {
1757
- let stack_ = ff_core_List.Link(self_, ff_core_List.Empty());
1758
- function next_() {
1759
- _tailcall: for(;;) {
1760
- {
1761
- const _1 = stack_;
1762
- {
1763
- if(_1.Empty) {
1764
- if((cycle_ && (((_1) => {
1765
- {
1766
- if(_1.E) {
1767
- return false
1768
- return
1769
- }
1770
- }
1771
- {
1772
- return true
1773
- return
1774
- }
1775
- }))(self_))) {
1776
- stack_ = ff_core_List.Link(self_, ff_core_List.Empty());
1777
- {
1778
-
1779
-
1780
- continue _tailcall
1781
- }
1782
- } else {
1783
- return ff_core_Option.None()
1784
- }
1785
- return
1786
- }
1787
- }
1788
- {
1789
- if(_1.Link) {
1790
- if(_1.head_.E) {
1791
- const tail_ = _1.tail_;
1792
- stack_ = tail_;
1793
- {
1794
-
1795
-
1796
- continue _tailcall
1797
- }
1798
- return
1799
- }
1800
- }
1801
- }
1802
- {
1803
- if(_1.Link) {
1804
- if(_1.head_.T) {
1805
- if(_1.head_.left_.E) {
1806
- const k_ = _1.head_.key_;
1807
- const v_ = _1.head_.value_;
1808
- if(_1.head_.right_.E) {
1809
- const tail_ = _1.tail_;
1810
- stack_ = tail_;
1811
- return ff_core_Option.Some(ff_core_Pair.Pair(k_, v_))
1812
- return
1813
- }
1814
- }
1815
- }
1816
- }
1817
- }
1818
- {
1819
- if(_1.Link) {
1820
- if(_1.head_.T) {
1821
- const l_ = _1.head_.left_;
1822
- const k_ = _1.head_.key_;
1823
- const v_ = _1.head_.value_;
1824
- const r_ = _1.head_.right_;
1825
- const tail_ = _1.tail_;
1826
- stack_ = ff_core_List.Link(l_, ff_core_List.Link(ff_core_RbMap.T(ff_core_RbMap.B(), ff_core_RbMap.E(), k_, v_, ff_core_RbMap.E()), ff_core_List.Link(r_, tail_)));
1827
- {
1828
-
1829
-
1830
- continue _tailcall
1831
- }
1832
- return
1833
- }
1834
- }
1835
- }
1836
- }
1837
- return
1838
- }
1839
- }
1840
- return (await ff_core_Stream.make_$((async ($task) => {
1841
- return next_()
1842
- }), (async ($task) => {
1843
-
1844
- }), $task))
1845
- }
1846
-
1847
- export async function RB_each$(self_, body_, ff_core_Ordering_Order$K, $task) {
1848
- {
1849
- const _1 = self_;
1850
- {
1851
- if(_1.E) {
1852
-
1853
- return
1854
- }
1855
- }
1856
- {
1857
- if(_1.T) {
1858
- const l_ = _1.left_;
1859
- const k_ = _1.key_;
1860
- const v_ = _1.value_;
1861
- const r_ = _1.right_;
1862
- (await ff_core_RbMap.RB_each$(l_, body_, ff_core_Ordering_Order$K, $task));
1863
- (await body_(k_, v_, $task));
1864
- (await ff_core_RbMap.RB_each$(r_, body_, ff_core_Ordering_Order$K, $task))
1865
- return
1866
- }
1867
- }
1868
- }
1869
- }
1870
-
1871
- export async function RB_eachWhile$(self_, body_, ff_core_Ordering_Order$K, $task) {
1872
- {
1873
- const _1 = self_;
1874
- {
1875
- if(_1.E) {
1876
- return true
1877
- return
1878
- }
1879
- }
1880
- {
1881
- if(_1.T) {
1882
- const l_ = _1.left_;
1883
- const k_ = _1.key_;
1884
- const v_ = _1.value_;
1885
- const r_ = _1.right_;
1886
- return (((await ff_core_RbMap.RB_eachWhile$(l_, body_, ff_core_Ordering_Order$K, $task)) && (await body_(k_, v_, $task))) && (await ff_core_RbMap.RB_eachWhile$(r_, body_, ff_core_Ordering_Order$K, $task)))
1887
- return
1888
- }
1889
- }
1890
- }
1891
- }
1892
-
1893
- export async function RB_map$(self_, body_, ff_core_Ordering_Order$K, ff_core_Ordering_Order$K2, $task) {
1894
- let result_ = ff_core_RbMap.E();
1895
- (await ff_core_RbMap.RB_each$(self_, (async (k_, v_, $task) => {
1896
- const pair_ = (await body_(k_, v_, $task));
1897
- result_ = ff_core_RbMap.insert_(pair_.first_, pair_.second_, result_, ff_core_Ordering_Order$K2)
1898
- }), ff_core_Ordering_Order$K, $task));
1899
- return result_
1900
- }
1901
-
1902
- export async function RB_mapValues$(self_, body_, ff_core_Ordering_Order$K, $task) {
1903
- {
1904
- const _1 = self_;
1905
- {
1906
- if(_1.E) {
1907
- return ff_core_RbMap.E()
1908
- return
1909
- }
1910
- }
1911
- {
1912
- if(_1.T) {
1913
- const c_ = _1.color_;
1914
- const l_ = _1.left_;
1915
- const k_ = _1.key_;
1916
- const v_ = _1.value_;
1917
- const r_ = _1.right_;
1918
- return ff_core_RbMap.T(c_, (await ff_core_RbMap.RB_mapValues$(l_, body_, ff_core_Ordering_Order$K, $task)), k_, (await body_(k_, v_, $task)), (await ff_core_RbMap.RB_mapValues$(r_, body_, ff_core_Ordering_Order$K, $task)))
1919
- return
1920
- }
1921
- }
1922
- }
1923
- }
1924
-
1925
- export async function RB_find$(self_, body_, ff_core_Ordering_Order$K, $task) {
1926
- let result_ = ff_core_Option.None();
1927
- (await ff_core_RbMap.RB_eachWhile$(self_, (async (k_, v_, $task) => {
1928
- if((await body_(k_, v_, $task))) {
1929
- result_ = ff_core_Option.Some(ff_core_Pair.Pair(k_, v_));
1930
- return false
1931
- } else {
1932
- return true
1933
- }
1934
- }), ff_core_Ordering_Order$K, $task));
1935
- return result_
1936
- }
1937
-
1938
-
1939
-
1940
-
1
+
2
+
3
+ import * as ff_core_RbMap from "../../ff/core/RbMap.mjs"
4
+
5
+ import * as ff_core_Any from "../../ff/core/Any.mjs"
6
+
7
+ import * as ff_core_Array from "../../ff/core/Array.mjs"
8
+
9
+ import * as ff_core_AssetSystem from "../../ff/core/AssetSystem.mjs"
10
+
11
+ import * as ff_core_Atomic from "../../ff/core/Atomic.mjs"
12
+
13
+ import * as ff_core_Bool from "../../ff/core/Bool.mjs"
14
+
15
+ import * as ff_core_Box from "../../ff/core/Box.mjs"
16
+
17
+ import * as ff_core_BrowserSystem from "../../ff/core/BrowserSystem.mjs"
18
+
19
+ import * as ff_core_Buffer from "../../ff/core/Buffer.mjs"
20
+
21
+ import * as ff_core_BuildSystem from "../../ff/core/BuildSystem.mjs"
22
+
23
+ import * as ff_core_Channel from "../../ff/core/Channel.mjs"
24
+
25
+ import * as ff_core_Char from "../../ff/core/Char.mjs"
26
+
27
+ import * as ff_core_Core from "../../ff/core/Core.mjs"
28
+
29
+ import * as ff_core_Duration from "../../ff/core/Duration.mjs"
30
+
31
+ import * as ff_core_Equal from "../../ff/core/Equal.mjs"
32
+
33
+ import * as ff_core_Error from "../../ff/core/Error.mjs"
34
+
35
+ import * as ff_core_FileHandle from "../../ff/core/FileHandle.mjs"
36
+
37
+ import * as ff_core_Float from "../../ff/core/Float.mjs"
38
+
39
+ import * as ff_core_HttpClient from "../../ff/core/HttpClient.mjs"
40
+
41
+ import * as ff_core_Instant from "../../ff/core/Instant.mjs"
42
+
43
+ import * as ff_core_Int from "../../ff/core/Int.mjs"
44
+
45
+ import * as ff_core_IntMap from "../../ff/core/IntMap.mjs"
46
+
47
+ import * as ff_core_JsSystem from "../../ff/core/JsSystem.mjs"
48
+
49
+ import * as ff_core_JsValue from "../../ff/core/JsValue.mjs"
50
+
51
+ import * as ff_core_List from "../../ff/core/List.mjs"
52
+
53
+ import * as ff_core_Lock from "../../ff/core/Lock.mjs"
54
+
55
+ import * as ff_core_Log from "../../ff/core/Log.mjs"
56
+
57
+ import * as ff_core_Map from "../../ff/core/Map.mjs"
58
+
59
+ import * as ff_core_NodeSystem from "../../ff/core/NodeSystem.mjs"
60
+
61
+ import * as ff_core_Nothing from "../../ff/core/Nothing.mjs"
62
+
63
+ import * as ff_core_Option from "../../ff/core/Option.mjs"
64
+
65
+ import * as ff_core_Ordering from "../../ff/core/Ordering.mjs"
66
+
67
+ import * as ff_core_Pair from "../../ff/core/Pair.mjs"
68
+
69
+ import * as ff_core_Path from "../../ff/core/Path.mjs"
70
+
71
+ import * as ff_core_Serializable from "../../ff/core/Serializable.mjs"
72
+
73
+ import * as ff_core_Set from "../../ff/core/Set.mjs"
74
+
75
+ import * as ff_core_Show from "../../ff/core/Show.mjs"
76
+
77
+ import * as ff_core_SourceLocation from "../../ff/core/SourceLocation.mjs"
78
+
79
+ import * as ff_core_Stack from "../../ff/core/Stack.mjs"
80
+
81
+ import * as ff_core_Stream from "../../ff/core/Stream.mjs"
82
+
83
+ import * as ff_core_String from "../../ff/core/String.mjs"
84
+
85
+ import * as ff_core_StringMap from "../../ff/core/StringMap.mjs"
86
+
87
+ import * as ff_core_Task from "../../ff/core/Task.mjs"
88
+
89
+ import * as ff_core_Try from "../../ff/core/Try.mjs"
90
+
91
+ import * as ff_core_Unit from "../../ff/core/Unit.mjs"
92
+
93
+ // type Color
94
+ const R$ = {R: true};
95
+ export function R() {
96
+ return R$;
97
+ }
98
+ const B$ = {B: true};
99
+ export function B() {
100
+ return B$;
101
+ }
102
+
103
+ // type RB
104
+ const E$ = {E: true};
105
+ export function E() {
106
+ return E$;
107
+ }
108
+ export function T(color_, left_, key_, value_, right_) {
109
+ return {T: true, color_, left_, key_, value_, right_};
110
+ }
111
+
112
+
113
+
114
+ export function insert_(x_, xv_, s_, ff_core_Ordering_Order$K) {
115
+ function ins_(s_) {
116
+ {
117
+ const s_a = s_;
118
+ {
119
+ if(s_a.E) {
120
+ return ff_core_RbMap.T(ff_core_RbMap.R(), ff_core_RbMap.E(), x_, xv_, ff_core_RbMap.E())
121
+ return
122
+ }
123
+ }
124
+ {
125
+ if(s_a.T) {
126
+ if(s_a.color_.B) {
127
+ const a_ = s_a.left_;
128
+ const y_ = s_a.key_;
129
+ const yv_ = s_a.value_;
130
+ const b_ = s_a.right_;
131
+ {
132
+ const _1 = ff_core_Ordering_Order$K.compare_(x_, y_);
133
+ {
134
+ if(_1.OrderingBefore) {
135
+ return ff_core_RbMap.balance_(ins_(a_), y_, yv_, b_, ff_core_Ordering_Order$K)
136
+ return
137
+ }
138
+ }
139
+ {
140
+ if(_1.OrderingAfter) {
141
+ return ff_core_RbMap.balance_(a_, y_, yv_, ins_(b_), ff_core_Ordering_Order$K)
142
+ return
143
+ }
144
+ }
145
+ {
146
+ if(_1.OrderingSame) {
147
+ return ff_core_RbMap.T(ff_core_RbMap.B(), a_, x_, xv_, b_)
148
+ return
149
+ }
150
+ }
151
+ }
152
+ return
153
+ }
154
+ }
155
+ }
156
+ {
157
+ if(s_a.T) {
158
+ if(s_a.color_.R) {
159
+ const a_ = s_a.left_;
160
+ const y_ = s_a.key_;
161
+ const yv_ = s_a.value_;
162
+ const b_ = s_a.right_;
163
+ {
164
+ const _1 = ff_core_Ordering_Order$K.compare_(x_, y_);
165
+ {
166
+ if(_1.OrderingBefore) {
167
+ return ff_core_RbMap.T(ff_core_RbMap.R(), ins_(a_), y_, yv_, b_)
168
+ return
169
+ }
170
+ }
171
+ {
172
+ if(_1.OrderingAfter) {
173
+ return ff_core_RbMap.T(ff_core_RbMap.R(), a_, y_, yv_, ins_(b_))
174
+ return
175
+ }
176
+ }
177
+ {
178
+ if(_1.OrderingSame) {
179
+ return ff_core_RbMap.T(ff_core_RbMap.R(), a_, x_, xv_, b_)
180
+ return
181
+ }
182
+ }
183
+ }
184
+ return
185
+ }
186
+ }
187
+ }
188
+ }
189
+ }
190
+ {
191
+ const _1 = ins_(s_);
192
+ {
193
+ if(_1.E) {
194
+ return ff_core_Core.panic_("Unexpected empty tree")
195
+ return
196
+ }
197
+ }
198
+ {
199
+ if(_1.T) {
200
+ const a_ = _1.left_;
201
+ const z_ = _1.key_;
202
+ const zv_ = _1.value_;
203
+ const b_ = _1.right_;
204
+ return ff_core_RbMap.T(ff_core_RbMap.B(), a_, z_, zv_, b_)
205
+ return
206
+ }
207
+ }
208
+ }
209
+ }
210
+
211
+ export function member_(key_, tree_, ff_core_Ordering_Order$K) {
212
+ {
213
+ const key_a = key_;
214
+ const tree_a = tree_;
215
+ {
216
+ const x_ = key_a;
217
+ if(tree_a.E) {
218
+ return false
219
+ return
220
+ }
221
+ }
222
+ {
223
+ const x_ = key_a;
224
+ if(tree_a.T) {
225
+ const a_ = tree_a.left_;
226
+ const y_ = tree_a.key_;
227
+ const b_ = tree_a.right_;
228
+ {
229
+ const _1 = ff_core_Ordering_Order$K.compare_(x_, y_);
230
+ {
231
+ if(_1.OrderingBefore) {
232
+ return ff_core_RbMap.member_(x_, a_, ff_core_Ordering_Order$K)
233
+ return
234
+ }
235
+ }
236
+ {
237
+ if(_1.OrderingAfter) {
238
+ return ff_core_RbMap.member_(x_, b_, ff_core_Ordering_Order$K)
239
+ return
240
+ }
241
+ }
242
+ {
243
+ if(_1.OrderingSame) {
244
+ return true
245
+ return
246
+ }
247
+ }
248
+ }
249
+ return
250
+ }
251
+ }
252
+ }
253
+ }
254
+
255
+ export function balance_(tree1_, key_, value_, tree2_, ff_core_Ordering_Order$K) {
256
+ {
257
+ const tree1_a = tree1_;
258
+ const key_a = key_;
259
+ const value_a = value_;
260
+ const tree2_a = tree2_;
261
+ {
262
+ if(tree1_a.T) {
263
+ if(tree1_a.color_.R) {
264
+ const a_ = tree1_a.left_;
265
+ const x_ = tree1_a.key_;
266
+ const xv_ = tree1_a.value_;
267
+ const b_ = tree1_a.right_;
268
+ const y_ = key_a;
269
+ const yv_ = value_a;
270
+ if(tree2_a.T) {
271
+ if(tree2_a.color_.R) {
272
+ const c_ = tree2_a.left_;
273
+ const z_ = tree2_a.key_;
274
+ const zv_ = tree2_a.value_;
275
+ const d_ = tree2_a.right_;
276
+ return ff_core_RbMap.T(ff_core_RbMap.R(), ff_core_RbMap.T(ff_core_RbMap.B(), a_, x_, xv_, b_), y_, yv_, ff_core_RbMap.T(ff_core_RbMap.B(), c_, z_, zv_, d_))
277
+ return
278
+ }
279
+ }
280
+ }
281
+ }
282
+ }
283
+ {
284
+ if(tree1_a.T) {
285
+ if(tree1_a.color_.R) {
286
+ if(tree1_a.left_.T) {
287
+ if(tree1_a.left_.color_.R) {
288
+ const a_ = tree1_a.left_.left_;
289
+ const x_ = tree1_a.left_.key_;
290
+ const xv_ = tree1_a.left_.value_;
291
+ const b_ = tree1_a.left_.right_;
292
+ const y_ = tree1_a.key_;
293
+ const yv_ = tree1_a.value_;
294
+ const c_ = tree1_a.right_;
295
+ const z_ = key_a;
296
+ const zv_ = value_a;
297
+ const d_ = tree2_a;
298
+ return ff_core_RbMap.T(ff_core_RbMap.R(), ff_core_RbMap.T(ff_core_RbMap.B(), a_, x_, xv_, b_), y_, yv_, ff_core_RbMap.T(ff_core_RbMap.B(), c_, z_, zv_, d_))
299
+ return
300
+ }
301
+ }
302
+ }
303
+ }
304
+ }
305
+ {
306
+ if(tree1_a.T) {
307
+ if(tree1_a.color_.R) {
308
+ const a_ = tree1_a.left_;
309
+ const x_ = tree1_a.key_;
310
+ const xv_ = tree1_a.value_;
311
+ if(tree1_a.right_.T) {
312
+ if(tree1_a.right_.color_.R) {
313
+ const b_ = tree1_a.right_.left_;
314
+ const y_ = tree1_a.right_.key_;
315
+ const yv_ = tree1_a.right_.value_;
316
+ const c_ = tree1_a.right_.right_;
317
+ const z_ = key_a;
318
+ const zv_ = value_a;
319
+ const d_ = tree2_a;
320
+ return ff_core_RbMap.T(ff_core_RbMap.R(), ff_core_RbMap.T(ff_core_RbMap.B(), a_, x_, xv_, b_), y_, yv_, ff_core_RbMap.T(ff_core_RbMap.B(), c_, z_, zv_, d_))
321
+ return
322
+ }
323
+ }
324
+ }
325
+ }
326
+ }
327
+ {
328
+ const a_ = tree1_a;
329
+ const x_ = key_a;
330
+ const xv_ = value_a;
331
+ if(tree2_a.T) {
332
+ if(tree2_a.color_.R) {
333
+ const b_ = tree2_a.left_;
334
+ const y_ = tree2_a.key_;
335
+ const yv_ = tree2_a.value_;
336
+ if(tree2_a.right_.T) {
337
+ if(tree2_a.right_.color_.R) {
338
+ const c_ = tree2_a.right_.left_;
339
+ const z_ = tree2_a.right_.key_;
340
+ const zv_ = tree2_a.right_.value_;
341
+ const d_ = tree2_a.right_.right_;
342
+ return ff_core_RbMap.T(ff_core_RbMap.R(), ff_core_RbMap.T(ff_core_RbMap.B(), a_, x_, xv_, b_), y_, yv_, ff_core_RbMap.T(ff_core_RbMap.B(), c_, z_, zv_, d_))
343
+ return
344
+ }
345
+ }
346
+ }
347
+ }
348
+ }
349
+ {
350
+ const a_ = tree1_a;
351
+ const x_ = key_a;
352
+ const xv_ = value_a;
353
+ if(tree2_a.T) {
354
+ if(tree2_a.color_.R) {
355
+ if(tree2_a.left_.T) {
356
+ if(tree2_a.left_.color_.R) {
357
+ const b_ = tree2_a.left_.left_;
358
+ const y_ = tree2_a.left_.key_;
359
+ const yv_ = tree2_a.left_.value_;
360
+ const c_ = tree2_a.left_.right_;
361
+ const z_ = tree2_a.key_;
362
+ const zv_ = tree2_a.value_;
363
+ const d_ = tree2_a.right_;
364
+ return ff_core_RbMap.T(ff_core_RbMap.R(), ff_core_RbMap.T(ff_core_RbMap.B(), a_, x_, xv_, b_), y_, yv_, ff_core_RbMap.T(ff_core_RbMap.B(), c_, z_, zv_, d_))
365
+ return
366
+ }
367
+ }
368
+ }
369
+ }
370
+ }
371
+ {
372
+ const a_ = tree1_a;
373
+ const x_ = key_a;
374
+ const xv_ = value_a;
375
+ const b_ = tree2_a;
376
+ return ff_core_RbMap.T(ff_core_RbMap.B(), a_, x_, xv_, b_)
377
+ return
378
+ }
379
+ }
380
+ }
381
+
382
+ export function delete_(x_, t_, ff_core_Ordering_Order$K) {
383
+ function del_(ss_) {
384
+ {
385
+ const ss_a = ss_;
386
+ {
387
+ if(ss_a.E) {
388
+ return ff_core_RbMap.E()
389
+ return
390
+ }
391
+ }
392
+ {
393
+ if(ss_a.T) {
394
+ const a_ = ss_a.left_;
395
+ const y_ = ss_a.key_;
396
+ const yv_ = ss_a.value_;
397
+ const b_ = ss_a.right_;
398
+ {
399
+ const _1 = ff_core_Ordering_Order$K.compare_(x_, y_);
400
+ {
401
+ if(_1.OrderingBefore) {
402
+ return delformLeft_(a_, y_, yv_, b_)
403
+ return
404
+ }
405
+ }
406
+ {
407
+ if(_1.OrderingAfter) {
408
+ return delformRight_(a_, y_, yv_, b_)
409
+ return
410
+ }
411
+ }
412
+ {
413
+ if(_1.OrderingSame) {
414
+ return ff_core_RbMap.app_(a_, b_, ff_core_Ordering_Order$K)
415
+ return
416
+ }
417
+ }
418
+ }
419
+ return
420
+ }
421
+ }
422
+ }
423
+ }
424
+ function delformLeft_(left_, key_, value_, right_) {
425
+ {
426
+ const left_a = left_;
427
+ const key_a = key_;
428
+ const value_a = value_;
429
+ const right_a = right_;
430
+ {
431
+ if(left_a.T) {
432
+ if(left_a.color_.B) {
433
+ const y_ = key_a;
434
+ const yv_ = value_a;
435
+ const b_ = right_a;
436
+ return ff_core_RbMap.balleft_(del_(left_), y_, yv_, b_, ff_core_Ordering_Order$K)
437
+ return
438
+ }
439
+ }
440
+ }
441
+ {
442
+ const a_ = left_a;
443
+ const y_ = key_a;
444
+ const yv_ = value_a;
445
+ const b_ = right_a;
446
+ return ff_core_RbMap.T(ff_core_RbMap.R(), del_(a_), y_, yv_, b_)
447
+ return
448
+ }
449
+ }
450
+ }
451
+ function delformRight_(left_, key_, value_, right_) {
452
+ {
453
+ const left_a = left_;
454
+ const key_a = key_;
455
+ const value_a = value_;
456
+ const right_a = right_;
457
+ {
458
+ const a_ = left_a;
459
+ const y_ = key_a;
460
+ const yv_ = value_a;
461
+ if(right_a.T) {
462
+ if(right_a.color_.B) {
463
+ return ff_core_RbMap.balright_(a_, y_, yv_, del_(right_), ff_core_Ordering_Order$K)
464
+ return
465
+ }
466
+ }
467
+ }
468
+ {
469
+ const a_ = left_a;
470
+ const y_ = key_a;
471
+ const yv_ = value_a;
472
+ const b_ = right_a;
473
+ return ff_core_RbMap.T(ff_core_RbMap.R(), a_, y_, yv_, del_(b_))
474
+ return
475
+ }
476
+ }
477
+ }
478
+ {
479
+ const _1 = del_(t_);
480
+ {
481
+ if(_1.T) {
482
+ const a_ = _1.left_;
483
+ const y_ = _1.key_;
484
+ const yv_ = _1.value_;
485
+ const b_ = _1.right_;
486
+ return ff_core_RbMap.T(ff_core_RbMap.B(), a_, y_, yv_, b_)
487
+ return
488
+ }
489
+ }
490
+ {
491
+ return ff_core_RbMap.E()
492
+ return
493
+ }
494
+ }
495
+ }
496
+
497
+ export function balleft_(tree1_, key_, value_, tree2_, ff_core_Ordering_Order$K) {
498
+ {
499
+ const tree1_a = tree1_;
500
+ const key_a = key_;
501
+ const value_a = value_;
502
+ const tree2_a = tree2_;
503
+ {
504
+ if(tree1_a.T) {
505
+ if(tree1_a.color_.R) {
506
+ const a_ = tree1_a.left_;
507
+ const x_ = tree1_a.key_;
508
+ const xv_ = tree1_a.value_;
509
+ const b_ = tree1_a.right_;
510
+ const y_ = key_a;
511
+ const yv_ = value_a;
512
+ const c_ = tree2_a;
513
+ return ff_core_RbMap.T(ff_core_RbMap.R(), ff_core_RbMap.T(ff_core_RbMap.B(), a_, x_, xv_, b_), y_, yv_, c_)
514
+ return
515
+ }
516
+ }
517
+ }
518
+ {
519
+ const bl_ = tree1_a;
520
+ const x_ = key_a;
521
+ const xv_ = value_a;
522
+ if(tree2_a.T) {
523
+ if(tree2_a.color_.B) {
524
+ const a_ = tree2_a.left_;
525
+ const y_ = tree2_a.key_;
526
+ const yv_ = tree2_a.value_;
527
+ const b_ = tree2_a.right_;
528
+ return ff_core_RbMap.balance_(bl_, x_, xv_, ff_core_RbMap.T(ff_core_RbMap.R(), a_, y_, yv_, b_), ff_core_Ordering_Order$K)
529
+ return
530
+ }
531
+ }
532
+ }
533
+ {
534
+ const bl_ = tree1_a;
535
+ const x_ = key_a;
536
+ const xv_ = value_a;
537
+ if(tree2_a.T) {
538
+ if(tree2_a.color_.R) {
539
+ if(tree2_a.left_.T) {
540
+ if(tree2_a.left_.color_.B) {
541
+ const a_ = tree2_a.left_.left_;
542
+ const y_ = tree2_a.left_.key_;
543
+ const yv_ = tree2_a.left_.value_;
544
+ const b_ = tree2_a.left_.right_;
545
+ const z_ = tree2_a.key_;
546
+ const zv_ = tree2_a.value_;
547
+ const c_ = tree2_a.right_;
548
+ return ff_core_RbMap.T(ff_core_RbMap.R(), ff_core_RbMap.T(ff_core_RbMap.B(), bl_, x_, xv_, a_), y_, yv_, ff_core_RbMap.balance_(b_, z_, zv_, ff_core_RbMap.sub1_(c_, ff_core_Ordering_Order$K), ff_core_Ordering_Order$K))
549
+ return
550
+ }
551
+ }
552
+ }
553
+ }
554
+ }
555
+ {
556
+ return ff_core_Core.panic_("Unexhaustive match in balleft")
557
+ return
558
+ }
559
+ }
560
+ }
561
+
562
+ export function balright_(tree1_, key_, value_, tree2_, ff_core_Ordering_Order$K) {
563
+ {
564
+ const tree1_a = tree1_;
565
+ const key_a = key_;
566
+ const value_a = value_;
567
+ const tree2_a = tree2_;
568
+ {
569
+ const a_ = tree1_a;
570
+ const x_ = key_a;
571
+ const xv_ = value_a;
572
+ if(tree2_a.T) {
573
+ if(tree2_a.color_.R) {
574
+ const b_ = tree2_a.left_;
575
+ const y_ = tree2_a.key_;
576
+ const yv_ = tree2_a.value_;
577
+ const c_ = tree2_a.right_;
578
+ return ff_core_RbMap.T(ff_core_RbMap.R(), a_, x_, xv_, ff_core_RbMap.T(ff_core_RbMap.B(), b_, y_, yv_, c_))
579
+ return
580
+ }
581
+ }
582
+ }
583
+ {
584
+ if(tree1_a.T) {
585
+ if(tree1_a.color_.B) {
586
+ const a_ = tree1_a.left_;
587
+ const x_ = tree1_a.key_;
588
+ const xv_ = tree1_a.value_;
589
+ const b_ = tree1_a.right_;
590
+ const y_ = key_a;
591
+ const yv_ = value_a;
592
+ const bl_ = tree2_a;
593
+ return ff_core_RbMap.balance_(ff_core_RbMap.T(ff_core_RbMap.R(), a_, x_, xv_, b_), y_, yv_, bl_, ff_core_Ordering_Order$K)
594
+ return
595
+ }
596
+ }
597
+ }
598
+ {
599
+ if(tree1_a.T) {
600
+ if(tree1_a.color_.R) {
601
+ const a_ = tree1_a.left_;
602
+ const x_ = tree1_a.key_;
603
+ const xv_ = tree1_a.value_;
604
+ if(tree1_a.right_.T) {
605
+ if(tree1_a.right_.color_.B) {
606
+ const b_ = tree1_a.right_.left_;
607
+ const y_ = tree1_a.right_.key_;
608
+ const yv_ = tree1_a.right_.value_;
609
+ const c_ = tree1_a.right_.right_;
610
+ const z_ = key_a;
611
+ const zv_ = value_a;
612
+ const bl_ = tree2_a;
613
+ return ff_core_RbMap.T(ff_core_RbMap.R(), ff_core_RbMap.balance_(ff_core_RbMap.sub1_(a_, ff_core_Ordering_Order$K), x_, xv_, b_, ff_core_Ordering_Order$K), y_, yv_, ff_core_RbMap.T(ff_core_RbMap.B(), c_, z_, zv_, bl_))
614
+ return
615
+ }
616
+ }
617
+ }
618
+ }
619
+ }
620
+ {
621
+ return ff_core_Core.panic_("Unexhaustive match in balright")
622
+ return
623
+ }
624
+ }
625
+ }
626
+
627
+ export function sub1_(tree_, ff_core_Ordering_Order$K) {
628
+ {
629
+ const tree_a = tree_;
630
+ {
631
+ if(tree_a.T) {
632
+ if(tree_a.color_.B) {
633
+ const a_ = tree_a.left_;
634
+ const x_ = tree_a.key_;
635
+ const xv_ = tree_a.value_;
636
+ const b_ = tree_a.right_;
637
+ return ff_core_RbMap.T(ff_core_RbMap.R(), a_, x_, xv_, b_)
638
+ return
639
+ }
640
+ }
641
+ }
642
+ {
643
+ return ff_core_Core.panic_("invariance violation")
644
+ return
645
+ }
646
+ }
647
+ }
648
+
649
+ export function app_(tree1_, tree2_, ff_core_Ordering_Order$K) {
650
+ {
651
+ const tree1_a = tree1_;
652
+ const tree2_a = tree2_;
653
+ {
654
+ if(tree1_a.E) {
655
+ const b_ = tree2_a;
656
+ return b_
657
+ return
658
+ }
659
+ }
660
+ {
661
+ const a_ = tree1_a;
662
+ if(tree2_a.E) {
663
+ return a_
664
+ return
665
+ }
666
+ }
667
+ {
668
+ if(tree1_a.T) {
669
+ if(tree1_a.color_.R) {
670
+ const a_ = tree1_a.left_;
671
+ const x_ = tree1_a.key_;
672
+ const xv_ = tree1_a.value_;
673
+ const b_ = tree1_a.right_;
674
+ if(tree2_a.T) {
675
+ if(tree2_a.color_.R) {
676
+ const c_ = tree2_a.left_;
677
+ const y_ = tree2_a.key_;
678
+ const yv_ = tree2_a.value_;
679
+ const d_ = tree2_a.right_;
680
+ {
681
+ const _1 = ff_core_RbMap.app_(b_, c_, ff_core_Ordering_Order$K);
682
+ {
683
+ if(_1.T) {
684
+ if(_1.color_.R) {
685
+ const b2_ = _1.left_;
686
+ const z_ = _1.key_;
687
+ const zv_ = _1.value_;
688
+ const c2_ = _1.right_;
689
+ return ff_core_RbMap.T(ff_core_RbMap.R(), ff_core_RbMap.T(ff_core_RbMap.R(), a_, x_, xv_, b2_), z_, zv_, ff_core_RbMap.T(ff_core_RbMap.R(), c2_, y_, yv_, d_))
690
+ return
691
+ }
692
+ }
693
+ }
694
+ {
695
+ const bc_ = _1;
696
+ return ff_core_RbMap.T(ff_core_RbMap.R(), a_, x_, xv_, ff_core_RbMap.T(ff_core_RbMap.R(), bc_, y_, yv_, d_))
697
+ return
698
+ }
699
+ }
700
+ return
701
+ }
702
+ }
703
+ }
704
+ }
705
+ }
706
+ {
707
+ if(tree1_a.T) {
708
+ if(tree1_a.color_.B) {
709
+ const a_ = tree1_a.left_;
710
+ const x_ = tree1_a.key_;
711
+ const xv_ = tree1_a.value_;
712
+ const b_ = tree1_a.right_;
713
+ if(tree2_a.T) {
714
+ if(tree2_a.color_.B) {
715
+ const c_ = tree2_a.left_;
716
+ const y_ = tree2_a.key_;
717
+ const yv_ = tree2_a.value_;
718
+ const d_ = tree2_a.right_;
719
+ {
720
+ const _1 = ff_core_RbMap.app_(b_, c_, ff_core_Ordering_Order$K);
721
+ {
722
+ if(_1.T) {
723
+ if(_1.color_.R) {
724
+ const b2_ = _1.left_;
725
+ const z_ = _1.key_;
726
+ const zv_ = _1.value_;
727
+ const c2_ = _1.right_;
728
+ return ff_core_RbMap.T(ff_core_RbMap.R(), ff_core_RbMap.T(ff_core_RbMap.B(), a_, x_, xv_, b2_), z_, zv_, ff_core_RbMap.T(ff_core_RbMap.B(), c2_, y_, yv_, d_))
729
+ return
730
+ }
731
+ }
732
+ }
733
+ {
734
+ const bc_ = _1;
735
+ return ff_core_RbMap.balleft_(a_, x_, xv_, ff_core_RbMap.T(ff_core_RbMap.B(), bc_, y_, yv_, d_), ff_core_Ordering_Order$K)
736
+ return
737
+ }
738
+ }
739
+ return
740
+ }
741
+ }
742
+ }
743
+ }
744
+ }
745
+ {
746
+ const a_ = tree1_a;
747
+ if(tree2_a.T) {
748
+ if(tree2_a.color_.R) {
749
+ const b_ = tree2_a.left_;
750
+ const x_ = tree2_a.key_;
751
+ const xv_ = tree2_a.value_;
752
+ const c_ = tree2_a.right_;
753
+ return ff_core_RbMap.T(ff_core_RbMap.R(), ff_core_RbMap.app_(a_, b_, ff_core_Ordering_Order$K), x_, xv_, c_)
754
+ return
755
+ }
756
+ }
757
+ }
758
+ {
759
+ if(tree1_a.T) {
760
+ if(tree1_a.color_.R) {
761
+ const a_ = tree1_a.left_;
762
+ const x_ = tree1_a.key_;
763
+ const xv_ = tree1_a.value_;
764
+ const b_ = tree1_a.right_;
765
+ const c_ = tree2_a;
766
+ return ff_core_RbMap.T(ff_core_RbMap.R(), a_, x_, xv_, ff_core_RbMap.app_(b_, c_, ff_core_Ordering_Order$K))
767
+ return
768
+ }
769
+ }
770
+ }
771
+ }
772
+ }
773
+
774
+ export async function insert_$(x_, xv_, s_, ff_core_Ordering_Order$K, $task) {
775
+ function ins_(s_) {
776
+ {
777
+ const s_a = s_;
778
+ {
779
+ if(s_a.E) {
780
+ return ff_core_RbMap.T(ff_core_RbMap.R(), ff_core_RbMap.E(), x_, xv_, ff_core_RbMap.E())
781
+ return
782
+ }
783
+ }
784
+ {
785
+ if(s_a.T) {
786
+ if(s_a.color_.B) {
787
+ const a_ = s_a.left_;
788
+ const y_ = s_a.key_;
789
+ const yv_ = s_a.value_;
790
+ const b_ = s_a.right_;
791
+ {
792
+ const _1 = ff_core_Ordering_Order$K.compare_(x_, y_);
793
+ {
794
+ if(_1.OrderingBefore) {
795
+ return ff_core_RbMap.balance_(ins_(a_), y_, yv_, b_, ff_core_Ordering_Order$K)
796
+ return
797
+ }
798
+ }
799
+ {
800
+ if(_1.OrderingAfter) {
801
+ return ff_core_RbMap.balance_(a_, y_, yv_, ins_(b_), ff_core_Ordering_Order$K)
802
+ return
803
+ }
804
+ }
805
+ {
806
+ if(_1.OrderingSame) {
807
+ return ff_core_RbMap.T(ff_core_RbMap.B(), a_, x_, xv_, b_)
808
+ return
809
+ }
810
+ }
811
+ }
812
+ return
813
+ }
814
+ }
815
+ }
816
+ {
817
+ if(s_a.T) {
818
+ if(s_a.color_.R) {
819
+ const a_ = s_a.left_;
820
+ const y_ = s_a.key_;
821
+ const yv_ = s_a.value_;
822
+ const b_ = s_a.right_;
823
+ {
824
+ const _1 = ff_core_Ordering_Order$K.compare_(x_, y_);
825
+ {
826
+ if(_1.OrderingBefore) {
827
+ return ff_core_RbMap.T(ff_core_RbMap.R(), ins_(a_), y_, yv_, b_)
828
+ return
829
+ }
830
+ }
831
+ {
832
+ if(_1.OrderingAfter) {
833
+ return ff_core_RbMap.T(ff_core_RbMap.R(), a_, y_, yv_, ins_(b_))
834
+ return
835
+ }
836
+ }
837
+ {
838
+ if(_1.OrderingSame) {
839
+ return ff_core_RbMap.T(ff_core_RbMap.R(), a_, x_, xv_, b_)
840
+ return
841
+ }
842
+ }
843
+ }
844
+ return
845
+ }
846
+ }
847
+ }
848
+ }
849
+ }
850
+ {
851
+ const _1 = ins_(s_);
852
+ {
853
+ if(_1.E) {
854
+ return ff_core_Core.panic_("Unexpected empty tree")
855
+ return
856
+ }
857
+ }
858
+ {
859
+ if(_1.T) {
860
+ const a_ = _1.left_;
861
+ const z_ = _1.key_;
862
+ const zv_ = _1.value_;
863
+ const b_ = _1.right_;
864
+ return ff_core_RbMap.T(ff_core_RbMap.B(), a_, z_, zv_, b_)
865
+ return
866
+ }
867
+ }
868
+ }
869
+ }
870
+
871
+ export async function member_$(key_, tree_, ff_core_Ordering_Order$K, $task) {
872
+ {
873
+ const key_a = key_;
874
+ const tree_a = tree_;
875
+ {
876
+ const x_ = key_a;
877
+ if(tree_a.E) {
878
+ return false
879
+ return
880
+ }
881
+ }
882
+ {
883
+ const x_ = key_a;
884
+ if(tree_a.T) {
885
+ const a_ = tree_a.left_;
886
+ const y_ = tree_a.key_;
887
+ const b_ = tree_a.right_;
888
+ {
889
+ const _1 = ff_core_Ordering_Order$K.compare_(x_, y_);
890
+ {
891
+ if(_1.OrderingBefore) {
892
+ return ff_core_RbMap.member_(x_, a_, ff_core_Ordering_Order$K)
893
+ return
894
+ }
895
+ }
896
+ {
897
+ if(_1.OrderingAfter) {
898
+ return ff_core_RbMap.member_(x_, b_, ff_core_Ordering_Order$K)
899
+ return
900
+ }
901
+ }
902
+ {
903
+ if(_1.OrderingSame) {
904
+ return true
905
+ return
906
+ }
907
+ }
908
+ }
909
+ return
910
+ }
911
+ }
912
+ }
913
+ }
914
+
915
+ export async function balance_$(tree1_, key_, value_, tree2_, ff_core_Ordering_Order$K, $task) {
916
+ {
917
+ const tree1_a = tree1_;
918
+ const key_a = key_;
919
+ const value_a = value_;
920
+ const tree2_a = tree2_;
921
+ {
922
+ if(tree1_a.T) {
923
+ if(tree1_a.color_.R) {
924
+ const a_ = tree1_a.left_;
925
+ const x_ = tree1_a.key_;
926
+ const xv_ = tree1_a.value_;
927
+ const b_ = tree1_a.right_;
928
+ const y_ = key_a;
929
+ const yv_ = value_a;
930
+ if(tree2_a.T) {
931
+ if(tree2_a.color_.R) {
932
+ const c_ = tree2_a.left_;
933
+ const z_ = tree2_a.key_;
934
+ const zv_ = tree2_a.value_;
935
+ const d_ = tree2_a.right_;
936
+ return ff_core_RbMap.T(ff_core_RbMap.R(), ff_core_RbMap.T(ff_core_RbMap.B(), a_, x_, xv_, b_), y_, yv_, ff_core_RbMap.T(ff_core_RbMap.B(), c_, z_, zv_, d_))
937
+ return
938
+ }
939
+ }
940
+ }
941
+ }
942
+ }
943
+ {
944
+ if(tree1_a.T) {
945
+ if(tree1_a.color_.R) {
946
+ if(tree1_a.left_.T) {
947
+ if(tree1_a.left_.color_.R) {
948
+ const a_ = tree1_a.left_.left_;
949
+ const x_ = tree1_a.left_.key_;
950
+ const xv_ = tree1_a.left_.value_;
951
+ const b_ = tree1_a.left_.right_;
952
+ const y_ = tree1_a.key_;
953
+ const yv_ = tree1_a.value_;
954
+ const c_ = tree1_a.right_;
955
+ const z_ = key_a;
956
+ const zv_ = value_a;
957
+ const d_ = tree2_a;
958
+ return ff_core_RbMap.T(ff_core_RbMap.R(), ff_core_RbMap.T(ff_core_RbMap.B(), a_, x_, xv_, b_), y_, yv_, ff_core_RbMap.T(ff_core_RbMap.B(), c_, z_, zv_, d_))
959
+ return
960
+ }
961
+ }
962
+ }
963
+ }
964
+ }
965
+ {
966
+ if(tree1_a.T) {
967
+ if(tree1_a.color_.R) {
968
+ const a_ = tree1_a.left_;
969
+ const x_ = tree1_a.key_;
970
+ const xv_ = tree1_a.value_;
971
+ if(tree1_a.right_.T) {
972
+ if(tree1_a.right_.color_.R) {
973
+ const b_ = tree1_a.right_.left_;
974
+ const y_ = tree1_a.right_.key_;
975
+ const yv_ = tree1_a.right_.value_;
976
+ const c_ = tree1_a.right_.right_;
977
+ const z_ = key_a;
978
+ const zv_ = value_a;
979
+ const d_ = tree2_a;
980
+ return ff_core_RbMap.T(ff_core_RbMap.R(), ff_core_RbMap.T(ff_core_RbMap.B(), a_, x_, xv_, b_), y_, yv_, ff_core_RbMap.T(ff_core_RbMap.B(), c_, z_, zv_, d_))
981
+ return
982
+ }
983
+ }
984
+ }
985
+ }
986
+ }
987
+ {
988
+ const a_ = tree1_a;
989
+ const x_ = key_a;
990
+ const xv_ = value_a;
991
+ if(tree2_a.T) {
992
+ if(tree2_a.color_.R) {
993
+ const b_ = tree2_a.left_;
994
+ const y_ = tree2_a.key_;
995
+ const yv_ = tree2_a.value_;
996
+ if(tree2_a.right_.T) {
997
+ if(tree2_a.right_.color_.R) {
998
+ const c_ = tree2_a.right_.left_;
999
+ const z_ = tree2_a.right_.key_;
1000
+ const zv_ = tree2_a.right_.value_;
1001
+ const d_ = tree2_a.right_.right_;
1002
+ return ff_core_RbMap.T(ff_core_RbMap.R(), ff_core_RbMap.T(ff_core_RbMap.B(), a_, x_, xv_, b_), y_, yv_, ff_core_RbMap.T(ff_core_RbMap.B(), c_, z_, zv_, d_))
1003
+ return
1004
+ }
1005
+ }
1006
+ }
1007
+ }
1008
+ }
1009
+ {
1010
+ const a_ = tree1_a;
1011
+ const x_ = key_a;
1012
+ const xv_ = value_a;
1013
+ if(tree2_a.T) {
1014
+ if(tree2_a.color_.R) {
1015
+ if(tree2_a.left_.T) {
1016
+ if(tree2_a.left_.color_.R) {
1017
+ const b_ = tree2_a.left_.left_;
1018
+ const y_ = tree2_a.left_.key_;
1019
+ const yv_ = tree2_a.left_.value_;
1020
+ const c_ = tree2_a.left_.right_;
1021
+ const z_ = tree2_a.key_;
1022
+ const zv_ = tree2_a.value_;
1023
+ const d_ = tree2_a.right_;
1024
+ return ff_core_RbMap.T(ff_core_RbMap.R(), ff_core_RbMap.T(ff_core_RbMap.B(), a_, x_, xv_, b_), y_, yv_, ff_core_RbMap.T(ff_core_RbMap.B(), c_, z_, zv_, d_))
1025
+ return
1026
+ }
1027
+ }
1028
+ }
1029
+ }
1030
+ }
1031
+ {
1032
+ const a_ = tree1_a;
1033
+ const x_ = key_a;
1034
+ const xv_ = value_a;
1035
+ const b_ = tree2_a;
1036
+ return ff_core_RbMap.T(ff_core_RbMap.B(), a_, x_, xv_, b_)
1037
+ return
1038
+ }
1039
+ }
1040
+ }
1041
+
1042
+ export async function delete_$(x_, t_, ff_core_Ordering_Order$K, $task) {
1043
+ function del_(ss_) {
1044
+ {
1045
+ const ss_a = ss_;
1046
+ {
1047
+ if(ss_a.E) {
1048
+ return ff_core_RbMap.E()
1049
+ return
1050
+ }
1051
+ }
1052
+ {
1053
+ if(ss_a.T) {
1054
+ const a_ = ss_a.left_;
1055
+ const y_ = ss_a.key_;
1056
+ const yv_ = ss_a.value_;
1057
+ const b_ = ss_a.right_;
1058
+ {
1059
+ const _1 = ff_core_Ordering_Order$K.compare_(x_, y_);
1060
+ {
1061
+ if(_1.OrderingBefore) {
1062
+ return delformLeft_(a_, y_, yv_, b_)
1063
+ return
1064
+ }
1065
+ }
1066
+ {
1067
+ if(_1.OrderingAfter) {
1068
+ return delformRight_(a_, y_, yv_, b_)
1069
+ return
1070
+ }
1071
+ }
1072
+ {
1073
+ if(_1.OrderingSame) {
1074
+ return ff_core_RbMap.app_(a_, b_, ff_core_Ordering_Order$K)
1075
+ return
1076
+ }
1077
+ }
1078
+ }
1079
+ return
1080
+ }
1081
+ }
1082
+ }
1083
+ }
1084
+ function delformLeft_(left_, key_, value_, right_) {
1085
+ {
1086
+ const left_a = left_;
1087
+ const key_a = key_;
1088
+ const value_a = value_;
1089
+ const right_a = right_;
1090
+ {
1091
+ if(left_a.T) {
1092
+ if(left_a.color_.B) {
1093
+ const y_ = key_a;
1094
+ const yv_ = value_a;
1095
+ const b_ = right_a;
1096
+ return ff_core_RbMap.balleft_(del_(left_), y_, yv_, b_, ff_core_Ordering_Order$K)
1097
+ return
1098
+ }
1099
+ }
1100
+ }
1101
+ {
1102
+ const a_ = left_a;
1103
+ const y_ = key_a;
1104
+ const yv_ = value_a;
1105
+ const b_ = right_a;
1106
+ return ff_core_RbMap.T(ff_core_RbMap.R(), del_(a_), y_, yv_, b_)
1107
+ return
1108
+ }
1109
+ }
1110
+ }
1111
+ function delformRight_(left_, key_, value_, right_) {
1112
+ {
1113
+ const left_a = left_;
1114
+ const key_a = key_;
1115
+ const value_a = value_;
1116
+ const right_a = right_;
1117
+ {
1118
+ const a_ = left_a;
1119
+ const y_ = key_a;
1120
+ const yv_ = value_a;
1121
+ if(right_a.T) {
1122
+ if(right_a.color_.B) {
1123
+ return ff_core_RbMap.balright_(a_, y_, yv_, del_(right_), ff_core_Ordering_Order$K)
1124
+ return
1125
+ }
1126
+ }
1127
+ }
1128
+ {
1129
+ const a_ = left_a;
1130
+ const y_ = key_a;
1131
+ const yv_ = value_a;
1132
+ const b_ = right_a;
1133
+ return ff_core_RbMap.T(ff_core_RbMap.R(), a_, y_, yv_, del_(b_))
1134
+ return
1135
+ }
1136
+ }
1137
+ }
1138
+ {
1139
+ const _1 = del_(t_);
1140
+ {
1141
+ if(_1.T) {
1142
+ const a_ = _1.left_;
1143
+ const y_ = _1.key_;
1144
+ const yv_ = _1.value_;
1145
+ const b_ = _1.right_;
1146
+ return ff_core_RbMap.T(ff_core_RbMap.B(), a_, y_, yv_, b_)
1147
+ return
1148
+ }
1149
+ }
1150
+ {
1151
+ return ff_core_RbMap.E()
1152
+ return
1153
+ }
1154
+ }
1155
+ }
1156
+
1157
+ export async function balleft_$(tree1_, key_, value_, tree2_, ff_core_Ordering_Order$K, $task) {
1158
+ {
1159
+ const tree1_a = tree1_;
1160
+ const key_a = key_;
1161
+ const value_a = value_;
1162
+ const tree2_a = tree2_;
1163
+ {
1164
+ if(tree1_a.T) {
1165
+ if(tree1_a.color_.R) {
1166
+ const a_ = tree1_a.left_;
1167
+ const x_ = tree1_a.key_;
1168
+ const xv_ = tree1_a.value_;
1169
+ const b_ = tree1_a.right_;
1170
+ const y_ = key_a;
1171
+ const yv_ = value_a;
1172
+ const c_ = tree2_a;
1173
+ return ff_core_RbMap.T(ff_core_RbMap.R(), ff_core_RbMap.T(ff_core_RbMap.B(), a_, x_, xv_, b_), y_, yv_, c_)
1174
+ return
1175
+ }
1176
+ }
1177
+ }
1178
+ {
1179
+ const bl_ = tree1_a;
1180
+ const x_ = key_a;
1181
+ const xv_ = value_a;
1182
+ if(tree2_a.T) {
1183
+ if(tree2_a.color_.B) {
1184
+ const a_ = tree2_a.left_;
1185
+ const y_ = tree2_a.key_;
1186
+ const yv_ = tree2_a.value_;
1187
+ const b_ = tree2_a.right_;
1188
+ return ff_core_RbMap.balance_(bl_, x_, xv_, ff_core_RbMap.T(ff_core_RbMap.R(), a_, y_, yv_, b_), ff_core_Ordering_Order$K)
1189
+ return
1190
+ }
1191
+ }
1192
+ }
1193
+ {
1194
+ const bl_ = tree1_a;
1195
+ const x_ = key_a;
1196
+ const xv_ = value_a;
1197
+ if(tree2_a.T) {
1198
+ if(tree2_a.color_.R) {
1199
+ if(tree2_a.left_.T) {
1200
+ if(tree2_a.left_.color_.B) {
1201
+ const a_ = tree2_a.left_.left_;
1202
+ const y_ = tree2_a.left_.key_;
1203
+ const yv_ = tree2_a.left_.value_;
1204
+ const b_ = tree2_a.left_.right_;
1205
+ const z_ = tree2_a.key_;
1206
+ const zv_ = tree2_a.value_;
1207
+ const c_ = tree2_a.right_;
1208
+ return ff_core_RbMap.T(ff_core_RbMap.R(), ff_core_RbMap.T(ff_core_RbMap.B(), bl_, x_, xv_, a_), y_, yv_, ff_core_RbMap.balance_(b_, z_, zv_, ff_core_RbMap.sub1_(c_, ff_core_Ordering_Order$K), ff_core_Ordering_Order$K))
1209
+ return
1210
+ }
1211
+ }
1212
+ }
1213
+ }
1214
+ }
1215
+ {
1216
+ return ff_core_Core.panic_("Unexhaustive match in balleft")
1217
+ return
1218
+ }
1219
+ }
1220
+ }
1221
+
1222
+ export async function balright_$(tree1_, key_, value_, tree2_, ff_core_Ordering_Order$K, $task) {
1223
+ {
1224
+ const tree1_a = tree1_;
1225
+ const key_a = key_;
1226
+ const value_a = value_;
1227
+ const tree2_a = tree2_;
1228
+ {
1229
+ const a_ = tree1_a;
1230
+ const x_ = key_a;
1231
+ const xv_ = value_a;
1232
+ if(tree2_a.T) {
1233
+ if(tree2_a.color_.R) {
1234
+ const b_ = tree2_a.left_;
1235
+ const y_ = tree2_a.key_;
1236
+ const yv_ = tree2_a.value_;
1237
+ const c_ = tree2_a.right_;
1238
+ return ff_core_RbMap.T(ff_core_RbMap.R(), a_, x_, xv_, ff_core_RbMap.T(ff_core_RbMap.B(), b_, y_, yv_, c_))
1239
+ return
1240
+ }
1241
+ }
1242
+ }
1243
+ {
1244
+ if(tree1_a.T) {
1245
+ if(tree1_a.color_.B) {
1246
+ const a_ = tree1_a.left_;
1247
+ const x_ = tree1_a.key_;
1248
+ const xv_ = tree1_a.value_;
1249
+ const b_ = tree1_a.right_;
1250
+ const y_ = key_a;
1251
+ const yv_ = value_a;
1252
+ const bl_ = tree2_a;
1253
+ return ff_core_RbMap.balance_(ff_core_RbMap.T(ff_core_RbMap.R(), a_, x_, xv_, b_), y_, yv_, bl_, ff_core_Ordering_Order$K)
1254
+ return
1255
+ }
1256
+ }
1257
+ }
1258
+ {
1259
+ if(tree1_a.T) {
1260
+ if(tree1_a.color_.R) {
1261
+ const a_ = tree1_a.left_;
1262
+ const x_ = tree1_a.key_;
1263
+ const xv_ = tree1_a.value_;
1264
+ if(tree1_a.right_.T) {
1265
+ if(tree1_a.right_.color_.B) {
1266
+ const b_ = tree1_a.right_.left_;
1267
+ const y_ = tree1_a.right_.key_;
1268
+ const yv_ = tree1_a.right_.value_;
1269
+ const c_ = tree1_a.right_.right_;
1270
+ const z_ = key_a;
1271
+ const zv_ = value_a;
1272
+ const bl_ = tree2_a;
1273
+ return ff_core_RbMap.T(ff_core_RbMap.R(), ff_core_RbMap.balance_(ff_core_RbMap.sub1_(a_, ff_core_Ordering_Order$K), x_, xv_, b_, ff_core_Ordering_Order$K), y_, yv_, ff_core_RbMap.T(ff_core_RbMap.B(), c_, z_, zv_, bl_))
1274
+ return
1275
+ }
1276
+ }
1277
+ }
1278
+ }
1279
+ }
1280
+ {
1281
+ return ff_core_Core.panic_("Unexhaustive match in balright")
1282
+ return
1283
+ }
1284
+ }
1285
+ }
1286
+
1287
+ export async function sub1_$(tree_, ff_core_Ordering_Order$K, $task) {
1288
+ {
1289
+ const tree_a = tree_;
1290
+ {
1291
+ if(tree_a.T) {
1292
+ if(tree_a.color_.B) {
1293
+ const a_ = tree_a.left_;
1294
+ const x_ = tree_a.key_;
1295
+ const xv_ = tree_a.value_;
1296
+ const b_ = tree_a.right_;
1297
+ return ff_core_RbMap.T(ff_core_RbMap.R(), a_, x_, xv_, b_)
1298
+ return
1299
+ }
1300
+ }
1301
+ }
1302
+ {
1303
+ return ff_core_Core.panic_("invariance violation")
1304
+ return
1305
+ }
1306
+ }
1307
+ }
1308
+
1309
+ export async function app_$(tree1_, tree2_, ff_core_Ordering_Order$K, $task) {
1310
+ {
1311
+ const tree1_a = tree1_;
1312
+ const tree2_a = tree2_;
1313
+ {
1314
+ if(tree1_a.E) {
1315
+ const b_ = tree2_a;
1316
+ return b_
1317
+ return
1318
+ }
1319
+ }
1320
+ {
1321
+ const a_ = tree1_a;
1322
+ if(tree2_a.E) {
1323
+ return a_
1324
+ return
1325
+ }
1326
+ }
1327
+ {
1328
+ if(tree1_a.T) {
1329
+ if(tree1_a.color_.R) {
1330
+ const a_ = tree1_a.left_;
1331
+ const x_ = tree1_a.key_;
1332
+ const xv_ = tree1_a.value_;
1333
+ const b_ = tree1_a.right_;
1334
+ if(tree2_a.T) {
1335
+ if(tree2_a.color_.R) {
1336
+ const c_ = tree2_a.left_;
1337
+ const y_ = tree2_a.key_;
1338
+ const yv_ = tree2_a.value_;
1339
+ const d_ = tree2_a.right_;
1340
+ {
1341
+ const _1 = ff_core_RbMap.app_(b_, c_, ff_core_Ordering_Order$K);
1342
+ {
1343
+ if(_1.T) {
1344
+ if(_1.color_.R) {
1345
+ const b2_ = _1.left_;
1346
+ const z_ = _1.key_;
1347
+ const zv_ = _1.value_;
1348
+ const c2_ = _1.right_;
1349
+ return ff_core_RbMap.T(ff_core_RbMap.R(), ff_core_RbMap.T(ff_core_RbMap.R(), a_, x_, xv_, b2_), z_, zv_, ff_core_RbMap.T(ff_core_RbMap.R(), c2_, y_, yv_, d_))
1350
+ return
1351
+ }
1352
+ }
1353
+ }
1354
+ {
1355
+ const bc_ = _1;
1356
+ return ff_core_RbMap.T(ff_core_RbMap.R(), a_, x_, xv_, ff_core_RbMap.T(ff_core_RbMap.R(), bc_, y_, yv_, d_))
1357
+ return
1358
+ }
1359
+ }
1360
+ return
1361
+ }
1362
+ }
1363
+ }
1364
+ }
1365
+ }
1366
+ {
1367
+ if(tree1_a.T) {
1368
+ if(tree1_a.color_.B) {
1369
+ const a_ = tree1_a.left_;
1370
+ const x_ = tree1_a.key_;
1371
+ const xv_ = tree1_a.value_;
1372
+ const b_ = tree1_a.right_;
1373
+ if(tree2_a.T) {
1374
+ if(tree2_a.color_.B) {
1375
+ const c_ = tree2_a.left_;
1376
+ const y_ = tree2_a.key_;
1377
+ const yv_ = tree2_a.value_;
1378
+ const d_ = tree2_a.right_;
1379
+ {
1380
+ const _1 = ff_core_RbMap.app_(b_, c_, ff_core_Ordering_Order$K);
1381
+ {
1382
+ if(_1.T) {
1383
+ if(_1.color_.R) {
1384
+ const b2_ = _1.left_;
1385
+ const z_ = _1.key_;
1386
+ const zv_ = _1.value_;
1387
+ const c2_ = _1.right_;
1388
+ return ff_core_RbMap.T(ff_core_RbMap.R(), ff_core_RbMap.T(ff_core_RbMap.B(), a_, x_, xv_, b2_), z_, zv_, ff_core_RbMap.T(ff_core_RbMap.B(), c2_, y_, yv_, d_))
1389
+ return
1390
+ }
1391
+ }
1392
+ }
1393
+ {
1394
+ const bc_ = _1;
1395
+ return ff_core_RbMap.balleft_(a_, x_, xv_, ff_core_RbMap.T(ff_core_RbMap.B(), bc_, y_, yv_, d_), ff_core_Ordering_Order$K)
1396
+ return
1397
+ }
1398
+ }
1399
+ return
1400
+ }
1401
+ }
1402
+ }
1403
+ }
1404
+ }
1405
+ {
1406
+ const a_ = tree1_a;
1407
+ if(tree2_a.T) {
1408
+ if(tree2_a.color_.R) {
1409
+ const b_ = tree2_a.left_;
1410
+ const x_ = tree2_a.key_;
1411
+ const xv_ = tree2_a.value_;
1412
+ const c_ = tree2_a.right_;
1413
+ return ff_core_RbMap.T(ff_core_RbMap.R(), ff_core_RbMap.app_(a_, b_, ff_core_Ordering_Order$K), x_, xv_, c_)
1414
+ return
1415
+ }
1416
+ }
1417
+ }
1418
+ {
1419
+ if(tree1_a.T) {
1420
+ if(tree1_a.color_.R) {
1421
+ const a_ = tree1_a.left_;
1422
+ const x_ = tree1_a.key_;
1423
+ const xv_ = tree1_a.value_;
1424
+ const b_ = tree1_a.right_;
1425
+ const c_ = tree2_a;
1426
+ return ff_core_RbMap.T(ff_core_RbMap.R(), a_, x_, xv_, ff_core_RbMap.app_(b_, c_, ff_core_Ordering_Order$K))
1427
+ return
1428
+ }
1429
+ }
1430
+ }
1431
+ }
1432
+ }
1433
+
1434
+ export function RB_get(self_, key_, ff_core_Ordering_Order$K) {
1435
+ {
1436
+ const _1 = self_;
1437
+ {
1438
+ if(_1.E) {
1439
+ return ff_core_Option.None()
1440
+ return
1441
+ }
1442
+ }
1443
+ {
1444
+ if(_1.T) {
1445
+ const a_ = _1.left_;
1446
+ const y_ = _1.key_;
1447
+ const yv_ = _1.value_;
1448
+ const b_ = _1.right_;
1449
+ {
1450
+ const _1 = ff_core_Ordering_Order$K.compare_(key_, y_);
1451
+ {
1452
+ if(_1.OrderingBefore) {
1453
+ return ff_core_RbMap.RB_get(a_, key_, ff_core_Ordering_Order$K)
1454
+ return
1455
+ }
1456
+ }
1457
+ {
1458
+ if(_1.OrderingAfter) {
1459
+ return ff_core_RbMap.RB_get(b_, key_, ff_core_Ordering_Order$K)
1460
+ return
1461
+ }
1462
+ }
1463
+ {
1464
+ if(_1.OrderingSame) {
1465
+ return ff_core_Option.Some(yv_)
1466
+ return
1467
+ }
1468
+ }
1469
+ }
1470
+ return
1471
+ }
1472
+ }
1473
+ }
1474
+ }
1475
+
1476
+ export function RB_size(self_, ff_core_Ordering_Order$K) {
1477
+ {
1478
+ const _1 = self_;
1479
+ {
1480
+ if(_1.E) {
1481
+ return 0
1482
+ return
1483
+ }
1484
+ }
1485
+ {
1486
+ if(_1.T) {
1487
+ const l_ = _1.left_;
1488
+ const r_ = _1.right_;
1489
+ return ((ff_core_RbMap.RB_size(l_, ff_core_Ordering_Order$K) + 1) + ff_core_RbMap.RB_size(r_, ff_core_Ordering_Order$K))
1490
+ return
1491
+ }
1492
+ }
1493
+ }
1494
+ }
1495
+
1496
+ export function RB_pairs(self_, ff_core_Ordering_Order$K) {
1497
+ let result_ = ff_core_List.Empty();
1498
+ ff_core_RbMap.RB_each(self_, ((k_, v_) => {
1499
+ result_ = ff_core_List.Link(ff_core_Pair.Pair(k_, v_), result_)
1500
+ }), ff_core_Ordering_Order$K);
1501
+ return ff_core_List.List_reverse(result_)
1502
+ }
1503
+
1504
+ export function RB_toStream(self_, cycle_, ff_core_Ordering_Order$K) {
1505
+ let stack_ = ff_core_List.Link(self_, ff_core_List.Empty());
1506
+ function next_() {
1507
+ _tailcall: for(;;) {
1508
+ {
1509
+ const _1 = stack_;
1510
+ {
1511
+ if(_1.Empty) {
1512
+ if((cycle_ && (((_1) => {
1513
+ {
1514
+ if(_1.E) {
1515
+ return false
1516
+ return
1517
+ }
1518
+ }
1519
+ {
1520
+ return true
1521
+ return
1522
+ }
1523
+ }))(self_))) {
1524
+ stack_ = ff_core_List.Link(self_, ff_core_List.Empty());
1525
+ {
1526
+
1527
+
1528
+ continue _tailcall
1529
+ }
1530
+ } else {
1531
+ return ff_core_Option.None()
1532
+ }
1533
+ return
1534
+ }
1535
+ }
1536
+ {
1537
+ if(_1.Link) {
1538
+ if(_1.head_.E) {
1539
+ const tail_ = _1.tail_;
1540
+ stack_ = tail_;
1541
+ {
1542
+
1543
+
1544
+ continue _tailcall
1545
+ }
1546
+ return
1547
+ }
1548
+ }
1549
+ }
1550
+ {
1551
+ if(_1.Link) {
1552
+ if(_1.head_.T) {
1553
+ if(_1.head_.left_.E) {
1554
+ const k_ = _1.head_.key_;
1555
+ const v_ = _1.head_.value_;
1556
+ if(_1.head_.right_.E) {
1557
+ const tail_ = _1.tail_;
1558
+ stack_ = tail_;
1559
+ return ff_core_Option.Some(ff_core_Pair.Pair(k_, v_))
1560
+ return
1561
+ }
1562
+ }
1563
+ }
1564
+ }
1565
+ }
1566
+ {
1567
+ if(_1.Link) {
1568
+ if(_1.head_.T) {
1569
+ const l_ = _1.head_.left_;
1570
+ const k_ = _1.head_.key_;
1571
+ const v_ = _1.head_.value_;
1572
+ const r_ = _1.head_.right_;
1573
+ const tail_ = _1.tail_;
1574
+ stack_ = ff_core_List.Link(l_, ff_core_List.Link(ff_core_RbMap.T(ff_core_RbMap.B(), ff_core_RbMap.E(), k_, v_, ff_core_RbMap.E()), ff_core_List.Link(r_, tail_)));
1575
+ {
1576
+
1577
+
1578
+ continue _tailcall
1579
+ }
1580
+ return
1581
+ }
1582
+ }
1583
+ }
1584
+ }
1585
+ return
1586
+ }
1587
+ }
1588
+ return ff_core_Stream.make_((() => {
1589
+ return next_()
1590
+ }), (() => {
1591
+
1592
+ }))
1593
+ }
1594
+
1595
+ export function RB_each(self_, body_, ff_core_Ordering_Order$K) {
1596
+ {
1597
+ const _1 = self_;
1598
+ {
1599
+ if(_1.E) {
1600
+
1601
+ return
1602
+ }
1603
+ }
1604
+ {
1605
+ if(_1.T) {
1606
+ const l_ = _1.left_;
1607
+ const k_ = _1.key_;
1608
+ const v_ = _1.value_;
1609
+ const r_ = _1.right_;
1610
+ ff_core_RbMap.RB_each(l_, body_, ff_core_Ordering_Order$K);
1611
+ body_(k_, v_);
1612
+ ff_core_RbMap.RB_each(r_, body_, ff_core_Ordering_Order$K)
1613
+ return
1614
+ }
1615
+ }
1616
+ }
1617
+ }
1618
+
1619
+ export function RB_eachWhile(self_, body_, ff_core_Ordering_Order$K) {
1620
+ {
1621
+ const _1 = self_;
1622
+ {
1623
+ if(_1.E) {
1624
+ return true
1625
+ return
1626
+ }
1627
+ }
1628
+ {
1629
+ if(_1.T) {
1630
+ const l_ = _1.left_;
1631
+ const k_ = _1.key_;
1632
+ const v_ = _1.value_;
1633
+ const r_ = _1.right_;
1634
+ return ((ff_core_RbMap.RB_eachWhile(l_, body_, ff_core_Ordering_Order$K) && body_(k_, v_)) && ff_core_RbMap.RB_eachWhile(r_, body_, ff_core_Ordering_Order$K))
1635
+ return
1636
+ }
1637
+ }
1638
+ }
1639
+ }
1640
+
1641
+ export function RB_map(self_, body_, ff_core_Ordering_Order$K, ff_core_Ordering_Order$K2) {
1642
+ let result_ = ff_core_RbMap.E();
1643
+ ff_core_RbMap.RB_each(self_, ((k_, v_) => {
1644
+ const pair_ = body_(k_, v_);
1645
+ result_ = ff_core_RbMap.insert_(pair_.first_, pair_.second_, result_, ff_core_Ordering_Order$K2)
1646
+ }), ff_core_Ordering_Order$K);
1647
+ return result_
1648
+ }
1649
+
1650
+ export function RB_mapValues(self_, body_, ff_core_Ordering_Order$K) {
1651
+ {
1652
+ const _1 = self_;
1653
+ {
1654
+ if(_1.E) {
1655
+ return ff_core_RbMap.E()
1656
+ return
1657
+ }
1658
+ }
1659
+ {
1660
+ if(_1.T) {
1661
+ const c_ = _1.color_;
1662
+ const l_ = _1.left_;
1663
+ const k_ = _1.key_;
1664
+ const v_ = _1.value_;
1665
+ const r_ = _1.right_;
1666
+ return ff_core_RbMap.T(c_, ff_core_RbMap.RB_mapValues(l_, body_, ff_core_Ordering_Order$K), k_, body_(k_, v_), ff_core_RbMap.RB_mapValues(r_, body_, ff_core_Ordering_Order$K))
1667
+ return
1668
+ }
1669
+ }
1670
+ }
1671
+ }
1672
+
1673
+ export function RB_find(self_, body_, ff_core_Ordering_Order$K) {
1674
+ let result_ = ff_core_Option.None();
1675
+ ff_core_RbMap.RB_eachWhile(self_, ((k_, v_) => {
1676
+ if(body_(k_, v_)) {
1677
+ result_ = ff_core_Option.Some(ff_core_Pair.Pair(k_, v_));
1678
+ return false
1679
+ } else {
1680
+ return true
1681
+ }
1682
+ }), ff_core_Ordering_Order$K);
1683
+ return result_
1684
+ }
1685
+
1686
+ export async function RB_get$(self_, key_, ff_core_Ordering_Order$K, $task) {
1687
+ {
1688
+ const _1 = self_;
1689
+ {
1690
+ if(_1.E) {
1691
+ return ff_core_Option.None()
1692
+ return
1693
+ }
1694
+ }
1695
+ {
1696
+ if(_1.T) {
1697
+ const a_ = _1.left_;
1698
+ const y_ = _1.key_;
1699
+ const yv_ = _1.value_;
1700
+ const b_ = _1.right_;
1701
+ {
1702
+ const _1 = ff_core_Ordering_Order$K.compare_(key_, y_);
1703
+ {
1704
+ if(_1.OrderingBefore) {
1705
+ return ff_core_RbMap.RB_get(a_, key_, ff_core_Ordering_Order$K)
1706
+ return
1707
+ }
1708
+ }
1709
+ {
1710
+ if(_1.OrderingAfter) {
1711
+ return ff_core_RbMap.RB_get(b_, key_, ff_core_Ordering_Order$K)
1712
+ return
1713
+ }
1714
+ }
1715
+ {
1716
+ if(_1.OrderingSame) {
1717
+ return ff_core_Option.Some(yv_)
1718
+ return
1719
+ }
1720
+ }
1721
+ }
1722
+ return
1723
+ }
1724
+ }
1725
+ }
1726
+ }
1727
+
1728
+ export async function RB_size$(self_, ff_core_Ordering_Order$K, $task) {
1729
+ {
1730
+ const _1 = self_;
1731
+ {
1732
+ if(_1.E) {
1733
+ return 0
1734
+ return
1735
+ }
1736
+ }
1737
+ {
1738
+ if(_1.T) {
1739
+ const l_ = _1.left_;
1740
+ const r_ = _1.right_;
1741
+ return ((ff_core_RbMap.RB_size(l_, ff_core_Ordering_Order$K) + 1) + ff_core_RbMap.RB_size(r_, ff_core_Ordering_Order$K))
1742
+ return
1743
+ }
1744
+ }
1745
+ }
1746
+ }
1747
+
1748
+ export async function RB_pairs$(self_, ff_core_Ordering_Order$K, $task) {
1749
+ let result_ = ff_core_List.Empty();
1750
+ ff_core_RbMap.RB_each(self_, ((k_, v_) => {
1751
+ result_ = ff_core_List.Link(ff_core_Pair.Pair(k_, v_), result_)
1752
+ }), ff_core_Ordering_Order$K);
1753
+ return ff_core_List.List_reverse(result_)
1754
+ }
1755
+
1756
+ export async function RB_toStream$(self_, cycle_, ff_core_Ordering_Order$K, $task) {
1757
+ let stack_ = ff_core_List.Link(self_, ff_core_List.Empty());
1758
+ function next_() {
1759
+ _tailcall: for(;;) {
1760
+ {
1761
+ const _1 = stack_;
1762
+ {
1763
+ if(_1.Empty) {
1764
+ if((cycle_ && (((_1) => {
1765
+ {
1766
+ if(_1.E) {
1767
+ return false
1768
+ return
1769
+ }
1770
+ }
1771
+ {
1772
+ return true
1773
+ return
1774
+ }
1775
+ }))(self_))) {
1776
+ stack_ = ff_core_List.Link(self_, ff_core_List.Empty());
1777
+ {
1778
+
1779
+
1780
+ continue _tailcall
1781
+ }
1782
+ } else {
1783
+ return ff_core_Option.None()
1784
+ }
1785
+ return
1786
+ }
1787
+ }
1788
+ {
1789
+ if(_1.Link) {
1790
+ if(_1.head_.E) {
1791
+ const tail_ = _1.tail_;
1792
+ stack_ = tail_;
1793
+ {
1794
+
1795
+
1796
+ continue _tailcall
1797
+ }
1798
+ return
1799
+ }
1800
+ }
1801
+ }
1802
+ {
1803
+ if(_1.Link) {
1804
+ if(_1.head_.T) {
1805
+ if(_1.head_.left_.E) {
1806
+ const k_ = _1.head_.key_;
1807
+ const v_ = _1.head_.value_;
1808
+ if(_1.head_.right_.E) {
1809
+ const tail_ = _1.tail_;
1810
+ stack_ = tail_;
1811
+ return ff_core_Option.Some(ff_core_Pair.Pair(k_, v_))
1812
+ return
1813
+ }
1814
+ }
1815
+ }
1816
+ }
1817
+ }
1818
+ {
1819
+ if(_1.Link) {
1820
+ if(_1.head_.T) {
1821
+ const l_ = _1.head_.left_;
1822
+ const k_ = _1.head_.key_;
1823
+ const v_ = _1.head_.value_;
1824
+ const r_ = _1.head_.right_;
1825
+ const tail_ = _1.tail_;
1826
+ stack_ = ff_core_List.Link(l_, ff_core_List.Link(ff_core_RbMap.T(ff_core_RbMap.B(), ff_core_RbMap.E(), k_, v_, ff_core_RbMap.E()), ff_core_List.Link(r_, tail_)));
1827
+ {
1828
+
1829
+
1830
+ continue _tailcall
1831
+ }
1832
+ return
1833
+ }
1834
+ }
1835
+ }
1836
+ }
1837
+ return
1838
+ }
1839
+ }
1840
+ return (await ff_core_Stream.make_$((async ($task) => {
1841
+ return next_()
1842
+ }), (async ($task) => {
1843
+
1844
+ }), $task))
1845
+ }
1846
+
1847
+ export async function RB_each$(self_, body_, ff_core_Ordering_Order$K, $task) {
1848
+ {
1849
+ const _1 = self_;
1850
+ {
1851
+ if(_1.E) {
1852
+
1853
+ return
1854
+ }
1855
+ }
1856
+ {
1857
+ if(_1.T) {
1858
+ const l_ = _1.left_;
1859
+ const k_ = _1.key_;
1860
+ const v_ = _1.value_;
1861
+ const r_ = _1.right_;
1862
+ (await ff_core_RbMap.RB_each$(l_, body_, ff_core_Ordering_Order$K, $task));
1863
+ (await body_(k_, v_, $task));
1864
+ (await ff_core_RbMap.RB_each$(r_, body_, ff_core_Ordering_Order$K, $task))
1865
+ return
1866
+ }
1867
+ }
1868
+ }
1869
+ }
1870
+
1871
+ export async function RB_eachWhile$(self_, body_, ff_core_Ordering_Order$K, $task) {
1872
+ {
1873
+ const _1 = self_;
1874
+ {
1875
+ if(_1.E) {
1876
+ return true
1877
+ return
1878
+ }
1879
+ }
1880
+ {
1881
+ if(_1.T) {
1882
+ const l_ = _1.left_;
1883
+ const k_ = _1.key_;
1884
+ const v_ = _1.value_;
1885
+ const r_ = _1.right_;
1886
+ return (((await ff_core_RbMap.RB_eachWhile$(l_, body_, ff_core_Ordering_Order$K, $task)) && (await body_(k_, v_, $task))) && (await ff_core_RbMap.RB_eachWhile$(r_, body_, ff_core_Ordering_Order$K, $task)))
1887
+ return
1888
+ }
1889
+ }
1890
+ }
1891
+ }
1892
+
1893
+ export async function RB_map$(self_, body_, ff_core_Ordering_Order$K, ff_core_Ordering_Order$K2, $task) {
1894
+ let result_ = ff_core_RbMap.E();
1895
+ (await ff_core_RbMap.RB_each$(self_, (async (k_, v_, $task) => {
1896
+ const pair_ = (await body_(k_, v_, $task));
1897
+ result_ = ff_core_RbMap.insert_(pair_.first_, pair_.second_, result_, ff_core_Ordering_Order$K2)
1898
+ }), ff_core_Ordering_Order$K, $task));
1899
+ return result_
1900
+ }
1901
+
1902
+ export async function RB_mapValues$(self_, body_, ff_core_Ordering_Order$K, $task) {
1903
+ {
1904
+ const _1 = self_;
1905
+ {
1906
+ if(_1.E) {
1907
+ return ff_core_RbMap.E()
1908
+ return
1909
+ }
1910
+ }
1911
+ {
1912
+ if(_1.T) {
1913
+ const c_ = _1.color_;
1914
+ const l_ = _1.left_;
1915
+ const k_ = _1.key_;
1916
+ const v_ = _1.value_;
1917
+ const r_ = _1.right_;
1918
+ return ff_core_RbMap.T(c_, (await ff_core_RbMap.RB_mapValues$(l_, body_, ff_core_Ordering_Order$K, $task)), k_, (await body_(k_, v_, $task)), (await ff_core_RbMap.RB_mapValues$(r_, body_, ff_core_Ordering_Order$K, $task)))
1919
+ return
1920
+ }
1921
+ }
1922
+ }
1923
+ }
1924
+
1925
+ export async function RB_find$(self_, body_, ff_core_Ordering_Order$K, $task) {
1926
+ let result_ = ff_core_Option.None();
1927
+ (await ff_core_RbMap.RB_eachWhile$(self_, (async (k_, v_, $task) => {
1928
+ if((await body_(k_, v_, $task))) {
1929
+ result_ = ff_core_Option.Some(ff_core_Pair.Pair(k_, v_));
1930
+ return false
1931
+ } else {
1932
+ return true
1933
+ }
1934
+ }), ff_core_Ordering_Order$K, $task));
1935
+ return result_
1936
+ }
1937
+
1938
+
1939
+
1940
+