firefly-compiler 0.5.35 → 0.5.37

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 (225) hide show
  1. package/.hintrc +4 -4
  2. package/.vscode/settings.json +4 -4
  3. package/bin/Release.ff +157 -154
  4. package/bin/firefly.mjs +1 -1
  5. package/compiler/Builder.ff +275 -277
  6. package/compiler/Compiler.ff +234 -233
  7. package/compiler/Dependencies.ff +186 -187
  8. package/compiler/DependencyLock.ff +17 -17
  9. package/compiler/Deriver.ff +23 -31
  10. package/compiler/Dictionaries.ff +1 -1
  11. package/compiler/Inference.ff +43 -20
  12. package/compiler/JsEmitter.ff +1437 -1282
  13. package/compiler/LspHook.ff +202 -202
  14. package/compiler/Main.ff +25 -24
  15. package/compiler/ModuleCache.ff +178 -178
  16. package/compiler/Parser.ff +36 -109
  17. package/compiler/Resolver.ff +5 -8
  18. package/compiler/Substitution.ff +1 -1
  19. package/compiler/Syntax.ff +1 -16
  20. package/compiler/Token.ff +9 -0
  21. package/compiler/Tokenizer.ff +4 -0
  22. package/compiler/Workspace.ff +88 -88
  23. package/core/.firefly/include/package.json +5 -5
  24. package/core/.firefly/package.ff +2 -2
  25. package/core/Any.ff +26 -30
  26. package/core/Array.ff +298 -265
  27. package/core/Atomic.ff +63 -64
  28. package/core/Box.ff +7 -7
  29. package/core/BrowserSystem.ff +40 -40
  30. package/core/Buffer.ff +185 -152
  31. package/core/BuildSystem.ff +156 -148
  32. package/core/Channel.ff +95 -92
  33. package/core/Char.ff +3 -2
  34. package/core/Core.ff +16 -23
  35. package/core/Crypto.ff +94 -96
  36. package/core/Equal.ff +41 -36
  37. package/core/Error.ff +15 -10
  38. package/core/FileHandle.ff +45 -37
  39. package/core/Float.ff +176 -200
  40. package/core/HttpClient.ff +142 -148
  41. package/core/Instant.ff +6 -8
  42. package/core/Int.ff +40 -24
  43. package/core/IntMap.ff +61 -39
  44. package/core/Js.ff +305 -0
  45. package/core/JsSystem.ff +135 -114
  46. package/core/JsValue.ff +303 -159
  47. package/core/Json.ff +423 -443
  48. package/core/List.ff +482 -486
  49. package/core/Lock.ff +108 -144
  50. package/core/Log.ff +25 -14
  51. package/core/NodeSystem.ff +198 -191
  52. package/core/Ordering.ff +160 -161
  53. package/core/Path.ff +377 -409
  54. package/core/Queue.ff +90 -0
  55. package/core/Random.ff +140 -134
  56. package/core/RbMap.ff +216 -216
  57. package/core/Serializable.ff +16 -13
  58. package/core/Show.ff +44 -43
  59. package/core/SourceLocation.ff +68 -68
  60. package/core/Stream.ff +1 -1
  61. package/core/String.ff +224 -202
  62. package/core/StringMap.ff +58 -36
  63. package/core/Task.ff +165 -149
  64. package/experimental/benchmarks/ListGrab.ff +23 -23
  65. package/experimental/benchmarks/ListGrab.java +55 -55
  66. package/experimental/benchmarks/Pyrotek45.ff +30 -30
  67. package/experimental/benchmarks/Pyrotek45.java +64 -64
  68. package/experimental/bidirectional/Bidi.ff +88 -88
  69. package/experimental/lines/Main.ff +40 -0
  70. package/experimental/random/Index.ff +53 -53
  71. package/experimental/random/Process.ff +120 -120
  72. package/experimental/random/RunLength.ff +65 -65
  73. package/experimental/random/Scrape.ff +51 -51
  74. package/experimental/random/Symbols.ff +73 -73
  75. package/experimental/random/Tensor.ff +52 -52
  76. package/experimental/random/Units.ff +36 -36
  77. package/experimental/s3/S3TestAuthorizationHeader.ff +39 -39
  78. package/experimental/s3/S3TestPut.ff +16 -16
  79. package/experimental/tests/TestJson.ff +26 -26
  80. package/firefly.sh +0 -0
  81. package/fireflysite/.firefly/package.ff +4 -4
  82. package/fireflysite/CommunityOverview.ff +20 -20
  83. package/fireflysite/CountingButtonDemo.ff +58 -58
  84. package/fireflysite/DocumentParser.ff +325 -331
  85. package/fireflysite/ExamplesOverview.ff +40 -40
  86. package/fireflysite/FrontPage.ff +344 -344
  87. package/fireflysite/GettingStarted.ff +45 -45
  88. package/fireflysite/Guide.ff +456 -456
  89. package/fireflysite/Main.ff +163 -152
  90. package/fireflysite/MatchingPasswordsDemo.ff +82 -82
  91. package/fireflysite/PackagesOverview.ff +49 -49
  92. package/fireflysite/PostgresqlDemo.ff +34 -34
  93. package/fireflysite/ReferenceAll.ff +18 -18
  94. package/fireflysite/ReferenceIntroduction.ff +11 -11
  95. package/fireflysite/Styles.ff +567 -567
  96. package/fireflysite/Test.ff +121 -62
  97. package/fireflysite/assets/markdown/reference/BaseTypes.md +209 -209
  98. package/fireflysite/assets/markdown/reference/EmittedJavascript.md +65 -65
  99. package/fireflysite/assets/markdown/reference/Exceptions.md +101 -101
  100. package/fireflysite/assets/markdown/reference/FunctionsAndMethods.md +364 -364
  101. package/fireflysite/assets/markdown/reference/JavascriptInterop.md +235 -172
  102. package/fireflysite/assets/markdown/reference/ModulesAndPackages.md +162 -162
  103. package/fireflysite/assets/markdown/reference/OldStructuredConcurrency.md +48 -48
  104. package/fireflysite/assets/markdown/reference/PatternMatching.md +224 -224
  105. package/fireflysite/assets/markdown/reference/StatementsAndExpressions.md +86 -86
  106. package/fireflysite/assets/markdown/reference/StructuredConcurrency.md +99 -99
  107. package/fireflysite/assets/markdown/reference/TraitsAndInstances.md +100 -100
  108. package/fireflysite/assets/markdown/reference/UserDefinedTypes.md +184 -184
  109. package/fireflysite/assets/markdown/scratch/ControlFlow.md +136 -136
  110. package/fireflysite/assets/markdown/scratch/Toc.md +40 -40
  111. package/lsp/.firefly/package.ff +1 -1
  112. package/lsp/CompletionHandler.ff +827 -827
  113. package/lsp/Handler.ff +714 -714
  114. package/lsp/HoverHandler.ff +79 -79
  115. package/lsp/LanguageServer.ff +272 -272
  116. package/lsp/SignatureHelpHandler.ff +55 -55
  117. package/lsp/SymbolHandler.ff +181 -181
  118. package/lsp/TestReferences.ff +17 -17
  119. package/lsp/TestReferencesCase.ff +7 -7
  120. package/lsp/stderr.txt +1 -1
  121. package/lsp/stdout.txt +34 -34
  122. package/lux/.firefly/package.ff +1 -1
  123. package/lux/Css.ff +648 -648
  124. package/lux/CssTest.ff +48 -48
  125. package/lux/Lux.ff +608 -617
  126. package/lux/LuxEvent.ff +79 -116
  127. package/lux/Main.ff +123 -123
  128. package/lux/Main2.ff +143 -143
  129. package/lux/TestDry.ff +28 -28
  130. package/output/js/ff/compiler/Builder.mjs +72 -71
  131. package/output/js/ff/compiler/Compiler.mjs +19 -13
  132. package/output/js/ff/compiler/Dependencies.mjs +8 -7
  133. package/output/js/ff/compiler/DependencyLock.mjs +6 -4
  134. package/output/js/ff/compiler/Deriver.mjs +26 -24
  135. package/output/js/ff/compiler/Dictionaries.mjs +14 -18
  136. package/output/js/ff/compiler/Environment.mjs +6 -4
  137. package/output/js/ff/compiler/Inference.mjs +238 -164
  138. package/output/js/ff/compiler/JsEmitter.mjs +1160 -350
  139. package/output/js/ff/compiler/JsImporter.mjs +20 -18
  140. package/output/js/ff/compiler/LspHook.mjs +12 -10
  141. package/output/js/ff/compiler/Main.mjs +61 -41
  142. package/output/js/ff/compiler/ModuleCache.mjs +10 -8
  143. package/output/js/ff/compiler/Parser.mjs +153 -669
  144. package/output/js/ff/compiler/Patterns.mjs +12 -10
  145. package/output/js/ff/compiler/Resolver.mjs +52 -78
  146. package/output/js/ff/compiler/Substitution.mjs +12 -16
  147. package/output/js/ff/compiler/Syntax.mjs +50 -341
  148. package/output/js/ff/compiler/Token.mjs +126 -4
  149. package/output/js/ff/compiler/Tokenizer.mjs +62 -52
  150. package/output/js/ff/compiler/Unification.mjs +74 -90
  151. package/output/js/ff/compiler/Wildcards.mjs +4 -2
  152. package/output/js/ff/compiler/Workspace.mjs +26 -20
  153. package/output/js/ff/core/Any.mjs +20 -20
  154. package/output/js/ff/core/Array.mjs +268 -175
  155. package/output/js/ff/core/AssetSystem.mjs +8 -6
  156. package/output/js/ff/core/Atomic.mjs +84 -52
  157. package/output/js/ff/core/Bool.mjs +6 -4
  158. package/output/js/ff/core/BrowserSystem.mjs +38 -29
  159. package/output/js/ff/core/Buffer.mjs +285 -133
  160. package/output/js/ff/core/BuildSystem.mjs +36 -56
  161. package/output/js/ff/core/Channel.mjs +250 -97
  162. package/output/js/ff/core/Char.mjs +5 -3
  163. package/output/js/ff/core/Core.mjs +28 -34
  164. package/output/js/ff/core/Crypto.mjs +30 -52
  165. package/output/js/ff/core/Duration.mjs +4 -2
  166. package/output/js/ff/core/Equal.mjs +14 -12
  167. package/output/js/ff/core/Error.mjs +17 -11
  168. package/output/js/ff/core/FileHandle.mjs +76 -38
  169. package/output/js/ff/core/Float.mjs +92 -160
  170. package/output/js/ff/core/HttpClient.mjs +208 -76
  171. package/output/js/ff/core/Instant.mjs +8 -10
  172. package/output/js/ff/core/Int.mjs +36 -26
  173. package/output/js/ff/core/IntMap.mjs +79 -33
  174. package/output/js/ff/core/Js.mjs +751 -0
  175. package/output/js/ff/core/JsSystem.mjs +54 -60
  176. package/output/js/ff/core/JsValue.mjs +294 -143
  177. package/output/js/ff/core/Json.mjs +443 -253
  178. package/output/js/ff/core/List.mjs +262 -214
  179. package/output/js/ff/core/Lock.mjs +156 -125
  180. package/output/js/ff/core/Log.mjs +20 -10
  181. package/output/js/ff/core/Map.mjs +10 -8
  182. package/output/js/ff/core/NodeSystem.mjs +189 -123
  183. package/output/js/ff/core/Nothing.mjs +4 -2
  184. package/output/js/ff/core/Option.mjs +40 -38
  185. package/output/js/ff/core/Ordering.mjs +26 -20
  186. package/output/js/ff/core/Pair.mjs +4 -2
  187. package/output/js/ff/core/Path.mjs +517 -315
  188. package/output/js/ff/core/Queue.mjs +306 -0
  189. package/output/js/ff/core/Random.mjs +141 -77
  190. package/output/js/ff/core/RbMap.mjs +36 -34
  191. package/output/js/ff/core/Serializable.mjs +44 -28
  192. package/output/js/ff/core/Set.mjs +6 -4
  193. package/output/js/ff/core/Show.mjs +8 -6
  194. package/output/js/ff/core/SourceLocation.mjs +4 -2
  195. package/output/js/ff/core/Stream.mjs +30 -50
  196. package/output/js/ff/core/String.mjs +263 -172
  197. package/output/js/ff/core/StringMap.mjs +77 -31
  198. package/output/js/ff/core/Task.mjs +91 -76
  199. package/output/js/ff/core/Try.mjs +20 -18
  200. package/output/js/ff/core/Unit.mjs +4 -2
  201. package/package.json +1 -1
  202. package/postgresql/Pg.ff +53 -59
  203. package/rpc/.firefly/package.ff +1 -1
  204. package/rpc/Rpc.ff +70 -70
  205. package/s3/.firefly/package.ff +1 -1
  206. package/s3/S3.ff +92 -94
  207. package/vscode/LICENSE.txt +21 -21
  208. package/vscode/Prepublish.ff +15 -15
  209. package/vscode/README.md +16 -16
  210. package/vscode/client/package-lock.json +544 -544
  211. package/vscode/client/package.json +22 -22
  212. package/vscode/client/src/extension.ts +104 -104
  213. package/vscode/icons/firefly-icon.svg +10 -10
  214. package/vscode/language-configuration.json +61 -61
  215. package/vscode/package-lock.json +3623 -3623
  216. package/vscode/package.json +1 -1
  217. package/vscode/snippets.json +241 -241
  218. package/vscode/syntaxes/firefly-markdown-injection.json +45 -45
  219. package/webserver/.firefly/include/package.json +5 -5
  220. package/webserver/.firefly/package.ff +2 -2
  221. package/webserver/WebServer.ff +647 -685
  222. package/websocket/.firefly/package.ff +1 -1
  223. package/websocket/WebSocket.ff +100 -131
  224. package/core/UnsafeJs.ff +0 -42
  225. package/output/js/ff/core/UnsafeJs.mjs +0 -191
