firefly-compiler 0.4.4

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 (221) hide show
  1. package/.firefly-workspace +1 -0
  2. package/.vscode/settings.json +5 -0
  3. package/LICENSE.txt +21 -0
  4. package/README.md +96 -0
  5. package/bin/firefly.mjs +2 -0
  6. package/compiler/.firefly/package.ff +1 -0
  7. package/compiler/Builder.ff +218 -0
  8. package/compiler/Compiler.ff +241 -0
  9. package/compiler/Dependencies.ff +179 -0
  10. package/compiler/Deriver.ff +647 -0
  11. package/compiler/Dictionaries.ff +205 -0
  12. package/compiler/Environment.ff +166 -0
  13. package/compiler/Inference.ff +1117 -0
  14. package/compiler/JsEmitter.ff +861 -0
  15. package/compiler/JsImporter.ff +56 -0
  16. package/compiler/LspHook.ff +188 -0
  17. package/compiler/Main.ff +237 -0
  18. package/compiler/Parser.ff +1383 -0
  19. package/compiler/Patterns.ff +111 -0
  20. package/compiler/Resolver.ff +620 -0
  21. package/compiler/Substitution.ff +178 -0
  22. package/compiler/Syntax.ff +299 -0
  23. package/compiler/Token.ff +180 -0
  24. package/compiler/Tokenizer.ff +278 -0
  25. package/compiler/Unification.ff +220 -0
  26. package/compiler/Wildcards.ff +50 -0
  27. package/compiler/Workspace.ff +88 -0
  28. package/core/.firefly/package.ff +2 -0
  29. package/core/Any.ff +30 -0
  30. package/core/Array.ff +249 -0
  31. package/core/AssetSystem.ff +61 -0
  32. package/core/Atomic.ff +64 -0
  33. package/core/Bool.ff +13 -0
  34. package/core/BrowserSystem.ff +14 -0
  35. package/core/Buffer.ff +211 -0
  36. package/core/BuildSystem.ff +144 -0
  37. package/core/Channel.ff +131 -0
  38. package/core/Char.ff +18 -0
  39. package/core/Core.ff +58 -0
  40. package/core/Duration.ff +15 -0
  41. package/core/Equal.ff +52 -0
  42. package/core/Error.ff +20 -0
  43. package/core/FileHandle.ff +41 -0
  44. package/core/Float.ff +41 -0
  45. package/core/HttpClient.ff +84 -0
  46. package/core/Instant.ff +9 -0
  47. package/core/Int.ff +61 -0
  48. package/core/IntMap.ff +85 -0
  49. package/core/JsSystem.ff +66 -0
  50. package/core/JsValue.ff +240 -0
  51. package/core/List.ff +440 -0
  52. package/core/Lock.ff +144 -0
  53. package/core/Log.ff +24 -0
  54. package/core/Map.ff +126 -0
  55. package/core/NodeSystem.ff +88 -0
  56. package/core/Nothing.ff +1 -0
  57. package/core/Option.ff +133 -0
  58. package/core/Ordering.ff +157 -0
  59. package/core/Pair.ff +55 -0
  60. package/core/Path.ff +393 -0
  61. package/core/RbMap.ff +216 -0
  62. package/core/Serializable.ff +173 -0
  63. package/core/Set.ff +38 -0
  64. package/core/Show.ff +43 -0
  65. package/core/Stack.ff +263 -0
  66. package/core/Stream.ff +406 -0
  67. package/core/String.ff +175 -0
  68. package/core/StringMap.ff +85 -0
  69. package/core/Task.ff +138 -0
  70. package/core/Try.ff +81 -0
  71. package/core/Unit.ff +3 -0
  72. package/experimental/random/AltGeneric.ff +44 -0
  73. package/experimental/random/Async.ff +68 -0
  74. package/experimental/random/Buffer2.ff +77 -0
  75. package/experimental/random/Cat.ff +12 -0
  76. package/experimental/random/Dictionary.ff +52 -0
  77. package/experimental/random/Example.ff +46 -0
  78. package/experimental/random/Generic.ff +102 -0
  79. package/experimental/random/HappyEyeballs.ff +40 -0
  80. package/experimental/random/HashMap.ff +72 -0
  81. package/experimental/random/IfElseUnit.ff +9 -0
  82. package/experimental/random/InputOutput.ff +23 -0
  83. package/experimental/random/ListVsArray.ff +45 -0
  84. package/experimental/random/Main.ff +44 -0
  85. package/experimental/random/MapTest.ff +67 -0
  86. package/experimental/random/OldTaskSystem.ff +210 -0
  87. package/experimental/random/PatternTest.ff +39 -0
  88. package/experimental/random/Patterns.ff +226 -0
  89. package/experimental/random/ReadBytesTest.ff +10 -0
  90. package/experimental/random/RunLength.ff +65 -0
  91. package/experimental/random/Scrape.ff +51 -0
  92. package/experimental/random/Serialization.ff +217 -0
  93. package/experimental/random/SerializationTest.ff +46 -0
  94. package/experimental/random/Serializer.ff +36 -0
  95. package/experimental/random/StdInOutErr.ff +4 -0
  96. package/experimental/random/Symbols.ff +74 -0
  97. package/experimental/random/Tag.ff +49 -0
  98. package/experimental/random/Tensor.ff +52 -0
  99. package/experimental/random/Try.ff +56 -0
  100. package/experimental/random/Tsv.ff +9 -0
  101. package/experimental/random/TypesAreModules.ff +87 -0
  102. package/experimental/random/blueprints/Blueprint.ff +52 -0
  103. package/experimental/random/blueprints/Main.ff +11 -0
  104. package/experimental/random/blueprints/Pretty.ff +58 -0
  105. package/experimental/random/blueprints/User.ff +64 -0
  106. package/experimental/random/blueprintsystem/BlueprintSystem.ff +48 -0
  107. package/experimental/random/blueprintsystem/Deserialize.ff +53 -0
  108. package/experimental/random/blueprintsystem/ReadJs.ff +13 -0
  109. package/experimental/random/blueprintsystem/User.ff +2 -0
  110. package/experimental/random/kahrs/Kahrs.ff +112 -0
  111. package/experimental/random/kahrs/TestKahrs.ff +22 -0
  112. package/experimental/random/kahrs/TestMap.ff +18 -0
  113. package/experimental/random/streaming/Gzip.ff +3 -0
  114. package/experimental/random/streaming/Main.ff +34 -0
  115. package/experimental/random/streaming/S3Bucket.ff +11 -0
  116. package/experimental/random/streaming/Tar.ff +5 -0
  117. package/experimental/rhymeapp/Main.ff +81 -0
  118. package/experimental/rhymeapp/index.html +14 -0
  119. package/firefly.sh +5 -0
  120. package/fireflysite/Main.ff +13 -0
  121. package/httpserver/.firefly/package.ff +1 -0
  122. package/httpserver/HttpServer.ff +184 -0
  123. package/lsp/.firefly/package.ff +1 -0
  124. package/lsp/CompletionHandler.ff +814 -0
  125. package/lsp/Handler.ff +551 -0
  126. package/lsp/HoverHandler.ff +82 -0
  127. package/lsp/LanguageServer.ff +229 -0
  128. package/lsp/SignatureHelpHandler.ff +55 -0
  129. package/lsp/SymbolHandler.ff +167 -0
  130. package/output/js/ff/compiler/Builder.mjs +483 -0
  131. package/output/js/ff/compiler/Compiler.mjs +410 -0
  132. package/output/js/ff/compiler/Dependencies.mjs +388 -0
  133. package/output/js/ff/compiler/Deriver.mjs +1166 -0
  134. package/output/js/ff/compiler/Dictionaries.mjs +1305 -0
  135. package/output/js/ff/compiler/Environment.mjs +1005 -0
  136. package/output/js/ff/compiler/Inference.mjs +4264 -0
  137. package/output/js/ff/compiler/JsEmitter.mjs +5353 -0
  138. package/output/js/ff/compiler/JsImporter.mjs +262 -0
  139. package/output/js/ff/compiler/LspHook.mjs +789 -0
  140. package/output/js/ff/compiler/Main.mjs +1695 -0
  141. package/output/js/ff/compiler/Parser.mjs +4004 -0
  142. package/output/js/ff/compiler/Patterns.mjs +923 -0
  143. package/output/js/ff/compiler/Resolver.mjs +2303 -0
  144. package/output/js/ff/compiler/Substitution.mjs +1146 -0
  145. package/output/js/ff/compiler/Syntax.mjs +12430 -0
  146. package/output/js/ff/compiler/Token.mjs +3092 -0
  147. package/output/js/ff/compiler/Tokenizer.mjs +589 -0
  148. package/output/js/ff/compiler/Unification.mjs +1748 -0
  149. package/output/js/ff/compiler/Wildcards.mjs +604 -0
  150. package/output/js/ff/compiler/Workspace.mjs +683 -0
  151. package/output/js/ff/core/Any.mjs +139 -0
  152. package/output/js/ff/core/Array.mjs +594 -0
  153. package/output/js/ff/core/AssetSystem.mjs +270 -0
  154. package/output/js/ff/core/Atomic.mjs +186 -0
  155. package/output/js/ff/core/Bool.mjs +141 -0
  156. package/output/js/ff/core/BrowserSystem.mjs +122 -0
  157. package/output/js/ff/core/Buffer.mjs +467 -0
  158. package/output/js/ff/core/BuildSystem.mjs +320 -0
  159. package/output/js/ff/core/Channel.mjs +268 -0
  160. package/output/js/ff/core/Char.mjs +145 -0
  161. package/output/js/ff/core/Core.mjs +300 -0
  162. package/output/js/ff/core/Duration.mjs +112 -0
  163. package/output/js/ff/core/Equal.mjs +175 -0
  164. package/output/js/ff/core/Error.mjs +138 -0
  165. package/output/js/ff/core/FileHandle.mjs +164 -0
  166. package/output/js/ff/core/Float.mjs +214 -0
  167. package/output/js/ff/core/HttpClient.mjs +210 -0
  168. package/output/js/ff/core/Instant.mjs +105 -0
  169. package/output/js/ff/core/Int.mjs +254 -0
  170. package/output/js/ff/core/IntMap.mjs +282 -0
  171. package/output/js/ff/core/JsSystem.mjs +234 -0
  172. package/output/js/ff/core/JsValue.mjs +678 -0
  173. package/output/js/ff/core/List.mjs +2335 -0
  174. package/output/js/ff/core/Lock.mjs +322 -0
  175. package/output/js/ff/core/Log.mjs +159 -0
  176. package/output/js/ff/core/Map.mjs +358 -0
  177. package/output/js/ff/core/NodeSystem.mjs +288 -0
  178. package/output/js/ff/core/Nothing.mjs +100 -0
  179. package/output/js/ff/core/Option.mjs +1002 -0
  180. package/output/js/ff/core/Ordering.mjs +734 -0
  181. package/output/js/ff/core/Pair.mjs +318 -0
  182. package/output/js/ff/core/Path.mjs +768 -0
  183. package/output/js/ff/core/RbMap.mjs +1936 -0
  184. package/output/js/ff/core/Serializable.mjs +434 -0
  185. package/output/js/ff/core/Set.mjs +250 -0
  186. package/output/js/ff/core/Show.mjs +201 -0
  187. package/output/js/ff/core/Stack.mjs +595 -0
  188. package/output/js/ff/core/Stream.mjs +1300 -0
  189. package/output/js/ff/core/String.mjs +433 -0
  190. package/output/js/ff/core/StringMap.mjs +282 -0
  191. package/output/js/ff/core/Task.mjs +345 -0
  192. package/output/js/ff/core/Try.mjs +503 -0
  193. package/output/js/ff/core/Unit.mjs +103 -0
  194. package/package.json +29 -0
  195. package/postgresql/.firefly/include/package-lock.json +250 -0
  196. package/postgresql/.firefly/include/package.json +5 -0
  197. package/postgresql/.firefly/include/prepare.sh +2 -0
  198. package/postgresql/.firefly/package.ff +3 -0
  199. package/postgresql/Pg.ff +530 -0
  200. package/unsafejs/.firefly/package.ff +1 -0
  201. package/unsafejs/UnsafeJs.ff +19 -0
  202. package/vscode/.vscode/launch.json +18 -0
  203. package/vscode/.vscode/tasks.json +33 -0
  204. package/vscode/LICENSE.txt +21 -0
  205. package/vscode/Prepublish.ff +15 -0
  206. package/vscode/README.md +17 -0
  207. package/vscode/client/package-lock.json +544 -0
  208. package/vscode/client/package.json +22 -0
  209. package/vscode/client/src/extension.ts +64 -0
  210. package/vscode/client/tsconfig.json +12 -0
  211. package/vscode/icons/firefly-icon.png +0 -0
  212. package/vscode/icons/firefly-icon.svg +10 -0
  213. package/vscode/icons/firefly-logo-notext.png +0 -0
  214. package/vscode/icons/firefly-logo.png +0 -0
  215. package/vscode/language-configuration.json +39 -0
  216. package/vscode/package-lock.json +3623 -0
  217. package/vscode/package.json +144 -0
  218. package/vscode/snippets-none.json +1 -0
  219. package/vscode/snippets.json +241 -0
  220. package/vscode/syntaxes/firefly.tmLanguage.json +294 -0
  221. package/vscode/tsconfig.json +20 -0
