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,923 @@
1
+
2
+
3
+ import * as ff_compiler_Patterns from "../../ff/compiler/Patterns.mjs"
4
+
5
+ import * as ff_compiler_Syntax from "../../ff/compiler/Syntax.mjs"
6
+
7
+ import * as ff_core_Any from "../../ff/core/Any.mjs"
8
+
9
+ import * as ff_core_Array from "../../ff/core/Array.mjs"
10
+
11
+ import * as ff_core_AssetSystem from "../../ff/core/AssetSystem.mjs"
12
+
13
+ import * as ff_core_Atomic from "../../ff/core/Atomic.mjs"
14
+
15
+ import * as ff_core_Bool from "../../ff/core/Bool.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_Stack from "../../ff/core/Stack.mjs"
78
+
79
+ import * as ff_core_Stream from "../../ff/core/Stream.mjs"
80
+
81
+ import * as ff_core_String from "../../ff/core/String.mjs"
82
+
83
+ import * as ff_core_StringMap from "../../ff/core/StringMap.mjs"
84
+
85
+ import * as ff_core_Task from "../../ff/core/Task.mjs"
86
+
87
+ import * as ff_core_Try from "../../ff/core/Try.mjs"
88
+
89
+ import * as ff_core_Unit from "../../ff/core/Unit.mjs"
90
+
91
+ // type PatternInfo
92
+ export function PatternInfo(variant_, otherVariants_, fields_) {
93
+ return {variant_, otherVariants_, fields_};
94
+ }
95
+
96
+ // type PatternCaseInfo
97
+ export function PatternCaseInfo(fields_, guard_) {
98
+ return {fields_, guard_};
99
+ }
100
+
101
+
102
+
103
+ export function check_(variants_, fields_, cases_, success_, guard_) {
104
+ {
105
+ const _1 = ff_core_Pair.Pair(fields_, cases_);
106
+ {
107
+ if(_1.first_.Link) {
108
+ const f_ = _1.first_.head_.first_;
109
+ const p_ = _1.first_.head_.second_;
110
+ const fs_ = _1.first_.tail_;
111
+ const cs_ = _1.second_;
112
+ const vs_ = ff_core_Option.Option_else(ff_core_Map.Map_get(variants_, f_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), (() => {
113
+ return ff_core_Set.Set_add(p_.otherVariants_, p_.variant_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)
114
+ }));
115
+ if(ff_core_Set.Set_contains(vs_, p_.variant_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)) {
116
+ const newFields_ = ff_core_List.List_map(p_.fields_, ((_w1) => {
117
+ return ff_core_Pair.Pair_mapFirst(_w1, ((_w1) => {
118
+ return ((((f_ + ".") + p_.variant_) + "_") + _w1)
119
+ }))
120
+ }));
121
+ if((ff_core_Set.Set_size(vs_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String) === 1)) {
122
+ ff_compiler_Patterns.check_(ff_core_Map.Map_add(variants_, f_, vs_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_List.List_addAll(newFields_, fs_), cs_, true, guard_)
123
+ } else {
124
+ ff_compiler_Patterns.check_(ff_core_Map.Map_add(variants_, f_, ff_core_List.List_toSet(ff_core_List.Link(p_.variant_, ff_core_List.Empty()), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_List.List_addAll(newFields_, fs_), cs_, true, guard_);
125
+ ff_compiler_Patterns.check_(ff_core_Map.Map_add(variants_, f_, ff_core_Set.Set_remove(vs_, p_.variant_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_List.Empty(), cs_, false, guard_)
126
+ }
127
+ } else {
128
+ ff_compiler_Patterns.check_(variants_, ff_core_List.Empty(), cs_, false, guard_)
129
+ }
130
+ return
131
+ }
132
+ }
133
+ {
134
+ const _guard1 = (success_ && (!guard_));
135
+ if(_guard1) {
136
+
137
+ return
138
+ }
139
+ }
140
+ {
141
+ if(_1.first_.Empty) {
142
+ if(_1.second_.Link) {
143
+ const fs_ = _1.second_.head_.fields_;
144
+ const g_ = _1.second_.head_.guard_;
145
+ const cs_ = _1.second_.tail_;
146
+ ff_compiler_Patterns.check_(variants_, fs_, cs_, true, g_)
147
+ return
148
+ }
149
+ }
150
+ }
151
+ {
152
+ if(_1.first_.Empty) {
153
+ if(_1.second_.Empty) {
154
+ const remaining_ = ff_core_List.List_map(ff_core_List.List_filter(ff_core_Map.Map_pairs(variants_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ((_w1) => {
155
+ return (ff_core_Set.Set_size(_w1.second_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String) !== 0)
156
+ })), ((_1) => {
157
+ {
158
+ const f_ = _1.first_;
159
+ const vs_ = _1.second_;
160
+ return ((f_ + " could be ") + ff_core_Show.ff_core_Show_Show$ff_core_List_List(ff_core_Show.ff_core_Show_Show$ff_core_String_String).show_(ff_core_Set.Set_toList(vs_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)))
161
+ return
162
+ }
163
+ }));
164
+ if((ff_core_List.List_size(remaining_) !== 0)) {
165
+ ff_core_Core.panic_(("Unexhaustive match:\n" + ff_core_List.List_join(remaining_, "\n")))
166
+ }
167
+ return
168
+ }
169
+ }
170
+ }
171
+ }
172
+ }
173
+
174
+ export function convert_(modules_, cases_) {
175
+ function unqualifiedName_(name_) {
176
+ return ff_core_String.String_reverse(ff_core_String.String_takeWhile(ff_core_String.String_reverse(name_), ((_w1) => {
177
+ return (_w1 !== 46)
178
+ })))
179
+ }
180
+ function otherVariants_(name_) {
181
+ const variantName_ = unqualifiedName_(name_);
182
+ const moduleName_ = ff_core_String.String_dropLast(name_, (ff_core_String.String_size(variantName_) + 1));
183
+ const variantModule_ = ff_core_Map.Map_grab(modules_, moduleName_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
184
+ return ff_core_Option.Option_grab(ff_core_List.List_collectFirst(variantModule_.types_, ((definition_) => {
185
+ return ff_core_Option.Option_map(ff_core_List.List_find(definition_.variants_, ((_w1) => {
186
+ return (_w1.name_ === variantName_)
187
+ })), ((variant_) => {
188
+ return ff_core_List.List_toSet(ff_core_List.List_filter(ff_core_List.List_map(definition_.variants_, ((_w1) => {
189
+ return _w1.name_
190
+ })), ((_w1) => {
191
+ return (_w1 !== variantName_)
192
+ })), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)
193
+ }))
194
+ })))
195
+ }
196
+ function convertPattern_(pattern_) {
197
+ {
198
+ const pattern_a = pattern_;
199
+ {
200
+ if(pattern_a.PString) {
201
+ return ff_core_Option.Some(ff_compiler_Patterns.PatternInfo("String literal", ff_core_List.List_toSet(ff_core_List.Link("Any other String literal", ff_core_List.Empty()), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_List.Empty()))
202
+ return
203
+ }
204
+ }
205
+ {
206
+ if(pattern_a.PInt) {
207
+ return ff_core_Option.Some(ff_compiler_Patterns.PatternInfo("Int literal", ff_core_List.List_toSet(ff_core_List.Link("Any other Int literal", ff_core_List.Empty()), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_List.Empty()))
208
+ return
209
+ }
210
+ }
211
+ {
212
+ if(pattern_a.PChar) {
213
+ return ff_core_Option.Some(ff_compiler_Patterns.PatternInfo("Char literal", ff_core_List.List_toSet(ff_core_List.Link("Any other Char literal", ff_core_List.Empty()), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_List.Empty()))
214
+ return
215
+ }
216
+ }
217
+ {
218
+ if(pattern_a.PVariable) {
219
+ const p_ = pattern_a;
220
+ return ff_core_Option.None()
221
+ return
222
+ }
223
+ }
224
+ {
225
+ if(pattern_a.PVariant) {
226
+ const p_ = pattern_a;
227
+ const fields_ = ff_core_List.List_collect(ff_core_List.List_pairs(ff_core_List.List_map(p_.patterns_, ((pattern_) => {
228
+ return convertPattern_(pattern_)
229
+ }))), ((_1) => {
230
+ {
231
+ const i_ = _1.first_;
232
+ if(_1.second_.Some) {
233
+ const p_ = _1.second_.value_;
234
+ return ff_core_Option.Some(ff_core_Pair.Pair(("" + i_), p_))
235
+ return
236
+ }
237
+ }
238
+ {
239
+ return ff_core_Option.None()
240
+ return
241
+ }
242
+ }));
243
+ return ff_core_Option.Some(ff_compiler_Patterns.PatternInfo(unqualifiedName_(p_.name_), otherVariants_(p_.name_), fields_))
244
+ return
245
+ }
246
+ }
247
+ {
248
+ if(pattern_a.PVariantAs) {
249
+ const p_ = pattern_a;
250
+ return ff_core_Option.Some(ff_compiler_Patterns.PatternInfo(unqualifiedName_(p_.name_), otherVariants_(p_.name_), ff_core_List.Empty()))
251
+ return
252
+ }
253
+ }
254
+ {
255
+ if(pattern_a.PAlias) {
256
+ const p_ = pattern_a;
257
+ return convertPattern_(p_.pattern_)
258
+ return
259
+ }
260
+ }
261
+ }
262
+ }
263
+ return ff_core_List.List_map(ff_core_List.List_pairs(cases_), ((_1) => {
264
+ {
265
+ const caseIndex_ = _1.first_;
266
+ const case_ = _1.second_;
267
+ const fields_ = ff_core_List.List_collect(ff_core_List.List_pairs(ff_core_List.List_map(case_.patterns_, ((pattern_) => {
268
+ return convertPattern_(pattern_)
269
+ }))), ((_1) => {
270
+ {
271
+ const i_ = _1.first_;
272
+ if(_1.second_.Some) {
273
+ const p_ = _1.second_.value_;
274
+ return ff_core_Option.Some(ff_core_Pair.Pair(("" + i_), p_))
275
+ return
276
+ }
277
+ }
278
+ {
279
+ return ff_core_Option.None()
280
+ return
281
+ }
282
+ }));
283
+ const exhaustiveGuards_ = ff_core_List.List_all(case_.guards_, ((g_) => {
284
+ const guardConverted_ = ff_compiler_Patterns.convert_(modules_, ff_core_List.Link(ff_compiler_Syntax.MatchCase(g_.at_, ff_core_List.Link(g_.pattern_, ff_core_List.Empty()), ff_core_List.Empty(), case_.body_), ff_core_List.Empty()));
285
+ return ff_core_Try.Try_else(ff_core_Core.try_((() => {
286
+ ff_compiler_Patterns.check_(ff_core_List.List_toMap(ff_core_List.Empty(), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_List.Empty(), guardConverted_, false, false);
287
+ return true
288
+ })), (() => {
289
+ return false
290
+ }))
291
+ }));
292
+ return ff_compiler_Patterns.PatternCaseInfo(fields_, (!exhaustiveGuards_))
293
+ return
294
+ }
295
+ }))
296
+ }
297
+
298
+ export function convertAndCheck_(modules_, cases_) {
299
+ const converted_ = ff_compiler_Patterns.convert_(modules_, cases_);
300
+ ff_core_Try.Try_else(ff_core_Core.try_((() => {
301
+ return ff_compiler_Patterns.check_(ff_core_List.List_toMap(ff_core_List.Empty(), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_List.Empty(), converted_, false, false)
302
+ })), (() => {
303
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(ff_core_List.List_grab(cases_, 0).at_, "Unexhaustive match"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
304
+ }))
305
+ }
306
+
307
+ export function fail_(at_, message_) {
308
+ return ff_core_Core.panic_(((message_ + " ") + ff_compiler_Syntax.Location_show(at_)))
309
+ }
310
+
311
+ export async function check_$(variants_, fields_, cases_, success_, guard_, $task) {
312
+ {
313
+ const _1 = ff_core_Pair.Pair(fields_, cases_);
314
+ {
315
+ if(_1.first_.Link) {
316
+ const f_ = _1.first_.head_.first_;
317
+ const p_ = _1.first_.head_.second_;
318
+ const fs_ = _1.first_.tail_;
319
+ const cs_ = _1.second_;
320
+ const vs_ = ff_core_Option.Option_else(ff_core_Map.Map_get(variants_, f_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), (() => {
321
+ return ff_core_Set.Set_add(p_.otherVariants_, p_.variant_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)
322
+ }));
323
+ if(ff_core_Set.Set_contains(vs_, p_.variant_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)) {
324
+ const newFields_ = ff_core_List.List_map(p_.fields_, ((_w1) => {
325
+ return ff_core_Pair.Pair_mapFirst(_w1, ((_w1) => {
326
+ return ((((f_ + ".") + p_.variant_) + "_") + _w1)
327
+ }))
328
+ }));
329
+ if((ff_core_Set.Set_size(vs_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String) === 1)) {
330
+ ff_compiler_Patterns.check_(ff_core_Map.Map_add(variants_, f_, vs_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_List.List_addAll(newFields_, fs_), cs_, true, guard_)
331
+ } else {
332
+ ff_compiler_Patterns.check_(ff_core_Map.Map_add(variants_, f_, ff_core_List.List_toSet(ff_core_List.Link(p_.variant_, ff_core_List.Empty()), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_List.List_addAll(newFields_, fs_), cs_, true, guard_);
333
+ ff_compiler_Patterns.check_(ff_core_Map.Map_add(variants_, f_, ff_core_Set.Set_remove(vs_, p_.variant_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_List.Empty(), cs_, false, guard_)
334
+ }
335
+ } else {
336
+ ff_compiler_Patterns.check_(variants_, ff_core_List.Empty(), cs_, false, guard_)
337
+ }
338
+ return
339
+ }
340
+ }
341
+ {
342
+ const _guard1 = (success_ && (!guard_));
343
+ if(_guard1) {
344
+
345
+ return
346
+ }
347
+ }
348
+ {
349
+ if(_1.first_.Empty) {
350
+ if(_1.second_.Link) {
351
+ const fs_ = _1.second_.head_.fields_;
352
+ const g_ = _1.second_.head_.guard_;
353
+ const cs_ = _1.second_.tail_;
354
+ ff_compiler_Patterns.check_(variants_, fs_, cs_, true, g_)
355
+ return
356
+ }
357
+ }
358
+ }
359
+ {
360
+ if(_1.first_.Empty) {
361
+ if(_1.second_.Empty) {
362
+ const remaining_ = ff_core_List.List_map(ff_core_List.List_filter(ff_core_Map.Map_pairs(variants_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ((_w1) => {
363
+ return (ff_core_Set.Set_size(_w1.second_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String) !== 0)
364
+ })), ((_1) => {
365
+ {
366
+ const f_ = _1.first_;
367
+ const vs_ = _1.second_;
368
+ return ((f_ + " could be ") + ff_core_Show.ff_core_Show_Show$ff_core_List_List(ff_core_Show.ff_core_Show_Show$ff_core_String_String).show_(ff_core_Set.Set_toList(vs_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)))
369
+ return
370
+ }
371
+ }));
372
+ if((ff_core_List.List_size(remaining_) !== 0)) {
373
+ ff_core_Core.panic_(("Unexhaustive match:\n" + ff_core_List.List_join(remaining_, "\n")))
374
+ }
375
+ return
376
+ }
377
+ }
378
+ }
379
+ }
380
+ }
381
+
382
+ export async function convert_$(modules_, cases_, $task) {
383
+ function unqualifiedName_(name_) {
384
+ return ff_core_String.String_reverse(ff_core_String.String_takeWhile(ff_core_String.String_reverse(name_), ((_w1) => {
385
+ return (_w1 !== 46)
386
+ })))
387
+ }
388
+ function otherVariants_(name_) {
389
+ const variantName_ = unqualifiedName_(name_);
390
+ const moduleName_ = ff_core_String.String_dropLast(name_, (ff_core_String.String_size(variantName_) + 1));
391
+ const variantModule_ = ff_core_Map.Map_grab(modules_, moduleName_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
392
+ return ff_core_Option.Option_grab(ff_core_List.List_collectFirst(variantModule_.types_, ((definition_) => {
393
+ return ff_core_Option.Option_map(ff_core_List.List_find(definition_.variants_, ((_w1) => {
394
+ return (_w1.name_ === variantName_)
395
+ })), ((variant_) => {
396
+ return ff_core_List.List_toSet(ff_core_List.List_filter(ff_core_List.List_map(definition_.variants_, ((_w1) => {
397
+ return _w1.name_
398
+ })), ((_w1) => {
399
+ return (_w1 !== variantName_)
400
+ })), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)
401
+ }))
402
+ })))
403
+ }
404
+ function convertPattern_(pattern_) {
405
+ {
406
+ const pattern_a = pattern_;
407
+ {
408
+ if(pattern_a.PString) {
409
+ return ff_core_Option.Some(ff_compiler_Patterns.PatternInfo("String literal", ff_core_List.List_toSet(ff_core_List.Link("Any other String literal", ff_core_List.Empty()), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_List.Empty()))
410
+ return
411
+ }
412
+ }
413
+ {
414
+ if(pattern_a.PInt) {
415
+ return ff_core_Option.Some(ff_compiler_Patterns.PatternInfo("Int literal", ff_core_List.List_toSet(ff_core_List.Link("Any other Int literal", ff_core_List.Empty()), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_List.Empty()))
416
+ return
417
+ }
418
+ }
419
+ {
420
+ if(pattern_a.PChar) {
421
+ return ff_core_Option.Some(ff_compiler_Patterns.PatternInfo("Char literal", ff_core_List.List_toSet(ff_core_List.Link("Any other Char literal", ff_core_List.Empty()), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_List.Empty()))
422
+ return
423
+ }
424
+ }
425
+ {
426
+ if(pattern_a.PVariable) {
427
+ const p_ = pattern_a;
428
+ return ff_core_Option.None()
429
+ return
430
+ }
431
+ }
432
+ {
433
+ if(pattern_a.PVariant) {
434
+ const p_ = pattern_a;
435
+ const fields_ = ff_core_List.List_collect(ff_core_List.List_pairs(ff_core_List.List_map(p_.patterns_, ((pattern_) => {
436
+ return convertPattern_(pattern_)
437
+ }))), ((_1) => {
438
+ {
439
+ const i_ = _1.first_;
440
+ if(_1.second_.Some) {
441
+ const p_ = _1.second_.value_;
442
+ return ff_core_Option.Some(ff_core_Pair.Pair(("" + i_), p_))
443
+ return
444
+ }
445
+ }
446
+ {
447
+ return ff_core_Option.None()
448
+ return
449
+ }
450
+ }));
451
+ return ff_core_Option.Some(ff_compiler_Patterns.PatternInfo(unqualifiedName_(p_.name_), otherVariants_(p_.name_), fields_))
452
+ return
453
+ }
454
+ }
455
+ {
456
+ if(pattern_a.PVariantAs) {
457
+ const p_ = pattern_a;
458
+ return ff_core_Option.Some(ff_compiler_Patterns.PatternInfo(unqualifiedName_(p_.name_), otherVariants_(p_.name_), ff_core_List.Empty()))
459
+ return
460
+ }
461
+ }
462
+ {
463
+ if(pattern_a.PAlias) {
464
+ const p_ = pattern_a;
465
+ return convertPattern_(p_.pattern_)
466
+ return
467
+ }
468
+ }
469
+ }
470
+ }
471
+ return ff_core_List.List_map(ff_core_List.List_pairs(cases_), ((_1) => {
472
+ {
473
+ const caseIndex_ = _1.first_;
474
+ const case_ = _1.second_;
475
+ const fields_ = ff_core_List.List_collect(ff_core_List.List_pairs(ff_core_List.List_map(case_.patterns_, ((pattern_) => {
476
+ return convertPattern_(pattern_)
477
+ }))), ((_1) => {
478
+ {
479
+ const i_ = _1.first_;
480
+ if(_1.second_.Some) {
481
+ const p_ = _1.second_.value_;
482
+ return ff_core_Option.Some(ff_core_Pair.Pair(("" + i_), p_))
483
+ return
484
+ }
485
+ }
486
+ {
487
+ return ff_core_Option.None()
488
+ return
489
+ }
490
+ }));
491
+ const exhaustiveGuards_ = ff_core_List.List_all(case_.guards_, ((g_) => {
492
+ const guardConverted_ = ff_compiler_Patterns.convert_(modules_, ff_core_List.Link(ff_compiler_Syntax.MatchCase(g_.at_, ff_core_List.Link(g_.pattern_, ff_core_List.Empty()), ff_core_List.Empty(), case_.body_), ff_core_List.Empty()));
493
+ return ff_core_Try.Try_else(ff_core_Core.try_((() => {
494
+ ff_compiler_Patterns.check_(ff_core_List.List_toMap(ff_core_List.Empty(), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_List.Empty(), guardConverted_, false, false);
495
+ return true
496
+ })), (() => {
497
+ return false
498
+ }))
499
+ }));
500
+ return ff_compiler_Patterns.PatternCaseInfo(fields_, (!exhaustiveGuards_))
501
+ return
502
+ }
503
+ }))
504
+ }
505
+
506
+ export async function convertAndCheck_$(modules_, cases_, $task) {
507
+ const converted_ = ff_compiler_Patterns.convert_(modules_, cases_);
508
+ ff_core_Try.Try_else(ff_core_Core.try_((() => {
509
+ return ff_compiler_Patterns.check_(ff_core_List.List_toMap(ff_core_List.Empty(), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_List.Empty(), converted_, false, false)
510
+ })), (() => {
511
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(ff_core_List.List_grab(cases_, 0).at_, "Unexhaustive match"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
512
+ }))
513
+ }
514
+
515
+ export async function fail_$(at_, message_, $task) {
516
+ return ff_core_Core.panic_(((message_ + " ") + ff_compiler_Syntax.Location_show(at_)))
517
+ }
518
+
519
+
520
+
521
+ export const ff_core_Any_HasAnyTag$ff_compiler_Patterns_PatternInfo = {
522
+ anyTag_() {
523
+ return ff_core_Any.internalAnyTag_((("ff:compiler/Patterns.PatternInfo" + "[") + "]"))
524
+ },
525
+ async anyTag_$($task) {
526
+ return ff_core_Any.internalAnyTag_((("ff:compiler/Patterns.PatternInfo" + "[") + "]"))
527
+ }
528
+ };
529
+
530
+ export const ff_core_Any_HasAnyTag$ff_compiler_Patterns_PatternCaseInfo = {
531
+ anyTag_() {
532
+ return ff_core_Any.internalAnyTag_((("ff:compiler/Patterns.PatternCaseInfo" + "[") + "]"))
533
+ },
534
+ async anyTag_$($task) {
535
+ return ff_core_Any.internalAnyTag_((("ff:compiler/Patterns.PatternCaseInfo" + "[") + "]"))
536
+ }
537
+ };
538
+
539
+ export const ff_core_Show_Show$ff_compiler_Patterns_PatternInfo = {
540
+ show_(value_) {
541
+ {
542
+ const value_a = value_;
543
+ {
544
+ const z_ = value_a;
545
+ return ((((((("PatternInfo" + "(") + ff_core_Show.ff_core_Show_Show$ff_core_String_String.show_(z_.variant_)) + ", ") + ff_core_Set.ff_core_Show_Show$ff_core_Set_Set(ff_core_Show.ff_core_Show_Show$ff_core_String_String, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String).show_(z_.otherVariants_)) + ", ") + ff_core_Show.ff_core_Show_Show$ff_core_List_List(ff_core_Show.ff_core_Show_Show$ff_core_Pair_Pair(ff_core_Show.ff_core_Show_Show$ff_core_String_String, ff_compiler_Patterns.ff_core_Show_Show$ff_compiler_Patterns_PatternInfo)).show_(z_.fields_)) + ")")
546
+ return
547
+ }
548
+ }
549
+ },
550
+ async show_$(value_, $task) {
551
+ {
552
+ const value_a = value_;
553
+ {
554
+ const z_ = value_a;
555
+ return ((((((("PatternInfo" + "(") + ff_core_Show.ff_core_Show_Show$ff_core_String_String.show_(z_.variant_)) + ", ") + ff_core_Set.ff_core_Show_Show$ff_core_Set_Set(ff_core_Show.ff_core_Show_Show$ff_core_String_String, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String).show_(z_.otherVariants_)) + ", ") + ff_core_Show.ff_core_Show_Show$ff_core_List_List(ff_core_Show.ff_core_Show_Show$ff_core_Pair_Pair(ff_core_Show.ff_core_Show_Show$ff_core_String_String, ff_compiler_Patterns.ff_core_Show_Show$ff_compiler_Patterns_PatternInfo)).show_(z_.fields_)) + ")")
556
+ return
557
+ }
558
+ }
559
+ }
560
+ };
561
+
562
+ export const ff_core_Show_Show$ff_compiler_Patterns_PatternCaseInfo = {
563
+ show_(value_) {
564
+ {
565
+ const value_a = value_;
566
+ {
567
+ const z_ = value_a;
568
+ return ((((("PatternCaseInfo" + "(") + ff_core_Show.ff_core_Show_Show$ff_core_List_List(ff_core_Show.ff_core_Show_Show$ff_core_Pair_Pair(ff_core_Show.ff_core_Show_Show$ff_core_String_String, ff_compiler_Patterns.ff_core_Show_Show$ff_compiler_Patterns_PatternInfo)).show_(z_.fields_)) + ", ") + ff_core_Show.ff_core_Show_Show$ff_core_Bool_Bool.show_(z_.guard_)) + ")")
569
+ return
570
+ }
571
+ }
572
+ },
573
+ async show_$(value_, $task) {
574
+ {
575
+ const value_a = value_;
576
+ {
577
+ const z_ = value_a;
578
+ return ((((("PatternCaseInfo" + "(") + ff_core_Show.ff_core_Show_Show$ff_core_List_List(ff_core_Show.ff_core_Show_Show$ff_core_Pair_Pair(ff_core_Show.ff_core_Show_Show$ff_core_String_String, ff_compiler_Patterns.ff_core_Show_Show$ff_compiler_Patterns_PatternInfo)).show_(z_.fields_)) + ", ") + ff_core_Show.ff_core_Show_Show$ff_core_Bool_Bool.show_(z_.guard_)) + ")")
579
+ return
580
+ }
581
+ }
582
+ }
583
+ };
584
+
585
+ export const ff_core_Equal_Equal$ff_compiler_Patterns_PatternInfo = {
586
+ equals_(x_, y_) {
587
+ {
588
+ const x_a = x_;
589
+ const y_a = y_;
590
+ {
591
+ const _guard1 = (x_ === y_);
592
+ if(_guard1) {
593
+ return true
594
+ return
595
+ }
596
+ }
597
+ {
598
+ return ((x_.variant_ === y_.variant_) && (ff_core_Set.ff_core_Equal_Equal$ff_core_Set_Set(ff_core_Equal.ff_core_Equal_Equal$ff_core_String_String, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String).equals_(x_.otherVariants_, y_.otherVariants_) && ff_core_List.ff_core_Equal_Equal$ff_core_List_List(ff_core_Pair.ff_core_Equal_Equal$ff_core_Pair_Pair(ff_core_Equal.ff_core_Equal_Equal$ff_core_String_String, ff_compiler_Patterns.ff_core_Equal_Equal$ff_compiler_Patterns_PatternInfo)).equals_(x_.fields_, y_.fields_)))
599
+ return
600
+ }
601
+ }
602
+ },
603
+ async equals_$(x_, y_, $task) {
604
+ {
605
+ const x_a = x_;
606
+ const y_a = y_;
607
+ {
608
+ const _guard1 = (x_ === y_);
609
+ if(_guard1) {
610
+ return true
611
+ return
612
+ }
613
+ }
614
+ {
615
+ return ((x_.variant_ === y_.variant_) && (ff_core_Set.ff_core_Equal_Equal$ff_core_Set_Set(ff_core_Equal.ff_core_Equal_Equal$ff_core_String_String, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String).equals_(x_.otherVariants_, y_.otherVariants_) && ff_core_List.ff_core_Equal_Equal$ff_core_List_List(ff_core_Pair.ff_core_Equal_Equal$ff_core_Pair_Pair(ff_core_Equal.ff_core_Equal_Equal$ff_core_String_String, ff_compiler_Patterns.ff_core_Equal_Equal$ff_compiler_Patterns_PatternInfo)).equals_(x_.fields_, y_.fields_)))
616
+ return
617
+ }
618
+ }
619
+ }
620
+ };
621
+
622
+ export const ff_core_Equal_Equal$ff_compiler_Patterns_PatternCaseInfo = {
623
+ equals_(x_, y_) {
624
+ {
625
+ const x_a = x_;
626
+ const y_a = y_;
627
+ {
628
+ const _guard1 = (x_ === y_);
629
+ if(_guard1) {
630
+ return true
631
+ return
632
+ }
633
+ }
634
+ {
635
+ return (ff_core_List.ff_core_Equal_Equal$ff_core_List_List(ff_core_Pair.ff_core_Equal_Equal$ff_core_Pair_Pair(ff_core_Equal.ff_core_Equal_Equal$ff_core_String_String, ff_compiler_Patterns.ff_core_Equal_Equal$ff_compiler_Patterns_PatternInfo)).equals_(x_.fields_, y_.fields_) && (x_.guard_ === y_.guard_))
636
+ return
637
+ }
638
+ }
639
+ },
640
+ async equals_$(x_, y_, $task) {
641
+ {
642
+ const x_a = x_;
643
+ const y_a = y_;
644
+ {
645
+ const _guard1 = (x_ === y_);
646
+ if(_guard1) {
647
+ return true
648
+ return
649
+ }
650
+ }
651
+ {
652
+ return (ff_core_List.ff_core_Equal_Equal$ff_core_List_List(ff_core_Pair.ff_core_Equal_Equal$ff_core_Pair_Pair(ff_core_Equal.ff_core_Equal_Equal$ff_core_String_String, ff_compiler_Patterns.ff_core_Equal_Equal$ff_compiler_Patterns_PatternInfo)).equals_(x_.fields_, y_.fields_) && (x_.guard_ === y_.guard_))
653
+ return
654
+ }
655
+ }
656
+ }
657
+ };
658
+
659
+ export const ff_core_Ordering_Order$ff_compiler_Patterns_PatternInfo = {
660
+ compare_(x_, y_) {
661
+ {
662
+ const x_a = x_;
663
+ const y_a = y_;
664
+ {
665
+ const _guard1 = (x_ === y_);
666
+ if(_guard1) {
667
+ return ff_core_Ordering.OrderingSame()
668
+ return
669
+ }
670
+ }
671
+ {
672
+ const variantOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String.compare_(x_.variant_, y_.variant_);
673
+ if((variantOrdering_ !== ff_core_Ordering.OrderingSame())) {
674
+ return variantOrdering_
675
+ } else {
676
+ const otherVariantsOrdering_ = ff_core_Set.ff_core_Ordering_Order$ff_core_Set_Set(ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String).compare_(x_.otherVariants_, y_.otherVariants_);
677
+ if((otherVariantsOrdering_ !== ff_core_Ordering.OrderingSame())) {
678
+ return otherVariantsOrdering_
679
+ } else {
680
+ const fieldsOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_List_List(ff_core_Ordering.ff_core_Ordering_Order$ff_core_Pair_Pair(ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String, ff_compiler_Patterns.ff_core_Ordering_Order$ff_compiler_Patterns_PatternInfo)).compare_(x_.fields_, y_.fields_);
681
+ if((fieldsOrdering_ !== ff_core_Ordering.OrderingSame())) {
682
+ return fieldsOrdering_
683
+ } else {
684
+ return ff_core_Ordering.OrderingSame()
685
+ }
686
+ }
687
+ }
688
+ return
689
+ }
690
+ }
691
+ },
692
+ async compare_$(x_, y_, $task) {
693
+ {
694
+ const x_a = x_;
695
+ const y_a = y_;
696
+ {
697
+ const _guard1 = (x_ === y_);
698
+ if(_guard1) {
699
+ return ff_core_Ordering.OrderingSame()
700
+ return
701
+ }
702
+ }
703
+ {
704
+ const variantOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String.compare_(x_.variant_, y_.variant_);
705
+ if((variantOrdering_ !== ff_core_Ordering.OrderingSame())) {
706
+ return variantOrdering_
707
+ } else {
708
+ const otherVariantsOrdering_ = ff_core_Set.ff_core_Ordering_Order$ff_core_Set_Set(ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String).compare_(x_.otherVariants_, y_.otherVariants_);
709
+ if((otherVariantsOrdering_ !== ff_core_Ordering.OrderingSame())) {
710
+ return otherVariantsOrdering_
711
+ } else {
712
+ const fieldsOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_List_List(ff_core_Ordering.ff_core_Ordering_Order$ff_core_Pair_Pair(ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String, ff_compiler_Patterns.ff_core_Ordering_Order$ff_compiler_Patterns_PatternInfo)).compare_(x_.fields_, y_.fields_);
713
+ if((fieldsOrdering_ !== ff_core_Ordering.OrderingSame())) {
714
+ return fieldsOrdering_
715
+ } else {
716
+ return ff_core_Ordering.OrderingSame()
717
+ }
718
+ }
719
+ }
720
+ return
721
+ }
722
+ }
723
+ }
724
+ };
725
+
726
+ export const ff_core_Ordering_Order$ff_compiler_Patterns_PatternCaseInfo = {
727
+ compare_(x_, y_) {
728
+ {
729
+ const x_a = x_;
730
+ const y_a = y_;
731
+ {
732
+ const _guard1 = (x_ === y_);
733
+ if(_guard1) {
734
+ return ff_core_Ordering.OrderingSame()
735
+ return
736
+ }
737
+ }
738
+ {
739
+ const fieldsOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_List_List(ff_core_Ordering.ff_core_Ordering_Order$ff_core_Pair_Pair(ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String, ff_compiler_Patterns.ff_core_Ordering_Order$ff_compiler_Patterns_PatternInfo)).compare_(x_.fields_, y_.fields_);
740
+ if((fieldsOrdering_ !== ff_core_Ordering.OrderingSame())) {
741
+ return fieldsOrdering_
742
+ } else {
743
+ const guardOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_Bool_Bool.compare_(x_.guard_, y_.guard_);
744
+ if((guardOrdering_ !== ff_core_Ordering.OrderingSame())) {
745
+ return guardOrdering_
746
+ } else {
747
+ return ff_core_Ordering.OrderingSame()
748
+ }
749
+ }
750
+ return
751
+ }
752
+ }
753
+ },
754
+ async compare_$(x_, y_, $task) {
755
+ {
756
+ const x_a = x_;
757
+ const y_a = y_;
758
+ {
759
+ const _guard1 = (x_ === y_);
760
+ if(_guard1) {
761
+ return ff_core_Ordering.OrderingSame()
762
+ return
763
+ }
764
+ }
765
+ {
766
+ const fieldsOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_List_List(ff_core_Ordering.ff_core_Ordering_Order$ff_core_Pair_Pair(ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String, ff_compiler_Patterns.ff_core_Ordering_Order$ff_compiler_Patterns_PatternInfo)).compare_(x_.fields_, y_.fields_);
767
+ if((fieldsOrdering_ !== ff_core_Ordering.OrderingSame())) {
768
+ return fieldsOrdering_
769
+ } else {
770
+ const guardOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_Bool_Bool.compare_(x_.guard_, y_.guard_);
771
+ if((guardOrdering_ !== ff_core_Ordering.OrderingSame())) {
772
+ return guardOrdering_
773
+ } else {
774
+ return ff_core_Ordering.OrderingSame()
775
+ }
776
+ }
777
+ return
778
+ }
779
+ }
780
+ }
781
+ };
782
+
783
+ export const ff_core_Serializable_Serializable$ff_compiler_Patterns_PatternInfo = {
784
+ serializeUsing_(serialization_, value_) {
785
+ {
786
+ const serialization_a = serialization_;
787
+ const value_a = value_;
788
+ {
789
+ const v_ = value_a;
790
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 32), 0);
791
+ ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 0);
792
+ serialization_.offset_ += 1;
793
+ ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.serializeUsing_(serialization_, v_.variant_);
794
+ ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_Set_Set(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String).serializeUsing_(serialization_, v_.otherVariants_);
795
+ ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_core_Pair.ff_core_Serializable_Serializable$ff_core_Pair_Pair(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String, ff_compiler_Patterns.ff_core_Serializable_Serializable$ff_compiler_Patterns_PatternInfo)).serializeUsing_(serialization_, v_.fields_)
796
+ return
797
+ }
798
+ }
799
+ },
800
+ deserializeUsing_(serialization_) {
801
+ const variantIndex_ = ff_core_Buffer.Buffer_grabUint8(serialization_.buffer_, serialization_.offset_);
802
+ serialization_.offset_ += 1;
803
+ {
804
+ const _1 = variantIndex_;
805
+ {
806
+ if(_1 == 0) {
807
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 32), 0);
808
+ return ff_compiler_Patterns.PatternInfo(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.deserializeUsing_(serialization_), ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_Set_Set(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String).deserializeUsing_(serialization_), ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_core_Pair.ff_core_Serializable_Serializable$ff_core_Pair_Pair(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String, ff_compiler_Patterns.ff_core_Serializable_Serializable$ff_compiler_Patterns_PatternInfo)).deserializeUsing_(serialization_))
809
+ return
810
+ }
811
+ }
812
+ {
813
+ 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)})
814
+ return
815
+ }
816
+ }
817
+ },
818
+ async serializeUsing_$(serialization_, value_, $task) {
819
+ {
820
+ const serialization_a = serialization_;
821
+ const value_a = value_;
822
+ {
823
+ const v_ = value_a;
824
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 32), 0);
825
+ ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 0);
826
+ serialization_.offset_ += 1;
827
+ ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.serializeUsing_(serialization_, v_.variant_);
828
+ ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_Set_Set(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String).serializeUsing_(serialization_, v_.otherVariants_);
829
+ ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_core_Pair.ff_core_Serializable_Serializable$ff_core_Pair_Pair(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String, ff_compiler_Patterns.ff_core_Serializable_Serializable$ff_compiler_Patterns_PatternInfo)).serializeUsing_(serialization_, v_.fields_)
830
+ return
831
+ }
832
+ }
833
+ },
834
+ async deserializeUsing_$(serialization_, $task) {
835
+ const variantIndex_ = ff_core_Buffer.Buffer_grabUint8(serialization_.buffer_, serialization_.offset_);
836
+ serialization_.offset_ += 1;
837
+ {
838
+ const _1 = variantIndex_;
839
+ {
840
+ if(_1 == 0) {
841
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 32), 0);
842
+ return ff_compiler_Patterns.PatternInfo(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.deserializeUsing_(serialization_), ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_Set_Set(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String).deserializeUsing_(serialization_), ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_core_Pair.ff_core_Serializable_Serializable$ff_core_Pair_Pair(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String, ff_compiler_Patterns.ff_core_Serializable_Serializable$ff_compiler_Patterns_PatternInfo)).deserializeUsing_(serialization_))
843
+ return
844
+ }
845
+ }
846
+ {
847
+ 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)})
848
+ return
849
+ }
850
+ }
851
+ }
852
+ };
853
+
854
+ export const ff_core_Serializable_Serializable$ff_compiler_Patterns_PatternCaseInfo = {
855
+ serializeUsing_(serialization_, value_) {
856
+ {
857
+ const serialization_a = serialization_;
858
+ const value_a = value_;
859
+ {
860
+ const v_ = value_a;
861
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 36), 0);
862
+ ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 0);
863
+ serialization_.offset_ += 1;
864
+ ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_core_Pair.ff_core_Serializable_Serializable$ff_core_Pair_Pair(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String, ff_compiler_Patterns.ff_core_Serializable_Serializable$ff_compiler_Patterns_PatternInfo)).serializeUsing_(serialization_, v_.fields_);
865
+ ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_Bool_Bool.serializeUsing_(serialization_, v_.guard_)
866
+ return
867
+ }
868
+ }
869
+ },
870
+ deserializeUsing_(serialization_) {
871
+ const variantIndex_ = ff_core_Buffer.Buffer_grabUint8(serialization_.buffer_, serialization_.offset_);
872
+ serialization_.offset_ += 1;
873
+ {
874
+ const _1 = variantIndex_;
875
+ {
876
+ if(_1 == 0) {
877
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 36), 0);
878
+ return ff_compiler_Patterns.PatternCaseInfo(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_core_Pair.ff_core_Serializable_Serializable$ff_core_Pair_Pair(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String, ff_compiler_Patterns.ff_core_Serializable_Serializable$ff_compiler_Patterns_PatternInfo)).deserializeUsing_(serialization_), ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_Bool_Bool.deserializeUsing_(serialization_))
879
+ return
880
+ }
881
+ }
882
+ {
883
+ 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)})
884
+ return
885
+ }
886
+ }
887
+ },
888
+ async serializeUsing_$(serialization_, value_, $task) {
889
+ {
890
+ const serialization_a = serialization_;
891
+ const value_a = value_;
892
+ {
893
+ const v_ = value_a;
894
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 36), 0);
895
+ ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 0);
896
+ serialization_.offset_ += 1;
897
+ ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_core_Pair.ff_core_Serializable_Serializable$ff_core_Pair_Pair(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String, ff_compiler_Patterns.ff_core_Serializable_Serializable$ff_compiler_Patterns_PatternInfo)).serializeUsing_(serialization_, v_.fields_);
898
+ ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_Bool_Bool.serializeUsing_(serialization_, v_.guard_)
899
+ return
900
+ }
901
+ }
902
+ },
903
+ async deserializeUsing_$(serialization_, $task) {
904
+ const variantIndex_ = ff_core_Buffer.Buffer_grabUint8(serialization_.buffer_, serialization_.offset_);
905
+ serialization_.offset_ += 1;
906
+ {
907
+ const _1 = variantIndex_;
908
+ {
909
+ if(_1 == 0) {
910
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 36), 0);
911
+ return ff_compiler_Patterns.PatternCaseInfo(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_core_Pair.ff_core_Serializable_Serializable$ff_core_Pair_Pair(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String, ff_compiler_Patterns.ff_core_Serializable_Serializable$ff_compiler_Patterns_PatternInfo)).deserializeUsing_(serialization_), ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_Bool_Bool.deserializeUsing_(serialization_))
912
+ return
913
+ }
914
+ }
915
+ {
916
+ 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)})
917
+ return
918
+ }
919
+ }
920
+ }
921
+ };
922
+
923
+