@@ -42,6 +42,8 @@ import * as ff_core_Int from "../../ff/core/Int.mjs"
42
42
 
43
43
  import * as ff_core_IntMap from "../../ff/core/IntMap.mjs"
44
44
 
45
+ import * as ff_core_Js from "../../ff/core/Js.mjs"
46
+
45
47
  import * as ff_core_JsSystem from "../../ff/core/JsSystem.mjs"
46
48
 
47
49
  import * as ff_core_JsValue from "../../ff/core/JsValue.mjs"
@@ -68,6 +70,8 @@ import * as ff_core_Pair from "../../ff/core/Pair.mjs"
68
70
 
69
71
  import * as ff_core_Path from "../../ff/core/Path.mjs"
70
72
 
73
+ import * as ff_core_Queue from "../../ff/core/Queue.mjs"
74
+
71
75
  import * as ff_core_Random from "../../ff/core/Random.mjs"
72
76
 
73
77
  import * as ff_core_Serializable from "../../ff/core/Serializable.mjs"
@@ -90,75 +94,67 @@ import * as ff_core_Try from "../../ff/core/Try.mjs"
90
94
 
91
95
  import * as ff_core_Unit from "../../ff/core/Unit.mjs"
92
96
 
93
- import * as ff_core_UnsafeJs from "../../ff/core/UnsafeJs.mjs"
94
-
95
97
  // type List
96
98
 
97
99
 
98
100
 
99
101
 
100
102
  export function new_() {
101
-
102
- return [];
103
-
103
+ return []
104
104
  }
105
105
 
106
106
  export function fill_(size_, value_) {
107
-
108
- return new Array(size_).fill(value_);
109
-
107
+ return (new Array(size_)).fill(value_)
110
108
  }
111
109
 