@@ -0,0 +1,1002 @@
1
+
2
+
3
+ import * as ff_core_Any from "../../ff/core/Any.mjs"
4
+
5
+ import * as ff_core_Array from "../../ff/core/Array.mjs"
6
+
7
+ import * as ff_core_AssetSystem from "../../ff/core/AssetSystem.mjs"
8
+
9
+ import * as ff_core_Atomic from "../../ff/core/Atomic.mjs"
10
+
11
+ import * as ff_core_Bool from "../../ff/core/Bool.mjs"
12
+
13
+ import * as ff_core_BrowserSystem from "../../ff/core/BrowserSystem.mjs"
14
+
15
+ import * as ff_core_Buffer from "../../ff/core/Buffer.mjs"
16
+
17
+ import * as ff_core_BuildSystem from "../../ff/core/BuildSystem.mjs"
18
+
19
+ import * as ff_core_Channel from "../../ff/core/Channel.mjs"
20
+
21
+ import * as ff_core_Char from "../../ff/core/Char.mjs"
22
+
23
+ import * as ff_core_Core from "../../ff/core/Core.mjs"
24
+
25
+ import * as ff_core_Duration from "../../ff/core/Duration.mjs"
26
+
27
+ import * as ff_core_Equal from "../../ff/core/Equal.mjs"
28
+
29
+ import * as ff_core_Error from "../../ff/core/Error.mjs"
30
+
31
+ import * as ff_core_FileHandle from "../../ff/core/FileHandle.mjs"
32
+
33
+ import * as ff_core_Float from "../../ff/core/Float.mjs"
34
+
35
+ import * as ff_core_HttpClient from "../../ff/core/HttpClient.mjs"
36
+
37
+ import * as ff_core_Instant from "../../ff/core/Instant.mjs"
38
+
39
+ import * as ff_core_Int from "../../ff/core/Int.mjs"
40
+
41
+ import * as ff_core_IntMap from "../../ff/core/IntMap.mjs"
42
+
43
+ import * as ff_core_JsSystem from "../../ff/core/JsSystem.mjs"
44
+
45
+ import * as ff_core_JsValue from "../../ff/core/JsValue.mjs"
46
+
47
+ import * as ff_core_List from "../../ff/core/List.mjs"
48
+
49
+ import * as ff_core_Lock from "../../ff/core/Lock.mjs"
50
+
51
+ import * as ff_core_Log from "../../ff/core/Log.mjs"
52
+
53
+ import * as ff_core_Map from "../../ff/core/Map.mjs"
54
+
55
+ import * as ff_core_NodeSystem from "../../ff/core/NodeSystem.mjs"
56
+
57
+ import * as ff_core_Nothing from "../../ff/core/Nothing.mjs"
58
+
59
+ import * as ff_core_Option from "../../ff/core/Option.mjs"
60
+
61
+ import * as ff_core_Ordering from "../../ff/core/Ordering.mjs"
62
+
63
+ import * as ff_core_Pair from "../../ff/core/Pair.mjs"
64
+
65
+ import * as ff_core_Path from "../../ff/core/Path.mjs"
66
+
67
+ import * as ff_core_Serializable from "../../ff/core/Serializable.mjs"
68
+
69
+ import * as ff_core_Set from "../../ff/core/Set.mjs"
70
+
71
+ import * as ff_core_Show from "../../ff/core/Show.mjs"
72
+
73
+ import * as ff_core_Stack from "../../ff/core/Stack.mjs"
74
+
75
+ import * as ff_core_Stream from "../../ff/core/Stream.mjs"
76
+
77
+ import * as ff_core_String from "../../ff/core/String.mjs"
78
+
79
+ import * as ff_core_StringMap from "../../ff/core/StringMap.mjs"
80
+
81
+ import * as ff_core_Task from "../../ff/core/Task.mjs"
82
+
83
+ import * as ff_core_Try from "../../ff/core/Try.mjs"
84
+
85
+ import * as ff_core_Unit from "../../ff/core/Unit.mjs"
86
+
87
+ // type Option
88
+ const None$ = {None: true};
89
+ export function None() {
90
+ return None$;
91
+ }
92
+ export function Some(value_) {
93
+ return {Some: true, value_};
94
+ }
95
+
96
+
97
+
98
+
99
+
100
+
101
+
102
+ export function Option_else(self_, body_) {
103
+ {
104
+ const _1 = self_;
105
+ {
106
+ if(_1.None) {
107
+ return body_()
108
+ return
109
+ }
110
+ }
111
+ {
112
+ if(_1.Some) {
113
+ const value_ = _1.value_;
114
+ return value_
115
+ return
116
+ }
117
+ }
118
+ }
119
+ }
120
+
121
+ export function Option_elseIf(self_, condition_, body_) {
122
+ {
123
+ const _1 = self_;
124
+ {
125
+ if(_1.None) {
126
+ {
127
+ const _1 = condition_();
128
+ {
129
+ if(_1) {
130
+ return ff_core_Option.Some(body_())
131
+ return
132
+ }
133
+ }
134
+ {
135
+ if(!_1) {
136
+ return ff_core_Option.None()
137
+ return
138
+ }
139
+ }
140
+ }
141
+ return
142
+ }
143
+ }
144
+ {
145
+ if(_1.Some) {
146
+ return self_
147
+ return
148
+ }
149
+ }
150
+ }
151
+ }
152
+
153
+ export function Option_orElse(self_, body_) {
154
+ {
155
+ const _1 = self_;
156
+ {
157
+ if(_1.None) {
158
+ return body_()
159
+ return
160
+ }
161
+ }
162
+ {
163
+ if(_1.Some) {
164
+ return self_
165
+ return
166
+ }
167
+ }
168
+ }
169
+ }
170
+
171
+ export function Option_isEmpty(self_) {
172
+ {
173
+ const _1 = self_;
174
+ {
175
+ if(_1.None) {
176
+ return true
177
+ return
178
+ }
179
+ }
180
+ {
181
+ if(_1.Some) {
182
+ return false
183
+ return
184
+ }
185
+ }
186
+ }
187
+ }
188
+
189
+ export function Option_toList(self_) {
190
+ {
191
+ const _1 = self_;
192
+ {
193
+ if(_1.None) {
194
+ return ff_core_List.Empty()
195
+ return
196
+ }
197
+ }
198
+ {
199
+ if(_1.Some) {
200
+ const v_ = _1.value_;
201
+ return ff_core_List.Link(v_, ff_core_List.Empty())
202
+ return
203
+ }
204
+ }
205
+ }
206
+ }
207
+
208
+ export function Option_toStack(self_) {
209
+ return ff_core_List.List_toStack(ff_core_Option.Option_toList(self_))
210
+ }
211
+
212
+ export function Option_toArray(self_) {
213
+ return ff_core_List.List_toArray(ff_core_Option.Option_toList(self_))
214
+ }
215
+
216
+ export function Option_toStream(self_, cycle_ = false) {
217
+ let next_ = self_;
218
+ return ff_core_Stream.make_((() => {
219
+ const result_ = next_;
220
+ if((!cycle_)) {
221
+ next_ = ff_core_Option.None()
222
+ };
223
+ return result_
224
+ }), (() => {
225
+
226
+ }))
227
+ }
228
+
229
+ export function Option_filter(self_, body_) {
230
+ {
231
+ const _1 = self_;
232
+ {
233
+ if(_1.Some) {
234
+ const v_ = _1.value_;
235
+ const _guard1 = body_(v_);
236
+ if(_guard1) {
237
+ return ff_core_Option.Some(v_)
238
+ return
239
+ }
240
+ }
241
+ }
242
+ {
243
+ return ff_core_Option.None()
244
+ return
245
+ }
246
+ }
247
+ }
248
+
249
+ export function Option_map(self_, body_) {
250
+ {
251
+ const _1 = self_;
252
+ {
253
+ if(_1.None) {
254
+ return ff_core_Option.None()
255
+ return
256
+ }
257
+ }
258
+ {
259
+ if(_1.Some) {
260
+ const v_ = _1.value_;
261
+ return ff_core_Option.Some(body_(v_))
262
+ return
263
+ }
264
+ }
265
+ }
266
+ }
267
+
268
+ export function Option_flatMap(self_, body_) {
269
+ {
270
+ const _1 = self_;
271
+ {
272
+ if(_1.None) {
273
+ return ff_core_Option.None()
274
+ return
275
+ }
276
+ }
277
+ {
278
+ if(_1.Some) {
279
+ const v_ = _1.value_;
280
+ return body_(v_)
281
+ return
282
+ }
283
+ }
284
+ }
285
+ }
286
+
287
+ export function Option_each(self_, body_) {
288
+ {
289
+ const _1 = self_;
290
+ {
291
+ if(_1.None) {
292
+
293
+ return
294
+ }
295
+ }
296
+ {
297
+ if(_1.Some) {
298
+ const v_ = _1.value_;
299
+ body_(v_)
300
+ return
301
+ }
302
+ }
303
+ }
304
+ }
305
+
306
+ export function Option_all(self_, body_) {
307
+ {
308
+ const _1 = self_;
309
+ {
310
+ if(_1.None) {
311
+ return true
312
+ return
313
+ }
314
+ }
315
+ {
316
+ if(_1.Some) {
317
+ const v_ = _1.value_;
318
+ return body_(v_)
319
+ return
320
+ }
321
+ }
322
+ }
323
+ }
324
+
325
+ export function Option_any(self_, body_) {
326
+ {
327
+ const _1 = self_;
328
+ {
329
+ if(_1.None) {
330
+ return false
331
+ return
332
+ }
333
+ }
334
+ {
335
+ if(_1.Some) {
336
+ const v_ = _1.value_;
337
+ return body_(v_)
338
+ return
339
+ }
340
+ }
341
+ }
342
+ }
343
+
344
+ export function Option_grab(self_) {
345
+ {
346
+ const _1 = self_;
347
+ {
348
+ if(_1.None) {
349
+ return ff_core_Try.internalThrowGrabException_()
350
+ return
351
+ }
352
+ }
353
+ {
354
+ if(_1.Some) {
355
+ const v_ = _1.value_;
356
+ return v_
357
+ return
358
+ }
359
+ }
360
+ }
361
+ }
362
+
363
+ export async function Option_else$(self_, body_, $task) {
364
+ {
365
+ const _1 = self_;
366
+ {
367
+ if(_1.None) {
368
+ return (await body_($task))
369
+ return
370
+ }
371
+ }
372
+ {
373
+ if(_1.Some) {
374
+ const value_ = _1.value_;
375
+ return value_
376
+ return
377
+ }
378
+ }
379
+ }
380
+ }
381
+
382
+ export async function Option_elseIf$(self_, condition_, body_, $task) {
383
+ {
384
+ const _1 = self_;
385
+ {
386
+ if(_1.None) {
387
+ {
388
+ const _1 = (await condition_($task));
389
+ {
390
+ if(_1) {
391
+ return ff_core_Option.Some((await body_($task)))
392
+ return
393
+ }
394
+ }
395
+ {
396
+ if(!_1) {
397
+ return ff_core_Option.None()
398
+ return
399
+ }
400
+ }
401
+ }
402
+ return
403
+ }
404
+ }
405
+ {
406
+ if(_1.Some) {
407
+ return self_
408
+ return
409
+ }
410
+ }
411
+ }
412
+ }
413
+
414
+ export async function Option_orElse$(self_, body_, $task) {
415
+ {
416
+ const _1 = self_;
417
+ {
418
+ if(_1.None) {
419
+ return (await body_($task))
420
+ return
421
+ }
422
+ }
423
+ {
424
+ if(_1.Some) {
425
+ return self_
426
+ return
427
+ }
428
+ }
429
+ }
430
+ }
431
+
432
+ export async function Option_isEmpty$(self_, $task) {
433
+ {
434
+ const _1 = self_;
435
+ {
436
+ if(_1.None) {
437
+ return true
438
+ return
439
+ }
440
+ }
441
+ {
442
+ if(_1.Some) {
443
+ return false
444
+ return
445
+ }
446
+ }
447
+ }
448
+ }
449
+
450
+ export async function Option_toList$(self_, $task) {
451
+ {
452
+ const _1 = self_;
453
+ {
454
+ if(_1.None) {
455
+ return ff_core_List.Empty()
456
+ return
457
+ }
458
+ }
459
+ {
460
+ if(_1.Some) {
461
+ const v_ = _1.value_;
462
+ return ff_core_List.Link(v_, ff_core_List.Empty())
463
+ return
464
+ }
465
+ }
466
+ }
467
+ }
468
+
469
+ export async function Option_toStack$(self_, $task) {
470
+ return ff_core_List.List_toStack(ff_core_Option.Option_toList(self_))
471
+ }
472
+
473
+ export async function Option_toArray$(self_, $task) {
474
+ return ff_core_List.List_toArray(ff_core_Option.Option_toList(self_))
475
+ }
476
+
477
+ export async function Option_toStream$(self_, cycle_ = false, $task) {
478
+ let next_ = self_;
479
+ return (await ff_core_Stream.make_$((async ($task) => {
480
+ const result_ = next_;
481
+ if((!cycle_)) {
482
+ next_ = ff_core_Option.None()
483
+ };
484
+ return result_
485
+ }), (async ($task) => {
486
+
487
+ }), $task))
488
+ }
489
+
490
+ export async function Option_filter$(self_, body_, $task) {
491
+ {
492
+ const _1 = self_;
493
+ {
494
+ if(_1.Some) {
495
+ const v_ = _1.value_;
496
+ const _guard1 = (await body_(v_, $task));
497
+ if(_guard1) {
498
+ return ff_core_Option.Some(v_)
499
+ return
500
+ }
501
+ }
502
+ }
503
+ {
504
+ return ff_core_Option.None()
505
+ return
506
+ }
507
+ }
508
+ }
509
+
510
+ export async function Option_map$(self_, body_, $task) {
511
+ {
512
+ const _1 = self_;
513
+ {
514
+ if(_1.None) {
515
+ return ff_core_Option.None()
516
+ return
517
+ }
518
+ }
519
+ {
520
+ if(_1.Some) {
521
+ const v_ = _1.value_;
522
+ return ff_core_Option.Some((await body_(v_, $task)))
523
+ return
524
+ }
525
+ }
526
+ }
527
+ }
528
+
529
+ export async function Option_flatMap$(self_, body_, $task) {
530
+ {
531
+ const _1 = self_;
532
+ {
533
+ if(_1.None) {
534
+ return ff_core_Option.None()
535
+ return
536
+ }
537
+ }
538
+ {
539
+ if(_1.Some) {
540
+ const v_ = _1.value_;
541
+ return (await body_(v_, $task))
542
+ return
543
+ }
544
+ }
545
+ }
546
+ }
547
+
548
+ export async function Option_each$(self_, body_, $task) {
549
+ {
550
+ const _1 = self_;
551
+ {
552
+ if(_1.None) {
553
+
554
+ return
555
+ }
556
+ }
557
+ {
558
+ if(_1.Some) {
559
+ const v_ = _1.value_;
560
+ (await body_(v_, $task))
561
+ return
562
+ }
563
+ }
564
+ }
565
+ }
566
+
567
+ export async function Option_all$(self_, body_, $task) {
568
+ {
569
+ const _1 = self_;
570
+ {
571
+ if(_1.None) {
572
+ return true
573
+ return
574
+ }
575
+ }
576
+ {
577
+ if(_1.Some) {
578
+ const v_ = _1.value_;
579
+ return (await body_(v_, $task))
580
+ return
581
+ }
582
+ }
583
+ }
584
+ }
585
+
586
+ export async function Option_any$(self_, body_, $task) {
587
+ {
588
+ const _1 = self_;
589
+ {
590
+ if(_1.None) {
591
+ return false
592
+ return
593
+ }
594
+ }
595
+ {
596
+ if(_1.Some) {
597
+ const v_ = _1.value_;
598
+ return (await body_(v_, $task))
599
+ return
600
+ }
601
+ }
602
+ }
603
+ }
604
+
605
+ export async function Option_grab$(self_, $task) {
606
+ {
607
+ const _1 = self_;
608
+ {
609
+ if(_1.None) {
610
+ return ff_core_Try.internalThrowGrabException_()
611
+ return
612
+ }
613
+ }
614
+ {
615
+ if(_1.Some) {
616
+ const v_ = _1.value_;
617
+ return v_
618
+ return
619
+ }
620
+ }
621
+ }
622
+ }
623
+
624
+ export function Option_contains(self_, value_, ff_core_Equal_Equal$T) {
625
+ {
626
+ const _1 = self_;
627
+ {
628
+ if(_1.None) {
629
+ return false
630
+ return
631
+ }
632
+ }
633
+ {
634
+ if(_1.Some) {
635
+ const v_ = _1.value_;
636
+ return ff_core_Equal_Equal$T.equals_(v_, value_)
637
+ return
638
+ }
639
+ }
640
+ }
641
+ }
642
+
643
+ export async function Option_contains$(self_, value_, ff_core_Equal_Equal$T, $task) {
644
+ {
645
+ const _1 = self_;
646
+ {
647
+ if(_1.None) {
648
+ return false
649
+ return
650
+ }
651
+ }
652
+ {
653
+ if(_1.Some) {
654
+ const v_ = _1.value_;
655
+ return ff_core_Equal_Equal$T.equals_(v_, value_)
656
+ return
657
+ }
658
+ }
659
+ }
660
+ }
661
+
662
+ export function Option_flatten(self_) {
663
+ {
664
+ const _1 = self_;
665
+ {
666
+ if(_1.None) {
667
+ return ff_core_Option.None()
668
+ return
669
+ }
670
+ }
671
+ {
672
+ if(_1.Some) {
673
+ const v_ = _1.value_;
674
+ return v_
675
+ return
676
+ }
677
+ }
678
+ }
679
+ }
680
+
681
+ export async function Option_flatten$(self_, $task) {
682
+ {
683
+ const _1 = self_;
684
+ {
685
+ if(_1.None) {
686
+ return ff_core_Option.None()
687
+ return
688
+ }
689
+ }
690
+ {
691
+ if(_1.Some) {
692
+ const v_ = _1.value_;
693
+ return v_
694
+ return
695
+ }
696
+ }
697
+ }
698
+ }
699
+
700
+ export function ff_core_Show_Show$ff_core_Option_Option(ff_core_Show_Show$T) { return {
701
+ show_(value_) {
702
+ {
703
+ const value_a = value_;
704
+ {
705
+ if(value_a.None) {
706
+ const z_ = value_a;
707
+ return "None"
708
+ return
709
+ }
710
+ }
711
+ {
712
+ if(value_a.Some) {
713
+ const z_ = value_a;
714
+ return ((("Some" + "(") + ff_core_Show_Show$T.show_(z_.value_)) + ")")
715
+ return
716
+ }
717
+ }
718
+ }
719
+ },
720
+ async show_$(value_, $task) {
721
+ {
722
+ const value_a = value_;
723
+ {
724
+ if(value_a.None) {
725
+ const z_ = value_a;
726
+ return "None"
727
+ return
728
+ }
729
+ }
730
+ {
731
+ if(value_a.Some) {
732
+ const z_ = value_a;
733
+ return ((("Some" + "(") + ff_core_Show_Show$T.show_(z_.value_)) + ")")
734
+ return
735
+ }
736
+ }
737
+ }
738
+ }
739
+ }}
740
+
741
+ export function ff_core_Equal_Equal$ff_core_Option_Option(ff_core_Equal_Equal$T) { return {
742
+ equals_(x_, y_) {
743
+ {
744
+ const x_a = x_;
745
+ const y_a = y_;
746
+ {
747
+ const _guard1 = (x_ === y_);
748
+ if(_guard1) {
749
+ return true
750
+ return
751
+ }
752
+ }
753
+ {
754
+ if(x_a.Some) {
755
+ const x_ = x_a;
756
+ if(y_a.Some) {
757
+ const y_ = y_a;
758
+ return ff_core_Equal_Equal$T.equals_(x_.value_, y_.value_)
759
+ return
760
+ }
761
+ }
762
+ }
763
+ {
764
+ return false
765
+ return
766
+ }
767
+ }
768
+ },
769
+ async equals_$(x_, y_, $task) {
770
+ {
771
+ const x_a = x_;
772
+ const y_a = y_;
773
+ {
774
+ const _guard1 = (x_ === y_);
775
+ if(_guard1) {
776
+ return true
777
+ return
778
+ }
779
+ }
780
+ {
781
+ if(x_a.Some) {
782
+ const x_ = x_a;
783
+ if(y_a.Some) {
784
+ const y_ = y_a;
785
+ return ff_core_Equal_Equal$T.equals_(x_.value_, y_.value_)
786
+ return
787
+ }
788
+ }
789
+ }
790
+ {
791
+ return false
792
+ return
793
+ }
794
+ }
795
+ }
796
+ }}
797
+
798
+ export function ff_core_Ordering_Order$ff_core_Option_Option(ff_core_Ordering_Order$T) { return {
799
+ compare_(x_, y_) {
800
+ {
801
+ const x_a = x_;
802
+ const y_a = y_;
803
+ {
804
+ const _guard1 = (x_ === y_);
805
+ if(_guard1) {
806
+ return ff_core_Ordering.OrderingSame()
807
+ return
808
+ }
809
+ }
810
+ {
811
+ if(x_a.Some) {
812
+ const x_ = x_a;
813
+ if(y_a.Some) {
814
+ const y_ = y_a;
815
+ const valueOrdering_ = ff_core_Ordering_Order$T.compare_(x_.value_, y_.value_);
816
+ if((valueOrdering_ !== ff_core_Ordering.OrderingSame())) {
817
+ return valueOrdering_
818
+ } else {
819
+ return ff_core_Ordering.OrderingSame()
820
+ }
821
+ return
822
+ }
823
+ }
824
+ }
825
+ {
826
+ function number_(z_) {
827
+ {
828
+ const z_a = z_;
829
+ {
830
+ if(z_a.None) {
831
+ return 0
832
+ return
833
+ }
834
+ }
835
+ {
836
+ if(z_a.Some) {
837
+ return 1
838
+ return
839
+ }
840
+ }
841
+ }
842
+ }
843
+ return ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int.compare_(number_(x_), number_(y_))
844
+ return
845
+ }
846
+ }
847
+ },
848
+ async compare_$(x_, y_, $task) {
849
+ {
850
+ const x_a = x_;
851
+ const y_a = y_;
852
+ {
853
+ const _guard1 = (x_ === y_);
854
+ if(_guard1) {
855
+ return ff_core_Ordering.OrderingSame()
856
+ return
857
+ }
858
+ }
859
+ {
860
+ if(x_a.Some) {
861
+ const x_ = x_a;
862
+ if(y_a.Some) {
863
+ const y_ = y_a;
864
+ const valueOrdering_ = ff_core_Ordering_Order$T.compare_(x_.value_, y_.value_);
865
+ if((valueOrdering_ !== ff_core_Ordering.OrderingSame())) {
866
+ return valueOrdering_
867
+ } else {
868
+ return ff_core_Ordering.OrderingSame()
869
+ }
870
+ return
871
+ }
872
+ }
873
+ }
874
+ {
875
+ function number_(z_) {
876
+ {
877
+ const z_a = z_;
878
+ {
879
+ if(z_a.None) {
880
+ return 0
881
+ return
882
+ }
883
+ }
884
+ {
885
+ if(z_a.Some) {
886
+ return 1
887
+ return
888
+ }
889
+ }
890
+ }
891
+ }
892
+ return ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int.compare_(number_(x_), number_(y_))
893
+ return
894
+ }
895
+ }
896
+ }
897
+ }}
898
+
899
+ export function ff_core_Serializable_Serializable$ff_core_Option_Option(ff_core_Serializable_Serializable$T) { return {
900
+ serializeUsing_(serialization_, value_) {
901
+ {
902
+ const serialization_a = serialization_;
903
+ const value_a = value_;
904
+ {
905
+ if(value_a.None) {
906
+ const v_ = value_a;
907
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 19), 0);
908
+ ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 0);
909
+ serialization_.offset_ += 1
910
+ return
911
+ }
912
+ }
913
+ {
914
+ if(value_a.Some) {
915
+ const v_ = value_a;
916
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 19), 0);
917
+ ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 1);
918
+ serialization_.offset_ += 1;
919
+ ff_core_Serializable_Serializable$T.serializeUsing_(serialization_, v_.value_)
920
+ return
921
+ }
922
+ }
923
+ }
924
+ },
925
+ deserializeUsing_(serialization_) {
926
+ const variantIndex_ = ff_core_Buffer.Buffer_grabUint8(serialization_.buffer_, serialization_.offset_);
927
+ serialization_.offset_ += 1;
928
+ {
929
+ const _1 = variantIndex_;
930
+ {
931
+ if(_1 == 0) {
932
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 19), 0);
933
+ return ff_core_Option.None()
934
+ return
935
+ }
936
+ }
937
+ {
938
+ if(_1 == 1) {
939
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 19), 0);
940
+ return ff_core_Option.Some(ff_core_Serializable_Serializable$T.deserializeUsing_(serialization_))
941
+ return
942
+ }
943
+ }
944
+ {
945
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_core_Serializable.DeserializationChecksumException(), ff_core_Serializable.ff_core_Any_HasAnyTag$ff_core_Serializable_DeserializationChecksumException)})
946
+ return
947
+ }
948
+ }
949
+ },
950
+ async serializeUsing_$(serialization_, value_, $task) {
951
+ {
952
+ const serialization_a = serialization_;
953
+ const value_a = value_;
954
+ {
955
+ if(value_a.None) {
956
+ const v_ = value_a;
957
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 19), 0);
958
+ ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 0);
959
+ serialization_.offset_ += 1
960
+ return
961
+ }
962
+ }
963
+ {
964
+ if(value_a.Some) {
965
+ const v_ = value_a;
966
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 19), 0);
967
+ ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 1);
968
+ serialization_.offset_ += 1;
969
+ ff_core_Serializable_Serializable$T.serializeUsing_(serialization_, v_.value_)
970
+ return
971
+ }
972
+ }
973
+ }
974
+ },
975
+ async deserializeUsing_$(serialization_, $task) {
976
+ const variantIndex_ = ff_core_Buffer.Buffer_grabUint8(serialization_.buffer_, serialization_.offset_);
977
+ serialization_.offset_ += 1;
978
+ {
979
+ const _1 = variantIndex_;
980
+ {
981
+ if(_1 == 0) {
982
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 19), 0);
983
+ return ff_core_Option.None()
984
+ return
985
+ }
986
+ }
987
+ {
988
+ if(_1 == 1) {
989
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 19), 0);
990
+ return ff_core_Option.Some(ff_core_Serializable_Serializable$T.deserializeUsing_(serialization_))
991
+ return
992
+ }
993
+ }
994
+ {
995
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_core_Serializable.DeserializationChecksumException(), ff_core_Serializable.ff_core_Any_HasAnyTag$ff_core_Serializable_DeserializationChecksumException)})
996
+ return
997
+ }
998
+ }
999
+ }
1000
+ }}
1001
+
1002
+