112
110
  export function fillBy_(size_, body_) {
113
-
114
- return Array.from({length: size_}, (_, i) => body_(i));
115
-
116
- }
117
-
118
- export function range_(size_) {
119
-
120
- return Array.from({length: size_}, (_, i) => i);
121
-
111
+ if(false) {
112
+ const array_ = (new Array(size_));
113
+ for(let for_i = 1, for_e = size_; for_i < for_e; for_i++) {
114
+ const i_ = for_i;
115
+ array_[i_] = body_(i_)
116
+ };
117
+ return array_
118
+ } else {
119
+ return Array.from({length: size_}, ((_, i_) => {
120
+ return body_(i_)
121
+ }))
122
122
  }
123
-
124
- export function internalSame_(left_, right_) {
125
- return left_ === right_
126
123
  }
127
124
 
128
- export function internalGrab_(self_, index_) {
129
-
130
- return index_ < 0 || index_ >= self_.length ? ff_core_Try.internalThrowGrabException_() : self_[index_];
131
-
125
+ export function range_(size_) {
126
+ return Array.from({length: size_}, ((_, i_) => {
127
+ return i_
128
+ }))
132
129
  }
133
130
 
134
131
  export async function new_$($task) {
135
- throw new Error('Function new is missing on this target in async context.');
132
+ return []
136
133
  }
137
134
 
138
135
  export async function fill_$(size_, value_, $task) {
139
- throw new Error('Function fill is missing on this target in async context.');
136
+ return (new Array(size_)).fill(value_)
140
137
  }
141
138
 
142
139
  export async function fillBy_$(size_, body_, $task) {
143
-
144
- const array = new Array(size_);
145
- for(let i = 0; i < size_; i++) {
146
- array[i] = await(body_(_i));
147
- }
148
- return array;
149
-
150
- }
151
-
152
- export async function range_$(size_, $task) {
153
- throw new Error('Function range is missing on this target in async context.');
140
+ if(true) {
141
+ const array_ = (new Array(size_));
142
+ for(let for_i = 1, for_e = size_; for_i < for_e; for_i++) {
143
+ const i_ = for_i;
144
+ array_[i_] = (await body_(i_, $task))
145
+ };
146
+ return array_
147
+ } else {
148
+ return Array.from({length: size_}, (async (a_1, a_2) => await (async (_, i_, $task) => {
149
+ return (await body_(i_, $task))
150
+ })(a_1, a_2, $task)))
154
151
  }
155
-
156
- export async function internalSame_$(left_, right_, $task) {
157
- throw new Error('Function internalSame is missing on this target in async context.');
158
152
  }
159
153
 
160
- export async function internalGrab_$(self_, index_, $task) {
161
- throw new Error('Function internalGrab is missing on this target in async context.');
154
+ export async function range_$(size_, $task) {
155
+ return Array.from({length: size_}, ((_, i_) => {
156
+ return i_
157
+ }))
162
158
  }
163
159
 
164
160
  export function List_addAll(self_, that_) {
@@ -166,7 +162,7 @@ return self_.concat(that_)
166
162
  }
167
163
 
168
164
  export function List_isEmpty(self_) {
169
- return self_.length === 0
165
+ return (self_.length === 0)
170
166
  }
171
167
 
172
168
  export function List_size(self_) {
@@ -174,17 +170,18 @@ return self_.length
174
170
  }
175
171
 
176
172
  export function List_get(self_, index_) {
177
-
178
- return index_ >= 0 && index_ < self_.length
179
- ? ff_core_Option.Some(self_[index_])
180
- : ff_core_Option.None()
181
-
173
+ if(((index_ >= 0) && (index_ < self_.length))) {
174
+ return ff_core_Option.Some(self_[index_])
175
+ } else {
176
+ return ff_core_Option.None()
177
+ }
182
178
  }
183
179
 
184
180
  export function List_grab(self_, index_) {
185
-
186
- return self_[index_] ?? internalGrab_(self_, index_);
187
-
181
+ if(((index_ < 0) || (index_ >= self_.length))) {
182
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_core_Core.GrabException(), ff_core_Core.ff_core_Any_HasAnyTag$ff_core_Core_GrabException)})
183
+ };
184
+ return self_[index_]
188
185
  }
189
186
 
190
187
  export function List_first(self_) {
@@ -196,7 +193,7 @@ return ff_core_List.List_get(self_, (self_.length - 1))
196
193
  }
197
194
 
198
195
  export function List_grabFirst(self_) {
199
- return (self_[0] ?? ff_core_List.internalGrab_(self_, 0))
196
+ return (self_[0] ?? ff_core_List.List_grab(self_, 0))
200
197
  }
201
198
 
202
199
  export function List_grabLast(self_) {
@@ -208,7 +205,7 @@ return self_.slice(0, count_)
208
205
  }
209
206
 
210
207
  export function List_takeLast(self_, count_ = 1) {
211
- return self_.slice(-count_)
208
+ return self_.slice((-count_))
212
209
  }
213
210
 
214
211
  export function List_dropFirst(self_, count_ = 1) {
@@ -216,14 +213,14 @@ return self_.slice(count_)
216
213
  }
217
214
 
218
215
  export function List_dropLast(self_, count_ = 1) {
219
- return self_.slice(0, self_.length - count_)
216
+ return self_.slice(0, (self_.length - count_))
220
217
  }
221
218
 
222
219
  export function List_count(self_, body_) {
223
220
  let result_ = 0;
224
221
  let i_ = 0;
225
222
  while((i_ < self_.length)) {
226
- if(body_((self_[i_] ?? ff_core_List.internalGrab_(self_, i_)))) {
223
+ if(body_((self_[i_] ?? ff_core_List.List_grab(self_, i_)))) {
227
224
  result_ += 1
228
225
  };
229
226
  i_ += 1
@@ -233,7 +230,7 @@ return result_
233
230
 
234
231
  export function List_countWhile(self_, body_) {
235
232
  let i_ = 0;
236
- while(((i_ < self_.length) && body_((self_[i_] ?? ff_core_List.internalGrab_(self_, i_))))) {
233
+ while(((i_ < self_.length) && body_((self_[i_] ?? ff_core_List.List_grab(self_, i_))))) {
237
234
  i_ += 1
238
235
  };
239
236
  return i_
@@ -242,8 +239,8 @@ return i_
242
239
  export function List_takeWhile(self_, body_) {
243
240
  const result_ = ff_core_Array.new_();
244
241
  let i_ = 0;
245
- while(((i_ < self_.length) && body_((self_[i_] ?? ff_core_List.internalGrab_(self_, i_))))) {
246
- result_.array.push((self_[i_] ?? ff_core_List.internalGrab_(self_, i_)));
242
+ while(((i_ < self_.length) && body_((self_[i_] ?? ff_core_List.List_grab(self_, i_))))) {
243
+ result_.array.push((self_[i_] ?? ff_core_List.List_grab(self_, i_)));
247
244
  i_ += 1
248
245
  };
249
246
  return ff_core_Array.Array_drain(result_)
@@ -252,11 +249,11 @@ return ff_core_Array.Array_drain(result_)
252
249
  export function List_dropWhile(self_, body_) {
253
250
  const result_ = ff_core_Array.new_();
254
251
  let i_ = 0;
255
- while(((i_ < self_.length) && body_((self_[i_] ?? ff_core_List.internalGrab_(self_, i_))))) {
252
+ while(((i_ < self_.length) && body_((self_[i_] ?? ff_core_List.List_grab(self_, i_))))) {
256
253
  i_ += 1
257
254
  };
258
255
  while((i_ < self_.length)) {
259
- result_.array.push((self_[i_] ?? ff_core_List.internalGrab_(self_, i_)));
256
+ result_.array.push((self_[i_] ?? ff_core_List.List_grab(self_, i_)));
260
257
  i_ += 1
261
258
  };
262
259
  return ff_core_Array.Array_drain(result_)
@@ -266,12 +263,12 @@ export function List_partitionWhile(self_, body_) {
266
263
  const first_ = ff_core_Array.new_();
267
264
  const second_ = ff_core_Array.new_();
268
265
  let i_ = 0;
269
- while(((i_ < self_.length) && body_((self_[i_] ?? ff_core_List.internalGrab_(self_, i_))))) {
270
- first_.array.push((self_[i_] ?? ff_core_List.internalGrab_(self_, i_)));
266
+ while(((i_ < self_.length) && body_((self_[i_] ?? ff_core_List.List_grab(self_, i_))))) {
267
+ first_.array.push((self_[i_] ?? ff_core_List.List_grab(self_, i_)));
271
268
  i_ += 1
272
269
  };
273
270
  while((i_ < self_.length)) {
274
- second_.array.push((self_[i_] ?? ff_core_List.internalGrab_(self_, i_)));
271
+ second_.array.push((self_[i_] ?? ff_core_List.List_grab(self_, i_)));
275
272
  i_ += 1
276
273
  };
277
274
  return ff_core_Pair.Pair(ff_core_Array.Array_drain(first_), ff_core_Array.Array_drain(second_))
@@ -292,7 +289,7 @@ return ff_core_List.List_takeFirst(ff_core_List.List_dropFirst(self_, from_), (u
292
289
 
293
290
  export function List_foldLeft(self_, initial_, body_) {
294
291
  let result_ = initial_;
295
- for(let for_i = 0, for_a = self_, for_l = for_a.length; for_i < for_l; for_i++) {
292
+ for(let for_a = self_, for_i = 0, for_l = for_a.length; for_i < for_l; for_i++) {
296
293
  const x_ = for_a[for_i];
297
294
  result_ = body_(result_, x_)
298
295
  };
@@ -306,14 +303,12 @@ return value_
306
303
  }
307
304
 
308
305
  export function List_modify(self_, index_, body_) {
309
-
310
- if(index_ < 0 || index_ >= self_.length) {
311
- ff_core_Try.internalThrowGrabException_()
312
- }
313
- let result = self_.slice();
314
- result[index_] = body_(result[index_]);
315
- return result;
316
-
306
+ if(((index_ < 0) || (index_ >= self_.length))) {
307
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_core_Core.GrabException(), ff_core_Core.ff_core_Any_HasAnyTag$ff_core_Core_GrabException)})
308
+ };
309
+ const result_ = self_.slice();
310
+ result_[index_] = body_(result_[index_]);
311
+ return result_
317
312
  }
318
313
 
319
314
  export function List_zip(self_, that_) {
@@ -321,13 +316,13 @@ if((self_.length <= that_.length)) {
321
316
  let i_ = (-1);
322
317
  return ff_core_List.List_map(self_, ((x_) => {
323
318
  i_ += 1;
324
- return ff_core_Pair.Pair(x_, (that_[i_] ?? ff_core_List.internalGrab_(that_, i_)))
319
+ return ff_core_Pair.Pair(x_, (that_[i_] ?? ff_core_List.List_grab(that_, i_)))
325
320
  }))
326
321
  } else {
327
322
  let i_ = (-1);
328
323
  return ff_core_List.List_map(that_, ((y_) => {
329
324
  i_ += 1;
330
- return ff_core_Pair.Pair((self_[i_] ?? ff_core_List.internalGrab_(self_, i_)), y_)
325
+ return ff_core_Pair.Pair((self_[i_] ?? ff_core_List.List_grab(self_, i_)), y_)
331
326
  }))
332
327
  }
333
328
  }
@@ -336,7 +331,7 @@ export function List_chunk(self_, chunkSize_) {
336
331
  const results_ = ff_core_Array.new_();
337
332
  const result_ = ff_core_Array.new_();
338
333
  let added_ = 0;
339
- for(let for_i = 0, for_a = self_, for_l = for_a.length; for_i < for_l; for_i++) {
334
+ for(let for_a = self_, for_i = 0, for_l = for_a.length; for_i < for_l; for_i++) {
340
335
  const item_ = for_a[for_i];
341
336
  if((added_ < chunkSize_)) {
342
337
  added_ += 1
@@ -357,13 +352,13 @@ let index_ = 0;
357
352
  return ff_core_Stream.new_((() => {
358
353
  if((index_ < self_.length)) {
359
354
  return ff_core_Option.Some((function() {
360
- const result_ = (self_[index_] ?? ff_core_List.internalGrab_(self_, index_));
355
+ const result_ = (self_[index_] ?? ff_core_List.List_grab(self_, index_));
361
356
  index_ += 1;
362
357
  return result_
363
358
  })())
364
359
  } else if((cycle_ && (index_ !== 0))) {
365
360
  return ff_core_Option.Some((function() {
366
- const result_ = (self_[0] ?? ff_core_List.internalGrab_(self_, 0));
361
+ const result_ = (self_[0] ?? ff_core_List.List_grab(self_, 0));
367
362
  index_ = 1;
368
363
  return result_
369
364
  })())
@@ -377,21 +372,39 @@ export function List_toArray(self_) {
377
372
  return {array: self_.slice()}
378
373
  }
379
374
 
375
+ export function List_toQueue(self_) {
376
+ const queue_ = ff_core_Queue.new_();
377
+ for(let for_a = self_, for_i = 0, for_l = for_a.length; for_i < for_l; for_i++) {
378
+ const v_ = for_a[for_i];
379
+ ff_core_Queue.Queue_push(queue_, v_)
380
+ };
381
+ return queue_
382
+ }
383
+
380
384
  export function List_each(self_, body_) {
381
-
382
- return self_.forEach(body_);
383
-
385
+ let i_ = 0;
386
+ while((i_ < self_.length)) {
387
+ body_(self_[i_]);
388
+ i_ += 1
389
+ }
384
390
  }
385
391
 
386
392
  export function List_eachWhile(self_, body_) {
387
- for(const value of self_) if(!body_(value)) break
393
+ let i_ = 0;
394
+ while((i_ < self_.length)) {
395
+ if(body_(self_[i_])) {
396
+ i_ += 1
397
+ } else {
398
+ i_ = self_.length
399
+ }
400
+ }
388
401
  }
389
402
 
390
403
  export function List_all(self_, body_) {
391
404
  let result_ = true;
392
- for(let for_i = 0, for_a = self_, for_l = for_a.length; for_i < for_l; for_i++) {
405
+ for(let for_a = self_, for_i = 0, for_l = for_a.length; for_i < for_l; for_i++) {
393
406
  const x_ = for_a[for_i];
394
- result_ = (result_ && body_(x_));
407
+ result_ = body_(x_);
395
408
  if(!result_) break
396
409
  };
397
410
  return result_
@@ -399,40 +412,45 @@ return result_
399
412
 
400
413
  export function List_any(self_, body_) {
401
414
  let result_ = false;
402
- for(let for_i = 0, for_a = self_, for_l = for_a.length; for_i < for_l; for_i++) {
415
+ for(let for_a = self_, for_i = 0, for_l = for_a.length; for_i < for_l; for_i++) {
403
416
  const x_ = for_a[for_i];
404
- result_ = (result_ || body_(x_));
417
+ result_ = body_(x_);
405
418
  if(!(!result_)) break
406
419
  };
407
420
  return result_
408
421
  }
409
422
 
410
- export function List_indexWhere(self_, body_) {
423
+ export function List_find(self_, body_) {
411
424
  let result_ = ff_core_Option.None();
412
- let i_ = 0;
413
- for(let for_i = 0, for_a = self_, for_l = for_a.length; for_i < for_l; for_i++) {
425
+ for(let for_a = self_, for_i = 0, for_l = for_a.length; for_i < for_l; for_i++) {
414
426
  const x_ = for_a[for_i];
415
- if(!(body_(x_)
416
- ? (result_ = ff_core_Option.Some(i_), false)
417
- : (i_ += 1, true))) break
427
+ if(body_(x_)) {
428
+ result_ = ff_core_Option.Some(x_);
429
+ if(!false) break
430
+ } else {
431
+ if(!true) break
432
+ }
418
433
  };
419
434
  return result_
420
435
  }
421
436
 
422
- export function List_find(self_, body_) {
423
- let result_ = ff_core_Option.None();
424
- for(let for_i = 0, for_a = self_, for_l = for_a.length; for_i < for_l; for_i++) {
437
+ export function List_indexWhere(self_, body_) {
438
+ let i_ = (-1);
439
+ let result_ = false;
440
+ for(let for_a = self_, for_i = 0, for_l = for_a.length; for_i < for_l; for_i++) {
425
441
  const x_ = for_a[for_i];
426
- if(!(body_(x_)
427
- ? (result_ = ff_core_Option.Some(x_), false)
428
- : true)) break
442
+ i_ += 1;
443
+ result_ = body_(x_);
444
+ if(!(!result_)) break
429
445
  };
430
- return result_
446
+ if(result_) {
447
+ return ff_core_Option.Some(i_)
448
+ } else return ff_core_Option.None()
431
449
  }
432
450
 
433
451
  export function List_filter(self_, body_) {
434
452
  const result_ = ff_core_Array.new_();
435
- for(let for_i = 0, for_a = self_, for_l = for_a.length; for_i < for_l; for_i++) {
453
+ for(let for_a = self_, for_i = 0, for_l = for_a.length; for_i < for_l; for_i++) {
436
454
  const x_ = for_a[for_i];
437
455
  if(body_(x_)) {
438
456
  result_.array.push(x_)
@@ -448,14 +466,17 @@ return (!body_(_w1))
448
466
  }
449
467
 
450
468
  export function List_map(self_, body_) {
451
-
452
- return self_.map(body_)
453
-
469
+ const array_ = ff_core_Array.new_();
470
+ for(let for_a = self_, for_i = 0, for_l = for_a.length; for_i < for_l; for_i++) {
471
+ const e_ = for_a[for_i];
472
+ array_.array.push(body_(e_))
473
+ };
474
+ return ff_core_Array.Array_drain(array_)
454
475
  }
455
476
 
456
477
  export function List_flatMap(self_, body_) {
457
478
  const results_ = ff_core_Array.new_();
458
- for(let for_i = 0, for_a = self_, for_l = for_a.length; for_i < for_l; for_i++) {
479
+ for(let for_a = self_, for_i = 0, for_l = for_a.length; for_i < for_l; for_i++) {
459
480
  const x_ = for_a[for_i];
460
481
  ff_core_Array.Array_pushList(results_, body_(x_))
461
482
  };
@@ -464,12 +485,14 @@ return ff_core_Array.Array_drain(results_)
464
485
 
465
486
  export function List_collect(self_, body_) {
466
487
  let result_ = ff_core_Array.new_();
467
- for(let for_i = 0, for_a = self_, for_l = for_a.length; for_i < for_l; for_i++) {
488
+ for(let for_a = self_, for_i = 0, for_l = for_a.length; for_i < for_l; for_i++) {
468
489
  const x_ = for_a[for_i];
469
- for(const for_o = body_(x_); for_o.Some;) {
470
- const _w1 = for_o.value_;
490
+ {
491
+ const if_o = body_(x_)
492
+ if(if_o.Some) {
493
+ const _w1 = if_o.value_;
471
494
  result_.array.push(_w1)
472
- break
495
+ }
473
496
  }
474
497
  };
475
498
  return ff_core_Array.Array_drain(result_)
@@ -477,18 +500,20 @@ return ff_core_Array.Array_drain(result_)
477
500
 
478
501
  export function List_collectFirst(self_, body_) {
479
502
  let result_ = ff_core_Option.None();
480
- for(let for_i = 0, for_a = self_, for_l = for_a.length; for_i < for_l; for_i++) {
503
+ for(let for_a = self_, for_i = 0, for_l = for_a.length; for_i < for_l; for_i++) {
481
504
  const x_ = for_a[for_i];
482
- if(!(((_1) => {
505
+ {
506
+ const _1 = body_(x_);
483
507
  if(_1.None) {
484
- return true
508
+ if(!true) break
509
+ continue
485
510
  }
486
511
  {
487
512
  const o_ = _1;
488
513
  result_ = o_;
489
- return false
514
+ if(!false) break
515
+ }
490
516
  }
491
- }))(body_(x_))) break
492
517
  };
493
518
  return result_
494
519
  }
@@ -513,38 +538,42 @@ return ff_core_List.List_grab(self_, (self_.length - i_))
513
538
 
514
539
  export function List_separate(self_, separator_) {
515
540
  const array_ = ff_core_Array.new_();
516
- ff_core_List.List_each(ff_core_List.List_pairs(self_), ((_1) => {
517
- {
518
- const i_ = _1.first_;
519
- const x_ = _1.second_;
541
+ for(let for_a = self_, for_i = 0, for_l = for_a.length; for_i < for_l; for_i++) {
542
+ const i_ = for_i;
543
+ const x_ = for_a[for_i];
520
544
  if((i_ !== 0)) {
521
545
  ff_core_Array.Array_pushList(array_, separator_)
522
546
  };
523
547
  array_.array.push(x_)
524
- return
525
- }
526
- }));
548
+ };
527
549
  return ff_core_Array.Array_drain(array_)
528
550
  }
529
551
 
530
552
  export async function List_addAll$(self_, that_, $task) {
531
- throw new Error('Function List_addAll is missing on this target in async context.');
553
+ return self_.concat(that_)
532
554
  }
533
555
 
534
556
  export async function List_isEmpty$(self_, $task) {
535
- throw new Error('Function List_isEmpty is missing on this target in async context.');
557
+ return (self_.length === 0)
536
558
  }
537
559
 
538
560
  export async function List_size$(self_, $task) {
539
- throw new Error('Function List_size is missing on this target in async context.');
561
+ return self_.length
540
562
  }
541
563
 
542
564
  export async function List_get$(self_, index_, $task) {
543
- throw new Error('Function List_get is missing on this target in async context.');
565
+ if(((index_ >= 0) && (index_ < self_.length))) {
566
+ return ff_core_Option.Some(self_[index_])
567
+ } else {
568
+ return ff_core_Option.None()
569
+ }
544
570
  }
545
571
 
546
572
  export async function List_grab$(self_, index_, $task) {
547
- throw new Error('Function List_grab is missing on this target in async context.');
573
+ if(((index_ < 0) || (index_ >= self_.length))) {
574
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_core_Core.GrabException(), ff_core_Core.ff_core_Any_HasAnyTag$ff_core_Core_GrabException)})
575
+ };
576
+ return self_[index_]
548
577
  }
549
578
 
550
579
  export async function List_first$(self_, $task) {
@@ -556,7 +585,7 @@ return ff_core_List.List_get(self_, (self_.length - 1))
556
585
  }
557
586
 
558
587
  export async function List_grabFirst$(self_, $task) {
559
- return (self_[0] ?? ff_core_List.internalGrab_(self_, 0))
588
+ return (self_[0] ?? ff_core_List.List_grab(self_, 0))
560
589
  }
561
590
 
562
591
  export async function List_grabLast$(self_, $task) {
@@ -564,26 +593,26 @@ return ff_core_List.List_grab(self_, (self_.length - 1))
564
593
  }
565
594
 
566
595
  export async function List_takeFirst$(self_, count_ = 1, $task) {
567
- throw new Error('Function List_takeFirst is missing on this target in async context.');
596
+ return self_.slice(0, count_)
568
597
  }
569
598
 
570
599
  export async function List_takeLast$(self_, count_ = 1, $task) {
571
- throw new Error('Function List_takeLast is missing on this target in async context.');
600
+ return self_.slice((-count_))
572
601
  }
573
602
 
574
603
  export async function List_dropFirst$(self_, count_ = 1, $task) {
575
- throw new Error('Function List_dropFirst is missing on this target in async context.');
604
+ return self_.slice(count_)
576
605
  }
577
606
 
578
607
  export async function List_dropLast$(self_, count_ = 1, $task) {
579
- throw new Error('Function List_dropLast is missing on this target in async context.');
608
+ return self_.slice(0, (self_.length - count_))
580
609
  }
581
610
 
582
611
  export async function List_count$(self_, body_, $task) {
583
612
  let result_ = 0;
584
613
  let i_ = 0;
585
614
  while((i_ < self_.length)) {
586
- if((await body_((self_[i_] ?? ff_core_List.internalGrab_(self_, i_)), $task))) {
615
+ if((await body_((self_[i_] ?? ff_core_List.List_grab(self_, i_)), $task))) {
587
616
  result_ += 1
588
617
  };
589
618
  i_ += 1
@@ -593,7 +622,7 @@ return result_
593
622
 
594
623
  export async function List_countWhile$(self_, body_, $task) {
595
624
  let i_ = 0;
596
- while(((i_ < self_.length) && (await body_((self_[i_] ?? ff_core_List.internalGrab_(self_, i_)), $task)))) {
625
+ while(((i_ < self_.length) && (await body_((self_[i_] ?? ff_core_List.List_grab(self_, i_)), $task)))) {
597
626
  i_ += 1
598
627
  };
599
628
  return i_
@@ -602,8 +631,8 @@ return i_
602
631
  export async function List_takeWhile$(self_, body_, $task) {
603
632
  const result_ = ff_core_Array.new_();
604
633
  let i_ = 0;
605
- while(((i_ < self_.length) && (await body_((self_[i_] ?? ff_core_List.internalGrab_(self_, i_)), $task)))) {
606
- result_.array.push((self_[i_] ?? ff_core_List.internalGrab_(self_, i_)));
634
+ while(((i_ < self_.length) && (await body_((self_[i_] ?? ff_core_List.List_grab(self_, i_)), $task)))) {
635
+ result_.array.push((self_[i_] ?? ff_core_List.List_grab(self_, i_)));
607
636
  i_ += 1
608
637
  };
609
638
  return ff_core_Array.Array_drain(result_)
@@ -612,11 +641,11 @@ return ff_core_Array.Array_drain(result_)
612
641
  export async function List_dropWhile$(self_, body_, $task) {
613
642
  const result_ = ff_core_Array.new_();
614
643
  let i_ = 0;
615
- while(((i_ < self_.length) && (await body_((self_[i_] ?? ff_core_List.internalGrab_(self_, i_)), $task)))) {
644
+ while(((i_ < self_.length) && (await body_((self_[i_] ?? ff_core_List.List_grab(self_, i_)), $task)))) {
616
645
  i_ += 1
617
646
  };
618
647
  while((i_ < self_.length)) {
619
- result_.array.push((self_[i_] ?? ff_core_List.internalGrab_(self_, i_)));
648
+ result_.array.push((self_[i_] ?? ff_core_List.List_grab(self_, i_)));
620
649
  i_ += 1
621
650
  };
622
651
  return ff_core_Array.Array_drain(result_)
@@ -626,12 +655,12 @@ export async function List_partitionWhile$(self_, body_, $task) {
626
655
  const first_ = ff_core_Array.new_();
627
656
  const second_ = ff_core_Array.new_();
628
657
  let i_ = 0;
629
- while(((i_ < self_.length) && (await body_((self_[i_] ?? ff_core_List.internalGrab_(self_, i_)), $task)))) {
630
- first_.array.push((self_[i_] ?? ff_core_List.internalGrab_(self_, i_)));
658
+ while(((i_ < self_.length) && (await body_((self_[i_] ?? ff_core_List.List_grab(self_, i_)), $task)))) {
659
+ first_.array.push((self_[i_] ?? ff_core_List.List_grab(self_, i_)));
631
660
  i_ += 1
632
661
  };
633
662
  while((i_ < self_.length)) {
634
- second_.array.push((self_[i_] ?? ff_core_List.internalGrab_(self_, i_)));
663
+ second_.array.push((self_[i_] ?? ff_core_List.List_grab(self_, i_)));
635
664
  i_ += 1
636
665
  };
637
666
  return ff_core_Pair.Pair(ff_core_Array.Array_drain(first_), ff_core_Array.Array_drain(second_))
@@ -652,7 +681,7 @@ return ff_core_List.List_takeFirst(ff_core_List.List_dropFirst(self_, from_), (u
652
681
 
653
682
  export async function List_foldLeft$(self_, initial_, body_, $task) {
654
683
  let result_ = initial_;
655
- for(let for_i = 0, for_a = self_, for_l = for_a.length; for_i < for_l; for_i++) {
684
+ for(let for_a = self_, for_i = 0, for_l = for_a.length; for_i < for_l; for_i++) {
656
685
  const x_ = for_a[for_i];
657
686
  result_ = (await body_(result_, x_, $task))
658
687
  };
@@ -666,14 +695,12 @@ return value_
666
695
  }
667
696
 
668
697
  export async function List_modify$(self_, index_, body_, $task) {
669
-
670
- if(index_ < 0 || index_ >= self_.length) {
671
- ff_core_Try.internalThrowGrabException_()
672
- }
673
- let result = self_.slice();
674
- result[index_] = await body_(result[index_], $task);
675
- return result;
676
-
698
+ if(((index_ < 0) || (index_ >= self_.length))) {
699
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_core_Core.GrabException(), ff_core_Core.ff_core_Any_HasAnyTag$ff_core_Core_GrabException)})
700
+ };
701
+ const result_ = self_.slice();
702
+ result_[index_] = (await body_(result_[index_], $task));
703
+ return result_
677
704
  }
678
705
 
679
706
  export async function List_zip$(self_, that_, $task) {
@@ -681,13 +708,13 @@ if((self_.length <= that_.length)) {
681
708
  let i_ = (-1);
682
709
  return ff_core_List.List_map(self_, ((x_) => {
683
710
  i_ += 1;
684
- return ff_core_Pair.Pair(x_, (that_[i_] ?? ff_core_List.internalGrab_(that_, i_)))
711
+ return ff_core_Pair.Pair(x_, (that_[i_] ?? ff_core_List.List_grab(that_, i_)))
685
712
  }))
686
713
  } else {
687
714
  let i_ = (-1);
688
715
  return ff_core_List.List_map(that_, ((y_) => {
689
716
  i_ += 1;
690
- return ff_core_Pair.Pair((self_[i_] ?? ff_core_List.internalGrab_(self_, i_)), y_)
717
+ return ff_core_Pair.Pair((self_[i_] ?? ff_core_List.List_grab(self_, i_)), y_)
691
718
  }))
692
719
  }
693
720
  }
@@ -696,7 +723,7 @@ export async function List_chunk$(self_, chunkSize_, $task) {
696
723
  const results_ = ff_core_Array.new_();
697
724
  const result_ = ff_core_Array.new_();
698
725
  let added_ = 0;
699
- for(let for_i = 0, for_a = self_, for_l = for_a.length; for_i < for_l; for_i++) {
726
+ for(let for_a = self_, for_i = 0, for_l = for_a.length; for_i < for_l; for_i++) {
700
727
  const item_ = for_a[for_i];
701
728
  if((added_ < chunkSize_)) {
702
729
  added_ += 1
@@ -717,13 +744,13 @@ let index_ = 0;
717
744
  return (await ff_core_Stream.new_$((async ($task) => {
718
745
  if((index_ < self_.length)) {
719
746
  return ff_core_Option.Some((await (async function() {
720
- const result_ = (self_[index_] ?? ff_core_List.internalGrab_(self_, index_));
747
+ const result_ = (self_[index_] ?? ff_core_List.List_grab(self_, index_));
721
748
  index_ += 1;
722
749
  return result_
723
750
  })()))
724
751
  } else if((cycle_ && (index_ !== 0))) {
725
752
  return ff_core_Option.Some((await (async function() {
726
- const result_ = (self_[0] ?? ff_core_List.internalGrab_(self_, 0));
753
+ const result_ = (self_[0] ?? ff_core_List.List_grab(self_, 0));
727
754
  index_ = 1;
728
755
  return result_
729
756
  })()))
@@ -734,26 +761,42 @@ return result_
734
761
  }
735
762
 
736
763
  export async function List_toArray$(self_, $task) {
737
- throw new Error('Function List_toArray is missing on this target in async context.');
764
+ return {array: self_.slice()}
765
+ }
766
+
767
+ export async function List_toQueue$(self_, $task) {
768
+ const queue_ = ff_core_Queue.new_();
769
+ for(let for_a = self_, for_i = 0, for_l = for_a.length; for_i < for_l; for_i++) {
770
+ const v_ = for_a[for_i];
771
+ ff_core_Queue.Queue_push(queue_, v_)
772
+ };
773
+ return queue_
738
774
  }
739
775
 
740
776
  export async function List_each$(self_, body_, $task) {
741
-
742
- for(let i = 0; i < self_.length; i++) {
743
- await body_(self_[i], $task)
744
- }
745
-
777
+ let i_ = 0;
778
+ while((i_ < self_.length)) {
779
+ (await body_(self_[i_], $task));
780
+ i_ += 1
781
+ }
746
782
  }
747
783
 
748
784
  export async function List_eachWhile$(self_, body_, $task) {
749
- for(const value of self_) if(!await body_(value, $task)) break
785
+ let i_ = 0;
786
+ while((i_ < self_.length)) {
787
+ if((await body_(self_[i_], $task))) {
788
+ i_ += 1
789
+ } else {
790
+ i_ = self_.length
791
+ }
792
+ }
750
793
  }
751
794
 
752
795
  export async function List_all$(self_, body_, $task) {
753
796
  let result_ = true;
754
- for(let for_i = 0, for_a = self_, for_l = for_a.length; for_i < for_l; for_i++) {
797
+ for(let for_a = self_, for_i = 0, for_l = for_a.length; for_i < for_l; for_i++) {
755
798
  const x_ = for_a[for_i];
756
- result_ = (result_ && (await body_(x_, $task)));
799
+ result_ = (await body_(x_, $task));
757
800
  if(!result_) break
758
801
  };
759
802
  return result_
@@ -761,40 +804,45 @@ return result_
761
804
 
762
805
  export async function List_any$(self_, body_, $task) {
763
806
  let result_ = false;
764
- for(let for_i = 0, for_a = self_, for_l = for_a.length; for_i < for_l; for_i++) {
807
+ for(let for_a = self_, for_i = 0, for_l = for_a.length; for_i < for_l; for_i++) {
765
808
  const x_ = for_a[for_i];
766
- result_ = (result_ || (await body_(x_, $task)));
809
+ result_ = (await body_(x_, $task));
767
810
  if(!(!result_)) break
768
811
  };
769
812
  return result_
770
813
  }
771
814
 
772
- export async function List_indexWhere$(self_, body_, $task) {
815
+ export async function List_find$(self_, body_, $task) {
773
816
  let result_ = ff_core_Option.None();
774
- let i_ = 0;
775
- for(let for_i = 0, for_a = self_, for_l = for_a.length; for_i < for_l; for_i++) {
817
+ for(let for_a = self_, for_i = 0, for_l = for_a.length; for_i < for_l; for_i++) {
776
818
  const x_ = for_a[for_i];
777
- if(!((await body_(x_, $task))
778
- ? (result_ = ff_core_Option.Some(i_), false)
779
- : (i_ += 1, true))) break
819
+ if((await body_(x_, $task))) {
820
+ result_ = ff_core_Option.Some(x_);
821
+ if(!false) break
822
+ } else {
823
+ if(!true) break
824
+ }
780
825
  };
781
826
  return result_
782
827
  }
783
828
 
784
- export async function List_find$(self_, body_, $task) {
785
- let result_ = ff_core_Option.None();
786
- for(let for_i = 0, for_a = self_, for_l = for_a.length; for_i < for_l; for_i++) {
829
+ export async function List_indexWhere$(self_, body_, $task) {
830
+ let i_ = (-1);
831
+ let result_ = false;
832
+ for(let for_a = self_, for_i = 0, for_l = for_a.length; for_i < for_l; for_i++) {
787
833
  const x_ = for_a[for_i];
788
- if(!((await body_(x_, $task))
789
- ? (result_ = ff_core_Option.Some(x_), false)
790
- : true)) break
834
+ i_ += 1;
835
+ result_ = (await body_(x_, $task));
836
+ if(!(!result_)) break
791
837
  };
792
- return result_
838
+ if(result_) {
839
+ return ff_core_Option.Some(i_)
840
+ } else return ff_core_Option.None()
793
841
  }
794
842
 
795
843
  export async function List_filter$(self_, body_, $task) {
796
844
  const result_ = ff_core_Array.new_();
797
- for(let for_i = 0, for_a = self_, for_l = for_a.length; for_i < for_l; for_i++) {
845
+ for(let for_a = self_, for_i = 0, for_l = for_a.length; for_i < for_l; for_i++) {
798
846
  const x_ = for_a[for_i];
799
847
  if((await body_(x_, $task))) {
800
848
  result_.array.push(x_)
@@ -810,18 +858,17 @@ return (!(await body_(_w1, $task)))
810
858
  }
811
859
 
812
860
  export async function List_map$(self_, body_, $task) {
813
-
814
- let result = [];
815
- for(let i = 0; i < self_.length; i++) {
816
- result.push(await body_(self_[i], $task));
817
- }
818
- return result;
819
-
861
+ const array_ = ff_core_Array.new_();
862
+ for(let for_a = self_, for_i = 0, for_l = for_a.length; for_i < for_l; for_i++) {
863
+ const e_ = for_a[for_i];
864
+ array_.array.push((await body_(e_, $task)))
865
+ };
866
+ return ff_core_Array.Array_drain(array_)
820
867
  }
821
868
 
822
869
  export async function List_flatMap$(self_, body_, $task) {
823
870
  const results_ = ff_core_Array.new_();
824
- for(let for_i = 0, for_a = self_, for_l = for_a.length; for_i < for_l; for_i++) {
871
+ for(let for_a = self_, for_i = 0, for_l = for_a.length; for_i < for_l; for_i++) {
825
872
  const x_ = for_a[for_i];
826
873
  ff_core_Array.Array_pushList(results_, (await body_(x_, $task)))
827
874
  };
@@ -830,12 +877,14 @@ return ff_core_Array.Array_drain(results_)
830
877
 
831
878
  export async function List_collect$(self_, body_, $task) {
832
879
  let result_ = ff_core_Array.new_();
833
- for(let for_i = 0, for_a = self_, for_l = for_a.length; for_i < for_l; for_i++) {
880
+ for(let for_a = self_, for_i = 0, for_l = for_a.length; for_i < for_l; for_i++) {
834
881
  const x_ = for_a[for_i];
835
- for(const for_o = (await body_(x_, $task)); for_o.Some;) {
836
- const _w1 = for_o.value_;
882
+ {
883
+ const if_o = (await body_(x_, $task))
884
+ if(if_o.Some) {
885
+ const _w1 = if_o.value_;
837
886
  result_.array.push(_w1)
838
- break
887
+ }
839
888
  }
840
889
  };
841
890
  return ff_core_Array.Array_drain(result_)
@@ -843,18 +892,20 @@ return ff_core_Array.Array_drain(result_)
843
892
 
844
893
  export async function List_collectFirst$(self_, body_, $task) {
845
894
  let result_ = ff_core_Option.None();
846
- for(let for_i = 0, for_a = self_, for_l = for_a.length; for_i < for_l; for_i++) {
895
+ for(let for_a = self_, for_i = 0, for_l = for_a.length; for_i < for_l; for_i++) {
847
896
  const x_ = for_a[for_i];
848
- if(!(((_1) => {
897
+ {
898
+ const _1 = (await body_(x_, $task));
849
899
  if(_1.None) {
850
- return true
900
+ if(!true) break
901
+ continue
851
902
  }
852
903
  {
853
904
  const o_ = _1;
854
905
  result_ = o_;
855
- return false
906
+ if(!false) break
907
+ }
856
908
  }
857
- }))((await body_(x_, $task)))) break
858
909
  };
859
910
  return result_
860
911
  }
@@ -879,17 +930,14 @@ return ff_core_List.List_grab(self_, (self_.length - i_))
879
930
 
880
931
  export async function List_separate$(self_, separator_, $task) {
881
932
  const array_ = ff_core_Array.new_();
882
- ff_core_List.List_each(ff_core_List.List_pairs(self_), ((_1) => {
883
- {
884
- const i_ = _1.first_;
885
- const x_ = _1.second_;
933
+ for(let for_a = self_, for_i = 0, for_l = for_a.length; for_i < for_l; for_i++) {
934
+ const i_ = for_i;
935
+ const x_ = for_a[for_i];
886
936
  if((i_ !== 0)) {
887
937
  ff_core_Array.Array_pushList(array_, separator_)
888
938
  };
889
939
  array_.array.push(x_)
890
- return
891
- }
892
- }));
940
+ };
893
941
  return ff_core_Array.Array_drain(array_)
894
942
  }
895
943
 
@@ -951,7 +999,7 @@ return false
951
999
 
952
1000
  export function List_flatten(self_) {
953
1001
  const result_ = ff_core_Array.new_();
954
- for(let for_i = 0, for_a = self_, for_l = for_a.length; for_i < for_l; for_i++) {
1002
+ for(let for_a = self_, for_i = 0, for_l = for_a.length; for_i < for_l; for_i++) {
955
1003
  const xs_ = for_a[for_i];
956
1004
  ff_core_Array.Array_pushList(result_, xs_)
957
1005
  };
@@ -960,7 +1008,7 @@ return ff_core_Array.Array_drain(result_)
960
1008
 
961
1009
  export async function List_flatten$(self_, $task) {
962
1010
  const result_ = ff_core_Array.new_();
963
- for(let for_i = 0, for_a = self_, for_l = for_a.length; for_i < for_l; for_i++) {
1011
+ for(let for_a = self_, for_i = 0, for_l = for_a.length; for_i < for_l; for_i++) {
964
1012
  const xs_ = for_a[for_i];
965
1013
  ff_core_Array.Array_pushList(result_, xs_)
966
1014
  };
@@ -1054,14 +1102,14 @@ return self_.join(separator_)
1054
1102
  }
1055
1103
 
1056
1104
  export async function List_join$(self_, separator_ = "", $task) {
1057
- throw new Error('Function List_join is missing on this target in async context.');
1105
+ return self_.join(separator_)
1058
1106
  }
1059
1107
 
1060
1108
  export function ff_core_Show_Show$ff_core_List_List(ff_core_Show_Show$T) { return {
1061
1109
  show_(value_) {
1062
1110
  const array_ = ff_core_Array.new_();
1063
1111
  array_.array.push("[");
1064
- for(let for_i = 0, for_a = value_, for_l = for_a.length; for_i < for_l; for_i++) {
1112
+ for(let for_a = value_, for_i = 0, for_l = for_a.length; for_i < for_l; for_i++) {
1065
1113
  const x_ = for_a[for_i];
1066
1114
  if((array_.array.length > 1)) {
1067
1115
  array_.array.push(", ")
@@ -1074,7 +1122,7 @@ return ff_core_Array.Array_join(array_, "")
1074
1122
  async show_$(value_, $task) {
1075
1123
  const array_ = ff_core_Array.new_();
1076
1124
  array_.array.push("[");
1077
- for(let for_i = 0, for_a = value_, for_l = for_a.length; for_i < for_l; for_i++) {
1125
+ for(let for_a = value_, for_i = 0, for_l = for_a.length; for_i < for_l; for_i++) {
1078
1126
  const x_ = for_a[for_i];
1079
1127
  if((array_.array.length > 1)) {
1080
1128
  array_.array.push(", ")
@@ -1088,7 +1136,7 @@ return ff_core_Array.Array_join(array_, "")
1088
1136
 
1089
1137
  export function ff_core_Equal_Equal$ff_core_List_List(ff_core_Equal_Equal$T) { return {
1090
1138
  equals_(x_, y_) {
1091
- if(ff_core_List.internalSame_(x_, y_)) {
1139
+ if((x_ === y_)) {
1092
1140
  return true
1093
1141
  } else {
1094
1142
  if((x_.length !== y_.length)) {
@@ -1097,13 +1145,13 @@ return false
1097
1145
  let i_ = (-1);
1098
1146
  return ff_core_List.List_all(x_, ((l_) => {
1099
1147
  i_ += 1;
1100
- return ff_core_Equal_Equal$T.equals_(l_, (y_[i_] ?? ff_core_List.internalGrab_(y_, i_)))
1148
+ return ff_core_Equal_Equal$T.equals_(l_, (y_[i_] ?? ff_core_List.List_grab(y_, i_)))
1101
1149
  }))
1102
1150
  }
1103
1151
  }
1104
1152
  },
1105
1153
  async equals_$(x_, y_, $task) {
1106
- if(ff_core_List.internalSame_(x_, y_)) {
1154
+ if((x_ === y_)) {
1107
1155
  return true
1108
1156
  } else {
1109
1157
  if((x_.length !== y_.length)) {
@@ -1112,7 +1160,7 @@ return false
1112
1160
  let i_ = (-1);
1113
1161
  return ff_core_List.List_all(x_, ((l_) => {
1114
1162
  i_ += 1;
1115
- return ff_core_Equal_Equal$T.equals_(l_, (y_[i_] ?? ff_core_List.internalGrab_(y_, i_)))
1163
+ return ff_core_Equal_Equal$T.equals_(l_, (y_[i_] ?? ff_core_List.List_grab(y_, i_)))
1116
1164
  }))
1117
1165
  }
1118
1166
  }
@@ -1121,14 +1169,14 @@ return ff_core_Equal_Equal$T.equals_(l_, (y_[i_] ?? ff_core_List.internalGrab_(y
1121
1169
 
1122
1170
  export function ff_core_Ordering_Order$ff_core_List_List(ff_core_Ordering_Order$T) { return {
1123
1171
  compare_(x_, y_) {
1124
- if(ff_core_List.internalSame_(x_, y_)) {
1172
+ if((x_ === y_)) {
1125
1173
  return ff_core_Ordering.OrderingSame()
1126
1174
  } else {
1127
1175
  const size_ = ff_core_Int.Int_min(x_.length, y_.length);
1128
1176
  let i_ = 0;
1129
1177
  let ordering_ = ff_core_Ordering.OrderingSame();
1130
1178
  while(((ordering_ === ff_core_Ordering.OrderingSame()) && (i_ < size_))) {
1131
- ordering_ = ff_core_Ordering_Order$T.compare_((x_[i_] ?? ff_core_List.internalGrab_(x_, i_)), (y_[i_] ?? ff_core_List.internalGrab_(y_, i_)));
1179
+ ordering_ = ff_core_Ordering_Order$T.compare_((x_[i_] ?? ff_core_List.List_grab(x_, i_)), (y_[i_] ?? ff_core_List.List_grab(y_, i_)));
1132
1180
  i_ += 1
1133
1181
  };
1134
1182
  if((ordering_ !== ff_core_Ordering.OrderingSame())) {
@@ -1139,14 +1187,14 @@ return ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int.compare_(x_.lengt
1139
1187
  }
1140
1188
  },
1141
1189
  async compare_$(x_, y_, $task) {
1142
- if(ff_core_List.internalSame_(x_, y_)) {
1190
+ if((x_ === y_)) {
1143
1191
  return ff_core_Ordering.OrderingSame()
1144
1192
  } else {
1145
1193
  const size_ = ff_core_Int.Int_min(x_.length, y_.length);
1146
1194
  let i_ = 0;
1147
1195
  let ordering_ = ff_core_Ordering.OrderingSame();
1148
1196
  while(((ordering_ === ff_core_Ordering.OrderingSame()) && (i_ < size_))) {
1149
- ordering_ = ff_core_Ordering_Order$T.compare_((x_[i_] ?? ff_core_List.internalGrab_(x_, i_)), (y_[i_] ?? ff_core_List.internalGrab_(y_, i_)));
1197
+ ordering_ = ff_core_Ordering_Order$T.compare_((x_[i_] ?? ff_core_List.List_grab(x_, i_)), (y_[i_] ?? ff_core_List.List_grab(y_, i_)));
1150
1198
  i_ += 1
1151
1199
  };
1152
1200
  if((ordering_ !== ff_core_Ordering.OrderingSame())) {