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,1748 @@
1
+
2
+
3
+ import * as ff_compiler_Unification from "../../ff/compiler/Unification.mjs"
4
+
5
+ import * as ff_compiler_Inference from "../../ff/compiler/Inference.mjs"
6
+
7
+ import * as ff_compiler_Syntax from "../../ff/compiler/Syntax.mjs"
8
+
9
+ import * as ff_core_Any from "../../ff/core/Any.mjs"
10
+
11
+ import * as ff_core_Array from "../../ff/core/Array.mjs"
12
+
13
+ import * as ff_core_AssetSystem from "../../ff/core/AssetSystem.mjs"
14
+
15
+ import * as ff_core_Atomic from "../../ff/core/Atomic.mjs"
16
+
17
+ import * as ff_core_Bool from "../../ff/core/Bool.mjs"
18
+
19
+ import * as ff_core_BrowserSystem from "../../ff/core/BrowserSystem.mjs"
20
+
21
+ import * as ff_core_Buffer from "../../ff/core/Buffer.mjs"
22
+
23
+ import * as ff_core_BuildSystem from "../../ff/core/BuildSystem.mjs"
24
+
25
+ import * as ff_core_Channel from "../../ff/core/Channel.mjs"
26
+
27
+ import * as ff_core_Char from "../../ff/core/Char.mjs"
28
+
29
+ import * as ff_core_Core from "../../ff/core/Core.mjs"
30
+
31
+ import * as ff_core_Duration from "../../ff/core/Duration.mjs"
32
+
33
+ import * as ff_core_Equal from "../../ff/core/Equal.mjs"
34
+
35
+ import * as ff_core_Error from "../../ff/core/Error.mjs"
36
+
37
+ import * as ff_core_FileHandle from "../../ff/core/FileHandle.mjs"
38
+
39
+ import * as ff_core_Float from "../../ff/core/Float.mjs"
40
+
41
+ import * as ff_core_HttpClient from "../../ff/core/HttpClient.mjs"
42
+
43
+ import * as ff_core_Instant from "../../ff/core/Instant.mjs"
44
+
45
+ import * as ff_core_Int from "../../ff/core/Int.mjs"
46
+
47
+ import * as ff_core_IntMap from "../../ff/core/IntMap.mjs"
48
+
49
+ import * as ff_core_JsSystem from "../../ff/core/JsSystem.mjs"
50
+
51
+ import * as ff_core_JsValue from "../../ff/core/JsValue.mjs"
52
+
53
+ import * as ff_core_List from "../../ff/core/List.mjs"
54
+
55
+ import * as ff_core_Lock from "../../ff/core/Lock.mjs"
56
+
57
+ import * as ff_core_Log from "../../ff/core/Log.mjs"
58
+
59
+ import * as ff_core_Map from "../../ff/core/Map.mjs"
60
+
61
+ import * as ff_core_NodeSystem from "../../ff/core/NodeSystem.mjs"
62
+
63
+ import * as ff_core_Nothing from "../../ff/core/Nothing.mjs"
64
+
65
+ import * as ff_core_Option from "../../ff/core/Option.mjs"
66
+
67
+ import * as ff_core_Ordering from "../../ff/core/Ordering.mjs"
68
+
69
+ import * as ff_core_Pair from "../../ff/core/Pair.mjs"
70
+
71
+ import * as ff_core_Path from "../../ff/core/Path.mjs"
72
+
73
+ import * as ff_core_Serializable from "../../ff/core/Serializable.mjs"
74
+
75
+ import * as ff_core_Set from "../../ff/core/Set.mjs"
76
+
77
+ import * as ff_core_Show from "../../ff/core/Show.mjs"
78
+
79
+ import * as ff_core_Stack from "../../ff/core/Stack.mjs"
80
+
81
+ import * as ff_core_Stream from "../../ff/core/Stream.mjs"
82
+
83
+ import * as ff_core_String from "../../ff/core/String.mjs"
84
+
85
+ import * as ff_core_StringMap from "../../ff/core/StringMap.mjs"
86
+
87
+ import * as ff_core_Task from "../../ff/core/Task.mjs"
88
+
89
+ import * as ff_core_Try from "../../ff/core/Try.mjs"
90
+
91
+ import * as ff_core_Unit from "../../ff/core/Unit.mjs"
92
+
93
+ // type Unification
94
+ export function Unification(substitution_, constraints_, nextUnificationVariableIndex_, instances_, affects_, attemptFixes_) {
95
+ return {substitution_, constraints_, nextUnificationVariableIndex_, instances_, affects_, attemptFixes_};
96
+ }
97
+
98
+ // type ConstraintGenerics
99
+ export function ConstraintGenerics(at_, generics_) {
100
+ return {at_, generics_};
101
+ }
102
+
103
+ // type InstanceKey
104
+ export function InstanceKey(traitName_, typeName_) {
105
+ return {traitName_, typeName_};
106
+ }
107
+
108
+ // type InstanceValue
109
+ export function InstanceValue(generics_, constraints_, packagePair_, moduleName_, traitName_, typeArguments_) {
110
+ return {generics_, constraints_, packagePair_, moduleName_, traitName_, typeArguments_};
111
+ }
112
+
113
+
114
+
115
+ export function fail_(at_, message_) {
116
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, message_), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
117
+ }
118
+
119
+ export function make_(modules_, attemptFixes_) {
120
+ return ff_compiler_Unification.Unification(ff_core_Map.empty_(), ff_core_Map.empty_(), 3, ff_core_List.List_toMap(ff_core_List.List_flatMap(modules_, ((module_) => {
121
+ const moduleName_ = ff_core_String.String_dropLast(module_.file_, ff_core_String.String_size(".ff"));
122
+ return ff_core_List.List_map(module_.instances_, ((definition_) => {
123
+ const typeName_ = (((_1) => {
124
+ {
125
+ if(_1.TConstructor) {
126
+ const name_ = _1.name_;
127
+ return name_
128
+ return
129
+ }
130
+ }
131
+ {
132
+ if(_1.TVariable) {
133
+ const i_ = _1.index_;
134
+ return ff_compiler_Unification.fail_(definition_.at_, ("Unexpected unification variable: $" + i_))
135
+ return
136
+ }
137
+ }
138
+ }))(ff_core_List.List_grabFirst(definition_.typeArguments_));
139
+ return ff_core_Pair.Pair(ff_compiler_Unification.InstanceKey(definition_.traitName_, typeName_), ff_compiler_Unification.InstanceValue(definition_.generics_, definition_.constraints_, module_.packagePair_, moduleName_, definition_.traitName_, definition_.typeArguments_))
140
+ }))
141
+ })), ff_compiler_Unification.ff_core_Ordering_Order$ff_compiler_Unification_InstanceKey), ff_core_List.List_toMap(ff_core_List.Empty(), ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int), attemptFixes_)
142
+ }
143
+
144
+ export async function fail_$(at_, message_, $task) {
145
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, message_), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
146
+ }
147
+
148
+ export async function make_$(modules_, attemptFixes_, $task) {
149
+ return ff_compiler_Unification.Unification(ff_core_Map.empty_(), ff_core_Map.empty_(), 3, ff_core_List.List_toMap(ff_core_List.List_flatMap(modules_, ((module_) => {
150
+ const moduleName_ = ff_core_String.String_dropLast(module_.file_, ff_core_String.String_size(".ff"));
151
+ return ff_core_List.List_map(module_.instances_, ((definition_) => {
152
+ const typeName_ = (((_1) => {
153
+ {
154
+ if(_1.TConstructor) {
155
+ const name_ = _1.name_;
156
+ return name_
157
+ return
158
+ }
159
+ }
160
+ {
161
+ if(_1.TVariable) {
162
+ const i_ = _1.index_;
163
+ return ff_compiler_Unification.fail_(definition_.at_, ("Unexpected unification variable: $" + i_))
164
+ return
165
+ }
166
+ }
167
+ }))(ff_core_List.List_grabFirst(definition_.typeArguments_));
168
+ return ff_core_Pair.Pair(ff_compiler_Unification.InstanceKey(definition_.traitName_, typeName_), ff_compiler_Unification.InstanceValue(definition_.generics_, definition_.constraints_, module_.packagePair_, moduleName_, definition_.traitName_, definition_.typeArguments_))
169
+ }))
170
+ })), ff_compiler_Unification.ff_core_Ordering_Order$ff_compiler_Unification_InstanceKey), ff_core_List.List_toMap(ff_core_List.Empty(), ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int), attemptFixes_)
171
+ }
172
+
173
+ export function Unification_withLocalInstances(self_, instances_, body_) {
174
+ const oldInstances_ = self_.instances_;
175
+ self_.instances_ = ff_core_Map.Map_addAll(self_.instances_, instances_, ff_compiler_Unification.ff_core_Ordering_Order$ff_compiler_Unification_InstanceKey);
176
+ try {
177
+ return body_()
178
+ } finally {
179
+ self_.instances_ = oldInstances_
180
+ }
181
+ }
182
+
183
+ export function Unification_freshUnificationVariable(self_, at_) {
184
+ const result_ = ff_compiler_Syntax.TVariable(at_, self_.nextUnificationVariableIndex_);
185
+ self_.nextUnificationVariableIndex_ += 3;
186
+ return result_
187
+ }
188
+
189
+ export function Unification_instantiate(self_, instantiation_, type_) {
190
+ {
191
+ const self_a = self_;
192
+ const instantiation_a = instantiation_;
193
+ const type_a = type_;
194
+ {
195
+ if(type_a.TConstructor) {
196
+ const at_ = type_a.at_;
197
+ const name_ = type_a.name_;
198
+ if(type_a.generics_.Empty) {
199
+ {
200
+ const _1 = ff_core_Map.Map_get(instantiation_, name_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
201
+ {
202
+ if(_1.Some) {
203
+ const t_ = _1.value_;
204
+ return t_
205
+ return
206
+ }
207
+ }
208
+ {
209
+ if(_1.None) {
210
+ return type_
211
+ return
212
+ }
213
+ }
214
+ }
215
+ return
216
+ }
217
+ }
218
+ }
219
+ {
220
+ if(type_a.TConstructor) {
221
+ const at_ = type_a.at_;
222
+ const name_ = type_a.name_;
223
+ const generics_ = type_a.generics_;
224
+ return ff_compiler_Syntax.TConstructor(at_, name_, ff_core_List.List_map(generics_, ((_w1) => {
225
+ return ff_compiler_Unification.Unification_instantiate(self_, instantiation_, _w1)
226
+ })))
227
+ return
228
+ }
229
+ }
230
+ {
231
+ if(type_a.TVariable) {
232
+ const i_ = type_a.index_;
233
+ const _guard1 = ff_compiler_Unification.Unification_get(self_, i_);
234
+ if(_guard1.Some) {
235
+ const t_ = _guard1.value_;
236
+ return ff_compiler_Unification.Unification_instantiate(self_, instantiation_, t_)
237
+ return
238
+ }
239
+ }
240
+ }
241
+ {
242
+ if(type_a.TVariable) {
243
+ const i_ = type_a.index_;
244
+ return type_
245
+ return
246
+ }
247
+ }
248
+ }
249
+ }
250
+
251
+ export function Unification_instantiateConstraint(self_, instantiation_, constraint_) {
252
+ {
253
+ const self_a = self_;
254
+ const instantiation_a = instantiation_;
255
+ const constraint_a = constraint_;
256
+ {
257
+ const at_ = constraint_a.at_;
258
+ const name_ = constraint_a.name_;
259
+ const generics_ = constraint_a.generics_;
260
+ return ff_compiler_Syntax.Constraint(at_, name_, ff_core_List.List_map(generics_, ((_w1) => {
261
+ return ff_compiler_Unification.Unification_instantiate(self_, instantiation_, _w1)
262
+ })))
263
+ return
264
+ }
265
+ }
266
+ }
267
+
268
+ export function Unification_constrain(self_, at_, type_, constraintName_, generics_) {
269
+ {
270
+ const _1 = type_;
271
+ {
272
+ if(_1.TVariable) {
273
+ const i_ = _1.index_;
274
+ const _guard1 = ff_compiler_Unification.Unification_get(self_, i_);
275
+ if(_guard1.Some) {
276
+ const t_ = _guard1.value_;
277
+ ff_compiler_Unification.Unification_constrain(self_, at_, t_, constraintName_, generics_)
278
+ return
279
+ }
280
+ }
281
+ }
282
+ {
283
+ if(_1.TVariable) {
284
+ const i_ = _1.index_;
285
+ {
286
+ const _1 = ff_core_Map.Map_get(self_.constraints_, i_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int);
287
+ {
288
+ if(_1.None) {
289
+ self_.constraints_ = ff_core_Map.Map_add(self_.constraints_, i_, ff_core_List.List_toMap(ff_core_List.Link(ff_core_Pair.Pair(constraintName_, ff_compiler_Unification.ConstraintGenerics(at_, generics_)), ff_core_List.Empty()), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int)
290
+ return
291
+ }
292
+ }
293
+ {
294
+ if(_1.Some) {
295
+ const map_ = _1.value_;
296
+ {
297
+ const _1 = ff_core_Map.Map_get(map_, constraintName_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
298
+ {
299
+ if(_1.None) {
300
+ const newMap_ = ff_core_Map.Map_add(map_, constraintName_, ff_compiler_Unification.ConstraintGenerics(at_, generics_), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
301
+ self_.constraints_ = ff_core_Map.Map_add(self_.constraints_, i_, newMap_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int)
302
+ return
303
+ }
304
+ }
305
+ {
306
+ if(_1.Some) {
307
+ const generics2_ = _1.value_.generics_;
308
+ ff_core_List.List_each(ff_core_List.List_zip(generics_, generics2_), ((_1) => {
309
+ {
310
+ const t1_ = _1.first_;
311
+ const t2_ = _1.second_;
312
+ ff_compiler_Unification.Unification_unify(self_, at_, t1_, t2_)
313
+ return
314
+ }
315
+ }))
316
+ return
317
+ }
318
+ }
319
+ }
320
+ return
321
+ }
322
+ }
323
+ }
324
+ return
325
+ }
326
+ }
327
+ {
328
+ if(_1.TConstructor) {
329
+ const name_ = _1.name_;
330
+ const generics2_ = _1.generics_;
331
+ {
332
+ const _1 = ff_core_Map.Map_get(self_.instances_, ff_compiler_Unification.InstanceKey(constraintName_, name_), ff_compiler_Unification.ff_core_Ordering_Order$ff_compiler_Unification_InstanceKey);
333
+ {
334
+ if(_1.None) {
335
+ const g1_ = (ff_core_List.List_isEmpty(generics_)
336
+ ? ""
337
+ : "[...]");
338
+ const g2_ = (ff_core_List.List_isEmpty(generics2_)
339
+ ? ""
340
+ : "[...]");
341
+ if((!self_.attemptFixes_)) {
342
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, ((((("No such instance: " + name_) + g2_) + ": ") + constraintName_) + g1_)), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
343
+ }
344
+ return
345
+ }
346
+ }
347
+ {
348
+ if(_1.Some) {
349
+ const definition_ = _1.value_;
350
+ const unificationVariables_ = ff_core_List.List_map(definition_.generics_, ((_) => {
351
+ return ff_compiler_Unification.Unification_freshUnificationVariable(self_, at_)
352
+ }));
353
+ const instantiation_ = ff_core_List.List_toMap(ff_core_List.List_zip(definition_.generics_, unificationVariables_), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
354
+ const traitType1_ = ff_compiler_Unification.Unification_instantiate(self_, instantiation_, ff_compiler_Syntax.TConstructor(at_, definition_.traitName_, definition_.typeArguments_));
355
+ const traitType2_ = ff_compiler_Syntax.TConstructor(at_, constraintName_, ff_core_List.Link(type_, generics_));
356
+ ff_compiler_Unification.Unification_unify(self_, at_, traitType1_, traitType2_);
357
+ ff_core_List.List_each(definition_.constraints_, ((constraint_) => {
358
+ {
359
+ const _1 = ff_compiler_Unification.Unification_instantiateConstraint(self_, instantiation_, constraint_);
360
+ {
361
+ const constraintName_ = _1.name_;
362
+ const newGenerics_ = _1.generics_;
363
+ ff_compiler_Unification.Unification_constrain(self_, at_, ff_core_List.List_grabFirst(newGenerics_), constraintName_, ff_core_List.List_dropFirst(newGenerics_, 1))
364
+ return
365
+ }
366
+ }
367
+ }))
368
+ return
369
+ }
370
+ }
371
+ }
372
+ return
373
+ }
374
+ }
375
+ }
376
+ }
377
+
378
+ export function Unification_get(self_, index_) {
379
+ return ff_core_Option.Option_map(ff_core_Map.Map_get(self_.substitution_, index_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int), ((_1) => {
380
+ {
381
+ if(_1.TVariable) {
382
+ const i_ = _1.index_;
383
+ const _guard1 = ff_core_Map.Map_get(self_.substitution_, i_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int);
384
+ if(_guard1.Some) {
385
+ const t_ = _guard1.value_;
386
+ self_.substitution_ = ff_core_Map.Map_add(self_.substitution_, index_, t_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int);
387
+ return t_
388
+ return
389
+ }
390
+ }
391
+ }
392
+ {
393
+ const t_ = _1;
394
+ return t_
395
+ return
396
+ }
397
+ }))
398
+ }
399
+
400
+ export function Unification_substitute(self_, type_) {
401
+ {
402
+ const self_a = self_;
403
+ const type_a = type_;
404
+ {
405
+ if(type_a.TVariable) {
406
+ const i_ = type_a.index_;
407
+ const _guard1 = ff_compiler_Unification.Unification_get(self_, i_);
408
+ if(_guard1.Some) {
409
+ const t_ = _guard1.value_;
410
+ return ff_compiler_Unification.Unification_substitute(self_, t_)
411
+ return
412
+ }
413
+ }
414
+ }
415
+ {
416
+ if(type_a.TVariable) {
417
+ return type_
418
+ return
419
+ }
420
+ }
421
+ {
422
+ if(type_a.TConstructor) {
423
+ const t_ = type_a;
424
+ {
425
+ const _1 = t_;
426
+ {
427
+ const _c = _1;
428
+ return ff_compiler_Syntax.TConstructor(_c.at_, _c.name_, ff_core_List.List_map(t_.generics_, ((t_) => {
429
+ return ff_compiler_Unification.Unification_substitute(self_, t_)
430
+ })))
431
+ return
432
+ }
433
+ }
434
+ return
435
+ }
436
+ }
437
+ }
438
+ }
439
+
440
+ export function Unification_unify(self_, at_, t1_, t2_) {
441
+ {
442
+ const self_a = self_;
443
+ const at_a = at_;
444
+ const t1_a = t1_;
445
+ const t2_a = t2_;
446
+ {
447
+ if(t1_a.TVariable) {
448
+ const i1_ = t1_a.index_;
449
+ if(t2_a.TVariable) {
450
+ const i2_ = t2_a.index_;
451
+ const _guard1 = (i1_ === i2_);
452
+ if(_guard1) {
453
+
454
+ return
455
+ }
456
+ }
457
+ }
458
+ }
459
+ {
460
+ if(t1_a.TVariable) {
461
+ const i_ = t1_a.index_;
462
+ const _guard1 = ff_compiler_Unification.Unification_get(self_, i_);
463
+ if(_guard1.Some) {
464
+ const t_ = _guard1.value_;
465
+ ff_compiler_Unification.Unification_unify(self_, at_, t_, t2_)
466
+ return
467
+ }
468
+ }
469
+ }
470
+ {
471
+ if(t2_a.TVariable) {
472
+ const i_ = t2_a.index_;
473
+ const _guard1 = ff_compiler_Unification.Unification_get(self_, i_);
474
+ if(_guard1.Some) {
475
+ const t_ = _guard1.value_;
476
+ ff_compiler_Unification.Unification_unify(self_, at_, t1_, t_)
477
+ return
478
+ }
479
+ }
480
+ }
481
+ {
482
+ if(t1_a.TVariable) {
483
+ const i_ = t1_a.index_;
484
+ ff_compiler_Unification.Unification_bind(self_, at_, i_, t2_)
485
+ return
486
+ }
487
+ }
488
+ {
489
+ if(t2_a.TVariable) {
490
+ const i_ = t2_a.index_;
491
+ ff_compiler_Unification.Unification_bind(self_, at_, i_, t1_)
492
+ return
493
+ }
494
+ }
495
+ {
496
+ if(t1_a.TConstructor) {
497
+ const name1_ = t1_a.name_;
498
+ const generics1_ = t1_a.generics_;
499
+ if(t2_a.TConstructor) {
500
+ const name2_ = t2_a.name_;
501
+ const generics2_ = t2_a.generics_;
502
+ if(((name1_ !== name2_) || (ff_core_List.List_size(generics1_) !== ff_core_List.List_size(generics2_)))) {
503
+ if((!self_.attemptFixes_)) {
504
+ const t3_ = ff_compiler_Unification.Unification_substitute(self_, t1_);
505
+ const t4_ = ff_compiler_Unification.Unification_substitute(self_, t2_);
506
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, ((("Type mismatch: " + ff_compiler_Syntax.Type_show(t3_, ff_core_List.Link(t3_, ff_core_List.Link(t4_, ff_core_List.Empty())))) + " vs. ") + ff_compiler_Syntax.Type_show(t4_, ff_core_List.Link(t3_, ff_core_List.Link(t4_, ff_core_List.Empty()))))), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
507
+ } else if((ff_core_String.String_startsWith(name1_, "Function$", 0) && ff_core_String.String_startsWith(name2_, "Function$", 0))) {
508
+ ff_core_List.List_each(ff_core_List.List_zip(ff_core_List.List_dropLast(generics1_, 1), ff_core_List.List_dropLast(generics2_, 1)), ((_1) => {
509
+ {
510
+ const t3_ = _1.first_;
511
+ const t4_ = _1.second_;
512
+ ff_compiler_Unification.Unification_unify(self_, at_, t3_, t4_)
513
+ return
514
+ }
515
+ }));
516
+ ff_core_List.List_each(ff_core_List.List_zip(ff_core_List.List_takeLast(generics1_, 1), ff_core_List.List_takeLast(generics2_, 1)), ((_1) => {
517
+ {
518
+ const t3_ = _1.first_;
519
+ const t4_ = _1.second_;
520
+ ff_compiler_Unification.Unification_unify(self_, at_, t3_, t4_)
521
+ return
522
+ }
523
+ }))
524
+ } else {}
525
+ } else {
526
+ ff_core_List.List_each(ff_core_List.List_zip(generics1_, generics2_), ((_1) => {
527
+ {
528
+ const t1_ = _1.first_;
529
+ const t2_ = _1.second_;
530
+ ff_compiler_Unification.Unification_unify(self_, at_, t1_, t2_)
531
+ return
532
+ }
533
+ }))
534
+ }
535
+ return
536
+ }
537
+ }
538
+ }
539
+ }
540
+ }
541
+
542
+ export function Unification_bind(self_, at_, index_, type_) {
543
+ if(ff_compiler_Unification.Unification_occursIn(self_, index_, type_)) {
544
+ const t_ = ff_compiler_Unification.Unification_substitute(self_, type_);
545
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, ((("Infinite type: " + ff_compiler_Syntax.Type_show(ff_compiler_Syntax.TVariable(at_, index_), ff_core_List.Link(t_, ff_core_List.Empty()))) + " = ") + ff_compiler_Syntax.Type_show(t_, ff_core_List.Empty()))), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
546
+ };
547
+ self_.substitution_ = ff_core_Map.Map_add(self_.substitution_, index_, type_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int);
548
+ ff_core_Option.Option_each(ff_core_Map.Map_get(self_.constraints_, index_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int), ((map_) => {
549
+ self_.constraints_ = ff_core_Map.Map_remove(self_.constraints_, index_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int);
550
+ ff_core_List.List_each(ff_core_Map.Map_pairs(map_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ((_1) => {
551
+ {
552
+ const name_ = _1.first_;
553
+ const at2_ = _1.second_.at_;
554
+ const generics_ = _1.second_.generics_;
555
+ ff_compiler_Unification.Unification_constrain(self_, at2_, type_, name_, generics_)
556
+ return
557
+ }
558
+ }))
559
+ }));
560
+ ff_core_Option.Option_each(ff_core_Map.Map_get(self_.affects_, index_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int), ((affected_) => {
561
+ ff_core_Map.Map_remove(self_.affects_, index_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int);
562
+ ff_core_Set.Set_each(affected_, ((i_) => {
563
+ ff_compiler_Unification.Unification_affect(self_, at_, type_, ff_compiler_Syntax.TVariable(at_, i_))
564
+ }), ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int)
565
+ }))
566
+ }
567
+
568
+ export function Unification_affect(self_, at_, source_, target_) {
569
+ {
570
+ const _1 = ff_core_Pair.Pair(ff_compiler_Unification.Unification_substitute(self_, source_), ff_compiler_Unification.Unification_substitute(self_, target_));
571
+ {
572
+ if(_1.first_.TVariable) {
573
+ const i1_ = _1.first_.index_;
574
+ if(_1.second_.TVariable) {
575
+ const i2_ = _1.second_.index_;
576
+ const is_ = ff_core_Option.Option_else(ff_core_Map.Map_get(self_.affects_, i1_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int), (() => {
577
+ return ff_core_List.List_toSet(ff_core_List.Empty(), ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int)
578
+ }));
579
+ self_.affects_ = ff_core_Map.Map_add(self_.affects_, i1_, ff_core_Set.Set_add(is_, i2_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int), ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int)
580
+ return
581
+ }
582
+ }
583
+ }
584
+ {
585
+ if(_1.second_.TConstructor) {
586
+ if(_1.second_.name_ == "Q$") {
587
+
588
+ return
589
+ }
590
+ }
591
+ }
592
+ {
593
+ if(_1.first_.TConstructor) {
594
+ if(_1.first_.name_ == "ff:core/Nothing.Nothing") {
595
+
596
+ return
597
+ }
598
+ }
599
+ }
600
+ {
601
+ const t1_ = _1.first_;
602
+ const t2_ = _1.second_;
603
+ ff_compiler_Unification.Unification_unify(self_, at_, t1_, t2_)
604
+ return
605
+ }
606
+ }
607
+ }
608
+
609
+ export function Unification_occursIn(self_, index_, t_) {
610
+ {
611
+ const self_a = self_;
612
+ const index_a = index_;
613
+ const t_a = t_;
614
+ {
615
+ if(t_a.TVariable) {
616
+ const i_ = t_a.index_;
617
+ const _guard1 = ff_compiler_Unification.Unification_get(self_, i_);
618
+ if(_guard1.Some) {
619
+ const type_ = _guard1.value_;
620
+ return ff_compiler_Unification.Unification_occursIn(self_, index_, type_)
621
+ return
622
+ }
623
+ }
624
+ }
625
+ {
626
+ if(t_a.TVariable) {
627
+ const i_ = t_a.index_;
628
+ return (i_ === index_)
629
+ return
630
+ }
631
+ }
632
+ {
633
+ if(t_a.TConstructor) {
634
+ const generics_ = t_a.generics_;
635
+ return ff_core_List.List_any(generics_, ((t_) => {
636
+ return ff_compiler_Unification.Unification_occursIn(self_, index_, t_)
637
+ }))
638
+ return
639
+ }
640
+ }
641
+ }
642
+ }
643
+
644
+ export async function Unification_withLocalInstances$(self_, instances_, body_, $task) {
645
+ const oldInstances_ = self_.instances_;
646
+ self_.instances_ = ff_core_Map.Map_addAll(self_.instances_, instances_, ff_compiler_Unification.ff_core_Ordering_Order$ff_compiler_Unification_InstanceKey);
647
+ try {
648
+ return (await body_($task))
649
+ } finally {
650
+ self_.instances_ = oldInstances_
651
+ }
652
+ }
653
+
654
+ export async function Unification_freshUnificationVariable$(self_, at_, $task) {
655
+ const result_ = ff_compiler_Syntax.TVariable(at_, self_.nextUnificationVariableIndex_);
656
+ self_.nextUnificationVariableIndex_ += 3;
657
+ return result_
658
+ }
659
+
660
+ export async function Unification_instantiate$(self_, instantiation_, type_, $task) {
661
+ {
662
+ const self_a = self_;
663
+ const instantiation_a = instantiation_;
664
+ const type_a = type_;
665
+ {
666
+ if(type_a.TConstructor) {
667
+ const at_ = type_a.at_;
668
+ const name_ = type_a.name_;
669
+ if(type_a.generics_.Empty) {
670
+ {
671
+ const _1 = ff_core_Map.Map_get(instantiation_, name_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
672
+ {
673
+ if(_1.Some) {
674
+ const t_ = _1.value_;
675
+ return t_
676
+ return
677
+ }
678
+ }
679
+ {
680
+ if(_1.None) {
681
+ return type_
682
+ return
683
+ }
684
+ }
685
+ }
686
+ return
687
+ }
688
+ }
689
+ }
690
+ {
691
+ if(type_a.TConstructor) {
692
+ const at_ = type_a.at_;
693
+ const name_ = type_a.name_;
694
+ const generics_ = type_a.generics_;
695
+ return ff_compiler_Syntax.TConstructor(at_, name_, ff_core_List.List_map(generics_, ((_w1) => {
696
+ return ff_compiler_Unification.Unification_instantiate(self_, instantiation_, _w1)
697
+ })))
698
+ return
699
+ }
700
+ }
701
+ {
702
+ if(type_a.TVariable) {
703
+ const i_ = type_a.index_;
704
+ const _guard1 = ff_compiler_Unification.Unification_get(self_, i_);
705
+ if(_guard1.Some) {
706
+ const t_ = _guard1.value_;
707
+ return ff_compiler_Unification.Unification_instantiate(self_, instantiation_, t_)
708
+ return
709
+ }
710
+ }
711
+ }
712
+ {
713
+ if(type_a.TVariable) {
714
+ const i_ = type_a.index_;
715
+ return type_
716
+ return
717
+ }
718
+ }
719
+ }
720
+ }
721
+
722
+ export async function Unification_instantiateConstraint$(self_, instantiation_, constraint_, $task) {
723
+ {
724
+ const self_a = self_;
725
+ const instantiation_a = instantiation_;
726
+ const constraint_a = constraint_;
727
+ {
728
+ const at_ = constraint_a.at_;
729
+ const name_ = constraint_a.name_;
730
+ const generics_ = constraint_a.generics_;
731
+ return ff_compiler_Syntax.Constraint(at_, name_, ff_core_List.List_map(generics_, ((_w1) => {
732
+ return ff_compiler_Unification.Unification_instantiate(self_, instantiation_, _w1)
733
+ })))
734
+ return
735
+ }
736
+ }
737
+ }
738
+
739
+ export async function Unification_constrain$(self_, at_, type_, constraintName_, generics_, $task) {
740
+ {
741
+ const _1 = type_;
742
+ {
743
+ if(_1.TVariable) {
744
+ const i_ = _1.index_;
745
+ const _guard1 = ff_compiler_Unification.Unification_get(self_, i_);
746
+ if(_guard1.Some) {
747
+ const t_ = _guard1.value_;
748
+ ff_compiler_Unification.Unification_constrain(self_, at_, t_, constraintName_, generics_)
749
+ return
750
+ }
751
+ }
752
+ }
753
+ {
754
+ if(_1.TVariable) {
755
+ const i_ = _1.index_;
756
+ {
757
+ const _1 = ff_core_Map.Map_get(self_.constraints_, i_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int);
758
+ {
759
+ if(_1.None) {
760
+ self_.constraints_ = ff_core_Map.Map_add(self_.constraints_, i_, ff_core_List.List_toMap(ff_core_List.Link(ff_core_Pair.Pair(constraintName_, ff_compiler_Unification.ConstraintGenerics(at_, generics_)), ff_core_List.Empty()), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int)
761
+ return
762
+ }
763
+ }
764
+ {
765
+ if(_1.Some) {
766
+ const map_ = _1.value_;
767
+ {
768
+ const _1 = ff_core_Map.Map_get(map_, constraintName_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
769
+ {
770
+ if(_1.None) {
771
+ const newMap_ = ff_core_Map.Map_add(map_, constraintName_, ff_compiler_Unification.ConstraintGenerics(at_, generics_), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
772
+ self_.constraints_ = ff_core_Map.Map_add(self_.constraints_, i_, newMap_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int)
773
+ return
774
+ }
775
+ }
776
+ {
777
+ if(_1.Some) {
778
+ const generics2_ = _1.value_.generics_;
779
+ ff_core_List.List_each(ff_core_List.List_zip(generics_, generics2_), ((_1) => {
780
+ {
781
+ const t1_ = _1.first_;
782
+ const t2_ = _1.second_;
783
+ ff_compiler_Unification.Unification_unify(self_, at_, t1_, t2_)
784
+ return
785
+ }
786
+ }))
787
+ return
788
+ }
789
+ }
790
+ }
791
+ return
792
+ }
793
+ }
794
+ }
795
+ return
796
+ }
797
+ }
798
+ {
799
+ if(_1.TConstructor) {
800
+ const name_ = _1.name_;
801
+ const generics2_ = _1.generics_;
802
+ {
803
+ const _1 = ff_core_Map.Map_get(self_.instances_, ff_compiler_Unification.InstanceKey(constraintName_, name_), ff_compiler_Unification.ff_core_Ordering_Order$ff_compiler_Unification_InstanceKey);
804
+ {
805
+ if(_1.None) {
806
+ const g1_ = (ff_core_List.List_isEmpty(generics_)
807
+ ? ""
808
+ : "[...]");
809
+ const g2_ = (ff_core_List.List_isEmpty(generics2_)
810
+ ? ""
811
+ : "[...]");
812
+ if((!self_.attemptFixes_)) {
813
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, ((((("No such instance: " + name_) + g2_) + ": ") + constraintName_) + g1_)), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
814
+ }
815
+ return
816
+ }
817
+ }
818
+ {
819
+ if(_1.Some) {
820
+ const definition_ = _1.value_;
821
+ const unificationVariables_ = ff_core_List.List_map(definition_.generics_, ((_) => {
822
+ return ff_compiler_Unification.Unification_freshUnificationVariable(self_, at_)
823
+ }));
824
+ const instantiation_ = ff_core_List.List_toMap(ff_core_List.List_zip(definition_.generics_, unificationVariables_), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
825
+ const traitType1_ = ff_compiler_Unification.Unification_instantiate(self_, instantiation_, ff_compiler_Syntax.TConstructor(at_, definition_.traitName_, definition_.typeArguments_));
826
+ const traitType2_ = ff_compiler_Syntax.TConstructor(at_, constraintName_, ff_core_List.Link(type_, generics_));
827
+ ff_compiler_Unification.Unification_unify(self_, at_, traitType1_, traitType2_);
828
+ ff_core_List.List_each(definition_.constraints_, ((constraint_) => {
829
+ {
830
+ const _1 = ff_compiler_Unification.Unification_instantiateConstraint(self_, instantiation_, constraint_);
831
+ {
832
+ const constraintName_ = _1.name_;
833
+ const newGenerics_ = _1.generics_;
834
+ ff_compiler_Unification.Unification_constrain(self_, at_, ff_core_List.List_grabFirst(newGenerics_), constraintName_, ff_core_List.List_dropFirst(newGenerics_, 1))
835
+ return
836
+ }
837
+ }
838
+ }))
839
+ return
840
+ }
841
+ }
842
+ }
843
+ return
844
+ }
845
+ }
846
+ }
847
+ }
848
+
849
+ export async function Unification_get$(self_, index_, $task) {
850
+ return ff_core_Option.Option_map(ff_core_Map.Map_get(self_.substitution_, index_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int), ((_1) => {
851
+ {
852
+ if(_1.TVariable) {
853
+ const i_ = _1.index_;
854
+ const _guard1 = ff_core_Map.Map_get(self_.substitution_, i_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int);
855
+ if(_guard1.Some) {
856
+ const t_ = _guard1.value_;
857
+ self_.substitution_ = ff_core_Map.Map_add(self_.substitution_, index_, t_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int);
858
+ return t_
859
+ return
860
+ }
861
+ }
862
+ }
863
+ {
864
+ const t_ = _1;
865
+ return t_
866
+ return
867
+ }
868
+ }))
869
+ }
870
+
871
+ export async function Unification_substitute$(self_, type_, $task) {
872
+ {
873
+ const self_a = self_;
874
+ const type_a = type_;
875
+ {
876
+ if(type_a.TVariable) {
877
+ const i_ = type_a.index_;
878
+ const _guard1 = ff_compiler_Unification.Unification_get(self_, i_);
879
+ if(_guard1.Some) {
880
+ const t_ = _guard1.value_;
881
+ return ff_compiler_Unification.Unification_substitute(self_, t_)
882
+ return
883
+ }
884
+ }
885
+ }
886
+ {
887
+ if(type_a.TVariable) {
888
+ return type_
889
+ return
890
+ }
891
+ }
892
+ {
893
+ if(type_a.TConstructor) {
894
+ const t_ = type_a;
895
+ {
896
+ const _1 = t_;
897
+ {
898
+ const _c = _1;
899
+ return ff_compiler_Syntax.TConstructor(_c.at_, _c.name_, ff_core_List.List_map(t_.generics_, ((t_) => {
900
+ return ff_compiler_Unification.Unification_substitute(self_, t_)
901
+ })))
902
+ return
903
+ }
904
+ }
905
+ return
906
+ }
907
+ }
908
+ }
909
+ }
910
+
911
+ export async function Unification_unify$(self_, at_, t1_, t2_, $task) {
912
+ {
913
+ const self_a = self_;
914
+ const at_a = at_;
915
+ const t1_a = t1_;
916
+ const t2_a = t2_;
917
+ {
918
+ if(t1_a.TVariable) {
919
+ const i1_ = t1_a.index_;
920
+ if(t2_a.TVariable) {
921
+ const i2_ = t2_a.index_;
922
+ const _guard1 = (i1_ === i2_);
923
+ if(_guard1) {
924
+
925
+ return
926
+ }
927
+ }
928
+ }
929
+ }
930
+ {
931
+ if(t1_a.TVariable) {
932
+ const i_ = t1_a.index_;
933
+ const _guard1 = ff_compiler_Unification.Unification_get(self_, i_);
934
+ if(_guard1.Some) {
935
+ const t_ = _guard1.value_;
936
+ ff_compiler_Unification.Unification_unify(self_, at_, t_, t2_)
937
+ return
938
+ }
939
+ }
940
+ }
941
+ {
942
+ if(t2_a.TVariable) {
943
+ const i_ = t2_a.index_;
944
+ const _guard1 = ff_compiler_Unification.Unification_get(self_, i_);
945
+ if(_guard1.Some) {
946
+ const t_ = _guard1.value_;
947
+ ff_compiler_Unification.Unification_unify(self_, at_, t1_, t_)
948
+ return
949
+ }
950
+ }
951
+ }
952
+ {
953
+ if(t1_a.TVariable) {
954
+ const i_ = t1_a.index_;
955
+ ff_compiler_Unification.Unification_bind(self_, at_, i_, t2_)
956
+ return
957
+ }
958
+ }
959
+ {
960
+ if(t2_a.TVariable) {
961
+ const i_ = t2_a.index_;
962
+ ff_compiler_Unification.Unification_bind(self_, at_, i_, t1_)
963
+ return
964
+ }
965
+ }
966
+ {
967
+ if(t1_a.TConstructor) {
968
+ const name1_ = t1_a.name_;
969
+ const generics1_ = t1_a.generics_;
970
+ if(t2_a.TConstructor) {
971
+ const name2_ = t2_a.name_;
972
+ const generics2_ = t2_a.generics_;
973
+ if(((name1_ !== name2_) || (ff_core_List.List_size(generics1_) !== ff_core_List.List_size(generics2_)))) {
974
+ if((!self_.attemptFixes_)) {
975
+ const t3_ = ff_compiler_Unification.Unification_substitute(self_, t1_);
976
+ const t4_ = ff_compiler_Unification.Unification_substitute(self_, t2_);
977
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, ((("Type mismatch: " + ff_compiler_Syntax.Type_show(t3_, ff_core_List.Link(t3_, ff_core_List.Link(t4_, ff_core_List.Empty())))) + " vs. ") + ff_compiler_Syntax.Type_show(t4_, ff_core_List.Link(t3_, ff_core_List.Link(t4_, ff_core_List.Empty()))))), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
978
+ } else if((ff_core_String.String_startsWith(name1_, "Function$", 0) && ff_core_String.String_startsWith(name2_, "Function$", 0))) {
979
+ ff_core_List.List_each(ff_core_List.List_zip(ff_core_List.List_dropLast(generics1_, 1), ff_core_List.List_dropLast(generics2_, 1)), ((_1) => {
980
+ {
981
+ const t3_ = _1.first_;
982
+ const t4_ = _1.second_;
983
+ ff_compiler_Unification.Unification_unify(self_, at_, t3_, t4_)
984
+ return
985
+ }
986
+ }));
987
+ ff_core_List.List_each(ff_core_List.List_zip(ff_core_List.List_takeLast(generics1_, 1), ff_core_List.List_takeLast(generics2_, 1)), ((_1) => {
988
+ {
989
+ const t3_ = _1.first_;
990
+ const t4_ = _1.second_;
991
+ ff_compiler_Unification.Unification_unify(self_, at_, t3_, t4_)
992
+ return
993
+ }
994
+ }))
995
+ } else {}
996
+ } else {
997
+ ff_core_List.List_each(ff_core_List.List_zip(generics1_, generics2_), ((_1) => {
998
+ {
999
+ const t1_ = _1.first_;
1000
+ const t2_ = _1.second_;
1001
+ ff_compiler_Unification.Unification_unify(self_, at_, t1_, t2_)
1002
+ return
1003
+ }
1004
+ }))
1005
+ }
1006
+ return
1007
+ }
1008
+ }
1009
+ }
1010
+ }
1011
+ }
1012
+
1013
+ export async function Unification_bind$(self_, at_, index_, type_, $task) {
1014
+ if(ff_compiler_Unification.Unification_occursIn(self_, index_, type_)) {
1015
+ const t_ = ff_compiler_Unification.Unification_substitute(self_, type_);
1016
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, ((("Infinite type: " + ff_compiler_Syntax.Type_show(ff_compiler_Syntax.TVariable(at_, index_), ff_core_List.Link(t_, ff_core_List.Empty()))) + " = ") + ff_compiler_Syntax.Type_show(t_, ff_core_List.Empty()))), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
1017
+ };
1018
+ self_.substitution_ = ff_core_Map.Map_add(self_.substitution_, index_, type_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int);
1019
+ ff_core_Option.Option_each(ff_core_Map.Map_get(self_.constraints_, index_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int), ((map_) => {
1020
+ self_.constraints_ = ff_core_Map.Map_remove(self_.constraints_, index_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int);
1021
+ ff_core_List.List_each(ff_core_Map.Map_pairs(map_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ((_1) => {
1022
+ {
1023
+ const name_ = _1.first_;
1024
+ const at2_ = _1.second_.at_;
1025
+ const generics_ = _1.second_.generics_;
1026
+ ff_compiler_Unification.Unification_constrain(self_, at2_, type_, name_, generics_)
1027
+ return
1028
+ }
1029
+ }))
1030
+ }));
1031
+ ff_core_Option.Option_each(ff_core_Map.Map_get(self_.affects_, index_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int), ((affected_) => {
1032
+ ff_core_Map.Map_remove(self_.affects_, index_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int);
1033
+ ff_core_Set.Set_each(affected_, ((i_) => {
1034
+ ff_compiler_Unification.Unification_affect(self_, at_, type_, ff_compiler_Syntax.TVariable(at_, i_))
1035
+ }), ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int)
1036
+ }))
1037
+ }
1038
+
1039
+ export async function Unification_affect$(self_, at_, source_, target_, $task) {
1040
+ {
1041
+ const _1 = ff_core_Pair.Pair(ff_compiler_Unification.Unification_substitute(self_, source_), ff_compiler_Unification.Unification_substitute(self_, target_));
1042
+ {
1043
+ if(_1.first_.TVariable) {
1044
+ const i1_ = _1.first_.index_;
1045
+ if(_1.second_.TVariable) {
1046
+ const i2_ = _1.second_.index_;
1047
+ const is_ = ff_core_Option.Option_else(ff_core_Map.Map_get(self_.affects_, i1_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int), (() => {
1048
+ return ff_core_List.List_toSet(ff_core_List.Empty(), ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int)
1049
+ }));
1050
+ self_.affects_ = ff_core_Map.Map_add(self_.affects_, i1_, ff_core_Set.Set_add(is_, i2_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int), ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int)
1051
+ return
1052
+ }
1053
+ }
1054
+ }
1055
+ {
1056
+ if(_1.second_.TConstructor) {
1057
+ if(_1.second_.name_ == "Q$") {
1058
+
1059
+ return
1060
+ }
1061
+ }
1062
+ }
1063
+ {
1064
+ if(_1.first_.TConstructor) {
1065
+ if(_1.first_.name_ == "ff:core/Nothing.Nothing") {
1066
+
1067
+ return
1068
+ }
1069
+ }
1070
+ }
1071
+ {
1072
+ const t1_ = _1.first_;
1073
+ const t2_ = _1.second_;
1074
+ ff_compiler_Unification.Unification_unify(self_, at_, t1_, t2_)
1075
+ return
1076
+ }
1077
+ }
1078
+ }
1079
+
1080
+ export async function Unification_occursIn$(self_, index_, t_, $task) {
1081
+ {
1082
+ const self_a = self_;
1083
+ const index_a = index_;
1084
+ const t_a = t_;
1085
+ {
1086
+ if(t_a.TVariable) {
1087
+ const i_ = t_a.index_;
1088
+ const _guard1 = ff_compiler_Unification.Unification_get(self_, i_);
1089
+ if(_guard1.Some) {
1090
+ const type_ = _guard1.value_;
1091
+ return ff_compiler_Unification.Unification_occursIn(self_, index_, type_)
1092
+ return
1093
+ }
1094
+ }
1095
+ }
1096
+ {
1097
+ if(t_a.TVariable) {
1098
+ const i_ = t_a.index_;
1099
+ return (i_ === index_)
1100
+ return
1101
+ }
1102
+ }
1103
+ {
1104
+ if(t_a.TConstructor) {
1105
+ const generics_ = t_a.generics_;
1106
+ return ff_core_List.List_any(generics_, ((t_) => {
1107
+ return ff_compiler_Unification.Unification_occursIn(self_, index_, t_)
1108
+ }))
1109
+ return
1110
+ }
1111
+ }
1112
+ }
1113
+ }
1114
+
1115
+ export const ff_core_Any_HasAnyTag$ff_compiler_Unification_ConstraintGenerics = {
1116
+ anyTag_() {
1117
+ return ff_core_Any.internalAnyTag_((("ff:compiler/Unification.ConstraintGenerics" + "[") + "]"))
1118
+ },
1119
+ async anyTag_$($task) {
1120
+ return ff_core_Any.internalAnyTag_((("ff:compiler/Unification.ConstraintGenerics" + "[") + "]"))
1121
+ }
1122
+ };
1123
+
1124
+ export const ff_core_Any_HasAnyTag$ff_compiler_Unification_InstanceKey = {
1125
+ anyTag_() {
1126
+ return ff_core_Any.internalAnyTag_((("ff:compiler/Unification.InstanceKey" + "[") + "]"))
1127
+ },
1128
+ async anyTag_$($task) {
1129
+ return ff_core_Any.internalAnyTag_((("ff:compiler/Unification.InstanceKey" + "[") + "]"))
1130
+ }
1131
+ };
1132
+
1133
+ export const ff_core_Any_HasAnyTag$ff_compiler_Unification_InstanceValue = {
1134
+ anyTag_() {
1135
+ return ff_core_Any.internalAnyTag_((("ff:compiler/Unification.InstanceValue" + "[") + "]"))
1136
+ },
1137
+ async anyTag_$($task) {
1138
+ return ff_core_Any.internalAnyTag_((("ff:compiler/Unification.InstanceValue" + "[") + "]"))
1139
+ }
1140
+ };
1141
+
1142
+ export const ff_core_Show_Show$ff_compiler_Unification_ConstraintGenerics = {
1143
+ show_(value_) {
1144
+ {
1145
+ const value_a = value_;
1146
+ {
1147
+ const z_ = value_a;
1148
+ return ((((("ConstraintGenerics" + "(") + ff_compiler_Syntax.ff_core_Show_Show$ff_compiler_Syntax_Location.show_(z_.at_)) + ", ") + ff_core_Show.ff_core_Show_Show$ff_core_List_List(ff_compiler_Syntax.ff_core_Show_Show$ff_compiler_Syntax_Type).show_(z_.generics_)) + ")")
1149
+ return
1150
+ }
1151
+ }
1152
+ },
1153
+ async show_$(value_, $task) {
1154
+ {
1155
+ const value_a = value_;
1156
+ {
1157
+ const z_ = value_a;
1158
+ return ((((("ConstraintGenerics" + "(") + ff_compiler_Syntax.ff_core_Show_Show$ff_compiler_Syntax_Location.show_(z_.at_)) + ", ") + ff_core_Show.ff_core_Show_Show$ff_core_List_List(ff_compiler_Syntax.ff_core_Show_Show$ff_compiler_Syntax_Type).show_(z_.generics_)) + ")")
1159
+ return
1160
+ }
1161
+ }
1162
+ }
1163
+ };
1164
+
1165
+ export const ff_core_Show_Show$ff_compiler_Unification_InstanceKey = {
1166
+ show_(value_) {
1167
+ {
1168
+ const value_a = value_;
1169
+ {
1170
+ const z_ = value_a;
1171
+ return ((((("InstanceKey" + "(") + ff_core_Show.ff_core_Show_Show$ff_core_String_String.show_(z_.traitName_)) + ", ") + ff_core_Show.ff_core_Show_Show$ff_core_String_String.show_(z_.typeName_)) + ")")
1172
+ return
1173
+ }
1174
+ }
1175
+ },
1176
+ async show_$(value_, $task) {
1177
+ {
1178
+ const value_a = value_;
1179
+ {
1180
+ const z_ = value_a;
1181
+ return ((((("InstanceKey" + "(") + ff_core_Show.ff_core_Show_Show$ff_core_String_String.show_(z_.traitName_)) + ", ") + ff_core_Show.ff_core_Show_Show$ff_core_String_String.show_(z_.typeName_)) + ")")
1182
+ return
1183
+ }
1184
+ }
1185
+ }
1186
+ };
1187
+
1188
+ export const ff_core_Show_Show$ff_compiler_Unification_InstanceValue = {
1189
+ show_(value_) {
1190
+ {
1191
+ const value_a = value_;
1192
+ {
1193
+ const z_ = value_a;
1194
+ return ((((((((((((("InstanceValue" + "(") + ff_core_Show.ff_core_Show_Show$ff_core_List_List(ff_core_Show.ff_core_Show_Show$ff_core_String_String).show_(z_.generics_)) + ", ") + ff_core_Show.ff_core_Show_Show$ff_core_List_List(ff_compiler_Syntax.ff_core_Show_Show$ff_compiler_Syntax_Constraint).show_(z_.constraints_)) + ", ") + ff_compiler_Syntax.ff_core_Show_Show$ff_compiler_Syntax_PackagePair.show_(z_.packagePair_)) + ", ") + ff_core_Show.ff_core_Show_Show$ff_core_String_String.show_(z_.moduleName_)) + ", ") + ff_core_Show.ff_core_Show_Show$ff_core_String_String.show_(z_.traitName_)) + ", ") + ff_core_Show.ff_core_Show_Show$ff_core_List_List(ff_compiler_Syntax.ff_core_Show_Show$ff_compiler_Syntax_Type).show_(z_.typeArguments_)) + ")")
1195
+ return
1196
+ }
1197
+ }
1198
+ },
1199
+ async show_$(value_, $task) {
1200
+ {
1201
+ const value_a = value_;
1202
+ {
1203
+ const z_ = value_a;
1204
+ return ((((((((((((("InstanceValue" + "(") + ff_core_Show.ff_core_Show_Show$ff_core_List_List(ff_core_Show.ff_core_Show_Show$ff_core_String_String).show_(z_.generics_)) + ", ") + ff_core_Show.ff_core_Show_Show$ff_core_List_List(ff_compiler_Syntax.ff_core_Show_Show$ff_compiler_Syntax_Constraint).show_(z_.constraints_)) + ", ") + ff_compiler_Syntax.ff_core_Show_Show$ff_compiler_Syntax_PackagePair.show_(z_.packagePair_)) + ", ") + ff_core_Show.ff_core_Show_Show$ff_core_String_String.show_(z_.moduleName_)) + ", ") + ff_core_Show.ff_core_Show_Show$ff_core_String_String.show_(z_.traitName_)) + ", ") + ff_core_Show.ff_core_Show_Show$ff_core_List_List(ff_compiler_Syntax.ff_core_Show_Show$ff_compiler_Syntax_Type).show_(z_.typeArguments_)) + ")")
1205
+ return
1206
+ }
1207
+ }
1208
+ }
1209
+ };
1210
+
1211
+ export const ff_core_Equal_Equal$ff_compiler_Unification_ConstraintGenerics = {
1212
+ equals_(x_, y_) {
1213
+ {
1214
+ const x_a = x_;
1215
+ const y_a = y_;
1216
+ {
1217
+ const _guard1 = (x_ === y_);
1218
+ if(_guard1) {
1219
+ return true
1220
+ return
1221
+ }
1222
+ }
1223
+ {
1224
+ return (ff_compiler_Syntax.ff_core_Equal_Equal$ff_compiler_Syntax_Location.equals_(x_.at_, y_.at_) && ff_core_List.ff_core_Equal_Equal$ff_core_List_List(ff_compiler_Syntax.ff_core_Equal_Equal$ff_compiler_Syntax_Type).equals_(x_.generics_, y_.generics_))
1225
+ return
1226
+ }
1227
+ }
1228
+ },
1229
+ async equals_$(x_, y_, $task) {
1230
+ {
1231
+ const x_a = x_;
1232
+ const y_a = y_;
1233
+ {
1234
+ const _guard1 = (x_ === y_);
1235
+ if(_guard1) {
1236
+ return true
1237
+ return
1238
+ }
1239
+ }
1240
+ {
1241
+ return (ff_compiler_Syntax.ff_core_Equal_Equal$ff_compiler_Syntax_Location.equals_(x_.at_, y_.at_) && ff_core_List.ff_core_Equal_Equal$ff_core_List_List(ff_compiler_Syntax.ff_core_Equal_Equal$ff_compiler_Syntax_Type).equals_(x_.generics_, y_.generics_))
1242
+ return
1243
+ }
1244
+ }
1245
+ }
1246
+ };
1247
+
1248
+ export const ff_core_Equal_Equal$ff_compiler_Unification_InstanceKey = {
1249
+ equals_(x_, y_) {
1250
+ {
1251
+ const x_a = x_;
1252
+ const y_a = y_;
1253
+ {
1254
+ const _guard1 = (x_ === y_);
1255
+ if(_guard1) {
1256
+ return true
1257
+ return
1258
+ }
1259
+ }
1260
+ {
1261
+ return ((x_.traitName_ === y_.traitName_) && (x_.typeName_ === y_.typeName_))
1262
+ return
1263
+ }
1264
+ }
1265
+ },
1266
+ async equals_$(x_, y_, $task) {
1267
+ {
1268
+ const x_a = x_;
1269
+ const y_a = y_;
1270
+ {
1271
+ const _guard1 = (x_ === y_);
1272
+ if(_guard1) {
1273
+ return true
1274
+ return
1275
+ }
1276
+ }
1277
+ {
1278
+ return ((x_.traitName_ === y_.traitName_) && (x_.typeName_ === y_.typeName_))
1279
+ return
1280
+ }
1281
+ }
1282
+ }
1283
+ };
1284
+
1285
+ export const ff_core_Equal_Equal$ff_compiler_Unification_InstanceValue = {
1286
+ equals_(x_, y_) {
1287
+ {
1288
+ const x_a = x_;
1289
+ const y_a = y_;
1290
+ {
1291
+ const _guard1 = (x_ === y_);
1292
+ if(_guard1) {
1293
+ return true
1294
+ return
1295
+ }
1296
+ }
1297
+ {
1298
+ return (ff_core_List.ff_core_Equal_Equal$ff_core_List_List(ff_core_Equal.ff_core_Equal_Equal$ff_core_String_String).equals_(x_.generics_, y_.generics_) && (ff_core_List.ff_core_Equal_Equal$ff_core_List_List(ff_compiler_Syntax.ff_core_Equal_Equal$ff_compiler_Syntax_Constraint).equals_(x_.constraints_, y_.constraints_) && (ff_compiler_Syntax.ff_core_Equal_Equal$ff_compiler_Syntax_PackagePair.equals_(x_.packagePair_, y_.packagePair_) && ((x_.moduleName_ === y_.moduleName_) && ((x_.traitName_ === y_.traitName_) && ff_core_List.ff_core_Equal_Equal$ff_core_List_List(ff_compiler_Syntax.ff_core_Equal_Equal$ff_compiler_Syntax_Type).equals_(x_.typeArguments_, y_.typeArguments_))))))
1299
+ return
1300
+ }
1301
+ }
1302
+ },
1303
+ async equals_$(x_, y_, $task) {
1304
+ {
1305
+ const x_a = x_;
1306
+ const y_a = y_;
1307
+ {
1308
+ const _guard1 = (x_ === y_);
1309
+ if(_guard1) {
1310
+ return true
1311
+ return
1312
+ }
1313
+ }
1314
+ {
1315
+ return (ff_core_List.ff_core_Equal_Equal$ff_core_List_List(ff_core_Equal.ff_core_Equal_Equal$ff_core_String_String).equals_(x_.generics_, y_.generics_) && (ff_core_List.ff_core_Equal_Equal$ff_core_List_List(ff_compiler_Syntax.ff_core_Equal_Equal$ff_compiler_Syntax_Constraint).equals_(x_.constraints_, y_.constraints_) && (ff_compiler_Syntax.ff_core_Equal_Equal$ff_compiler_Syntax_PackagePair.equals_(x_.packagePair_, y_.packagePair_) && ((x_.moduleName_ === y_.moduleName_) && ((x_.traitName_ === y_.traitName_) && ff_core_List.ff_core_Equal_Equal$ff_core_List_List(ff_compiler_Syntax.ff_core_Equal_Equal$ff_compiler_Syntax_Type).equals_(x_.typeArguments_, y_.typeArguments_))))))
1316
+ return
1317
+ }
1318
+ }
1319
+ }
1320
+ };
1321
+
1322
+ export const ff_core_Ordering_Order$ff_compiler_Unification_ConstraintGenerics = {
1323
+ compare_(x_, y_) {
1324
+ {
1325
+ const x_a = x_;
1326
+ const y_a = y_;
1327
+ {
1328
+ const _guard1 = (x_ === y_);
1329
+ if(_guard1) {
1330
+ return ff_core_Ordering.OrderingSame()
1331
+ return
1332
+ }
1333
+ }
1334
+ {
1335
+ const atOrdering_ = ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_Location.compare_(x_.at_, y_.at_);
1336
+ if((atOrdering_ !== ff_core_Ordering.OrderingSame())) {
1337
+ return atOrdering_
1338
+ } else {
1339
+ const genericsOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_List_List(ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_Type).compare_(x_.generics_, y_.generics_);
1340
+ if((genericsOrdering_ !== ff_core_Ordering.OrderingSame())) {
1341
+ return genericsOrdering_
1342
+ } else {
1343
+ return ff_core_Ordering.OrderingSame()
1344
+ }
1345
+ }
1346
+ return
1347
+ }
1348
+ }
1349
+ },
1350
+ async compare_$(x_, y_, $task) {
1351
+ {
1352
+ const x_a = x_;
1353
+ const y_a = y_;
1354
+ {
1355
+ const _guard1 = (x_ === y_);
1356
+ if(_guard1) {
1357
+ return ff_core_Ordering.OrderingSame()
1358
+ return
1359
+ }
1360
+ }
1361
+ {
1362
+ const atOrdering_ = ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_Location.compare_(x_.at_, y_.at_);
1363
+ if((atOrdering_ !== ff_core_Ordering.OrderingSame())) {
1364
+ return atOrdering_
1365
+ } else {
1366
+ const genericsOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_List_List(ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_Type).compare_(x_.generics_, y_.generics_);
1367
+ if((genericsOrdering_ !== ff_core_Ordering.OrderingSame())) {
1368
+ return genericsOrdering_
1369
+ } else {
1370
+ return ff_core_Ordering.OrderingSame()
1371
+ }
1372
+ }
1373
+ return
1374
+ }
1375
+ }
1376
+ }
1377
+ };
1378
+
1379
+ export const ff_core_Ordering_Order$ff_compiler_Unification_InstanceKey = {
1380
+ compare_(x_, y_) {
1381
+ {
1382
+ const x_a = x_;
1383
+ const y_a = y_;
1384
+ {
1385
+ const _guard1 = (x_ === y_);
1386
+ if(_guard1) {
1387
+ return ff_core_Ordering.OrderingSame()
1388
+ return
1389
+ }
1390
+ }
1391
+ {
1392
+ const traitNameOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String.compare_(x_.traitName_, y_.traitName_);
1393
+ if((traitNameOrdering_ !== ff_core_Ordering.OrderingSame())) {
1394
+ return traitNameOrdering_
1395
+ } else {
1396
+ const typeNameOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String.compare_(x_.typeName_, y_.typeName_);
1397
+ if((typeNameOrdering_ !== ff_core_Ordering.OrderingSame())) {
1398
+ return typeNameOrdering_
1399
+ } else {
1400
+ return ff_core_Ordering.OrderingSame()
1401
+ }
1402
+ }
1403
+ return
1404
+ }
1405
+ }
1406
+ },
1407
+ async compare_$(x_, y_, $task) {
1408
+ {
1409
+ const x_a = x_;
1410
+ const y_a = y_;
1411
+ {
1412
+ const _guard1 = (x_ === y_);
1413
+ if(_guard1) {
1414
+ return ff_core_Ordering.OrderingSame()
1415
+ return
1416
+ }
1417
+ }
1418
+ {
1419
+ const traitNameOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String.compare_(x_.traitName_, y_.traitName_);
1420
+ if((traitNameOrdering_ !== ff_core_Ordering.OrderingSame())) {
1421
+ return traitNameOrdering_
1422
+ } else {
1423
+ const typeNameOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String.compare_(x_.typeName_, y_.typeName_);
1424
+ if((typeNameOrdering_ !== ff_core_Ordering.OrderingSame())) {
1425
+ return typeNameOrdering_
1426
+ } else {
1427
+ return ff_core_Ordering.OrderingSame()
1428
+ }
1429
+ }
1430
+ return
1431
+ }
1432
+ }
1433
+ }
1434
+ };
1435
+
1436
+ export const ff_core_Ordering_Order$ff_compiler_Unification_InstanceValue = {
1437
+ compare_(x_, y_) {
1438
+ {
1439
+ const x_a = x_;
1440
+ const y_a = y_;
1441
+ {
1442
+ const _guard1 = (x_ === y_);
1443
+ if(_guard1) {
1444
+ return ff_core_Ordering.OrderingSame()
1445
+ return
1446
+ }
1447
+ }
1448
+ {
1449
+ const genericsOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_List_List(ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String).compare_(x_.generics_, y_.generics_);
1450
+ if((genericsOrdering_ !== ff_core_Ordering.OrderingSame())) {
1451
+ return genericsOrdering_
1452
+ } else {
1453
+ const constraintsOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_List_List(ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_Constraint).compare_(x_.constraints_, y_.constraints_);
1454
+ if((constraintsOrdering_ !== ff_core_Ordering.OrderingSame())) {
1455
+ return constraintsOrdering_
1456
+ } else {
1457
+ const packagePairOrdering_ = ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair.compare_(x_.packagePair_, y_.packagePair_);
1458
+ if((packagePairOrdering_ !== ff_core_Ordering.OrderingSame())) {
1459
+ return packagePairOrdering_
1460
+ } else {
1461
+ const moduleNameOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String.compare_(x_.moduleName_, y_.moduleName_);
1462
+ if((moduleNameOrdering_ !== ff_core_Ordering.OrderingSame())) {
1463
+ return moduleNameOrdering_
1464
+ } else {
1465
+ const traitNameOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String.compare_(x_.traitName_, y_.traitName_);
1466
+ if((traitNameOrdering_ !== ff_core_Ordering.OrderingSame())) {
1467
+ return traitNameOrdering_
1468
+ } else {
1469
+ const typeArgumentsOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_List_List(ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_Type).compare_(x_.typeArguments_, y_.typeArguments_);
1470
+ if((typeArgumentsOrdering_ !== ff_core_Ordering.OrderingSame())) {
1471
+ return typeArgumentsOrdering_
1472
+ } else {
1473
+ return ff_core_Ordering.OrderingSame()
1474
+ }
1475
+ }
1476
+ }
1477
+ }
1478
+ }
1479
+ }
1480
+ return
1481
+ }
1482
+ }
1483
+ },
1484
+ async compare_$(x_, y_, $task) {
1485
+ {
1486
+ const x_a = x_;
1487
+ const y_a = y_;
1488
+ {
1489
+ const _guard1 = (x_ === y_);
1490
+ if(_guard1) {
1491
+ return ff_core_Ordering.OrderingSame()
1492
+ return
1493
+ }
1494
+ }
1495
+ {
1496
+ const genericsOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_List_List(ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String).compare_(x_.generics_, y_.generics_);
1497
+ if((genericsOrdering_ !== ff_core_Ordering.OrderingSame())) {
1498
+ return genericsOrdering_
1499
+ } else {
1500
+ const constraintsOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_List_List(ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_Constraint).compare_(x_.constraints_, y_.constraints_);
1501
+ if((constraintsOrdering_ !== ff_core_Ordering.OrderingSame())) {
1502
+ return constraintsOrdering_
1503
+ } else {
1504
+ const packagePairOrdering_ = ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair.compare_(x_.packagePair_, y_.packagePair_);
1505
+ if((packagePairOrdering_ !== ff_core_Ordering.OrderingSame())) {
1506
+ return packagePairOrdering_
1507
+ } else {
1508
+ const moduleNameOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String.compare_(x_.moduleName_, y_.moduleName_);
1509
+ if((moduleNameOrdering_ !== ff_core_Ordering.OrderingSame())) {
1510
+ return moduleNameOrdering_
1511
+ } else {
1512
+ const traitNameOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String.compare_(x_.traitName_, y_.traitName_);
1513
+ if((traitNameOrdering_ !== ff_core_Ordering.OrderingSame())) {
1514
+ return traitNameOrdering_
1515
+ } else {
1516
+ const typeArgumentsOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_List_List(ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_Type).compare_(x_.typeArguments_, y_.typeArguments_);
1517
+ if((typeArgumentsOrdering_ !== ff_core_Ordering.OrderingSame())) {
1518
+ return typeArgumentsOrdering_
1519
+ } else {
1520
+ return ff_core_Ordering.OrderingSame()
1521
+ }
1522
+ }
1523
+ }
1524
+ }
1525
+ }
1526
+ }
1527
+ return
1528
+ }
1529
+ }
1530
+ }
1531
+ };
1532
+
1533
+ export const ff_core_Serializable_Serializable$ff_compiler_Unification_ConstraintGenerics = {
1534
+ serializeUsing_(serialization_, value_) {
1535
+ {
1536
+ const serialization_a = serialization_;
1537
+ const value_a = value_;
1538
+ {
1539
+ const v_ = value_a;
1540
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 42), 0);
1541
+ ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 0);
1542
+ serialization_.offset_ += 1;
1543
+ ff_compiler_Syntax.ff_core_Serializable_Serializable$ff_compiler_Syntax_Location.serializeUsing_(serialization_, v_.at_);
1544
+ ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_compiler_Syntax.ff_core_Serializable_Serializable$ff_compiler_Syntax_Type).serializeUsing_(serialization_, v_.generics_)
1545
+ return
1546
+ }
1547
+ }
1548
+ },
1549
+ deserializeUsing_(serialization_) {
1550
+ const variantIndex_ = ff_core_Buffer.Buffer_grabUint8(serialization_.buffer_, serialization_.offset_);
1551
+ serialization_.offset_ += 1;
1552
+ {
1553
+ const _1 = variantIndex_;
1554
+ {
1555
+ if(_1 == 0) {
1556
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 42), 0);
1557
+ return ff_compiler_Unification.ConstraintGenerics(ff_compiler_Syntax.ff_core_Serializable_Serializable$ff_compiler_Syntax_Location.deserializeUsing_(serialization_), ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_compiler_Syntax.ff_core_Serializable_Serializable$ff_compiler_Syntax_Type).deserializeUsing_(serialization_))
1558
+ return
1559
+ }
1560
+ }
1561
+ {
1562
+ 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)})
1563
+ return
1564
+ }
1565
+ }
1566
+ },
1567
+ async serializeUsing_$(serialization_, value_, $task) {
1568
+ {
1569
+ const serialization_a = serialization_;
1570
+ const value_a = value_;
1571
+ {
1572
+ const v_ = value_a;
1573
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 42), 0);
1574
+ ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 0);
1575
+ serialization_.offset_ += 1;
1576
+ ff_compiler_Syntax.ff_core_Serializable_Serializable$ff_compiler_Syntax_Location.serializeUsing_(serialization_, v_.at_);
1577
+ ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_compiler_Syntax.ff_core_Serializable_Serializable$ff_compiler_Syntax_Type).serializeUsing_(serialization_, v_.generics_)
1578
+ return
1579
+ }
1580
+ }
1581
+ },
1582
+ async deserializeUsing_$(serialization_, $task) {
1583
+ const variantIndex_ = ff_core_Buffer.Buffer_grabUint8(serialization_.buffer_, serialization_.offset_);
1584
+ serialization_.offset_ += 1;
1585
+ {
1586
+ const _1 = variantIndex_;
1587
+ {
1588
+ if(_1 == 0) {
1589
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 42), 0);
1590
+ return ff_compiler_Unification.ConstraintGenerics(ff_compiler_Syntax.ff_core_Serializable_Serializable$ff_compiler_Syntax_Location.deserializeUsing_(serialization_), ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_compiler_Syntax.ff_core_Serializable_Serializable$ff_compiler_Syntax_Type).deserializeUsing_(serialization_))
1591
+ return
1592
+ }
1593
+ }
1594
+ {
1595
+ 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)})
1596
+ return
1597
+ }
1598
+ }
1599
+ }
1600
+ };
1601
+
1602
+ export const ff_core_Serializable_Serializable$ff_compiler_Unification_InstanceKey = {
1603
+ serializeUsing_(serialization_, value_) {
1604
+ {
1605
+ const serialization_a = serialization_;
1606
+ const value_a = value_;
1607
+ {
1608
+ const v_ = value_a;
1609
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 35), 0);
1610
+ ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 0);
1611
+ serialization_.offset_ += 1;
1612
+ ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.serializeUsing_(serialization_, v_.traitName_);
1613
+ ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.serializeUsing_(serialization_, v_.typeName_)
1614
+ return
1615
+ }
1616
+ }
1617
+ },
1618
+ deserializeUsing_(serialization_) {
1619
+ const variantIndex_ = ff_core_Buffer.Buffer_grabUint8(serialization_.buffer_, serialization_.offset_);
1620
+ serialization_.offset_ += 1;
1621
+ {
1622
+ const _1 = variantIndex_;
1623
+ {
1624
+ if(_1 == 0) {
1625
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 35), 0);
1626
+ return ff_compiler_Unification.InstanceKey(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.deserializeUsing_(serialization_), ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.deserializeUsing_(serialization_))
1627
+ return
1628
+ }
1629
+ }
1630
+ {
1631
+ 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)})
1632
+ return
1633
+ }
1634
+ }
1635
+ },
1636
+ async serializeUsing_$(serialization_, value_, $task) {
1637
+ {
1638
+ const serialization_a = serialization_;
1639
+ const value_a = value_;
1640
+ {
1641
+ const v_ = value_a;
1642
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 35), 0);
1643
+ ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 0);
1644
+ serialization_.offset_ += 1;
1645
+ ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.serializeUsing_(serialization_, v_.traitName_);
1646
+ ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.serializeUsing_(serialization_, v_.typeName_)
1647
+ return
1648
+ }
1649
+ }
1650
+ },
1651
+ async deserializeUsing_$(serialization_, $task) {
1652
+ const variantIndex_ = ff_core_Buffer.Buffer_grabUint8(serialization_.buffer_, serialization_.offset_);
1653
+ serialization_.offset_ += 1;
1654
+ {
1655
+ const _1 = variantIndex_;
1656
+ {
1657
+ if(_1 == 0) {
1658
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 35), 0);
1659
+ return ff_compiler_Unification.InstanceKey(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.deserializeUsing_(serialization_), ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.deserializeUsing_(serialization_))
1660
+ return
1661
+ }
1662
+ }
1663
+ {
1664
+ 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)})
1665
+ return
1666
+ }
1667
+ }
1668
+ }
1669
+ };
1670
+
1671
+ export const ff_core_Serializable_Serializable$ff_compiler_Unification_InstanceValue = {
1672
+ serializeUsing_(serialization_, value_) {
1673
+ {
1674
+ const serialization_a = serialization_;
1675
+ const value_a = value_;
1676
+ {
1677
+ const v_ = value_a;
1678
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 37), 0);
1679
+ ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 0);
1680
+ serialization_.offset_ += 1;
1681
+ ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String).serializeUsing_(serialization_, v_.generics_);
1682
+ ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_compiler_Syntax.ff_core_Serializable_Serializable$ff_compiler_Syntax_Constraint).serializeUsing_(serialization_, v_.constraints_);
1683
+ ff_compiler_Syntax.ff_core_Serializable_Serializable$ff_compiler_Syntax_PackagePair.serializeUsing_(serialization_, v_.packagePair_);
1684
+ ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.serializeUsing_(serialization_, v_.moduleName_);
1685
+ ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.serializeUsing_(serialization_, v_.traitName_);
1686
+ ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_compiler_Syntax.ff_core_Serializable_Serializable$ff_compiler_Syntax_Type).serializeUsing_(serialization_, v_.typeArguments_)
1687
+ return
1688
+ }
1689
+ }
1690
+ },
1691
+ deserializeUsing_(serialization_) {
1692
+ const variantIndex_ = ff_core_Buffer.Buffer_grabUint8(serialization_.buffer_, serialization_.offset_);
1693
+ serialization_.offset_ += 1;
1694
+ {
1695
+ const _1 = variantIndex_;
1696
+ {
1697
+ if(_1 == 0) {
1698
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 37), 0);
1699
+ return ff_compiler_Unification.InstanceValue(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String).deserializeUsing_(serialization_), ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_compiler_Syntax.ff_core_Serializable_Serializable$ff_compiler_Syntax_Constraint).deserializeUsing_(serialization_), ff_compiler_Syntax.ff_core_Serializable_Serializable$ff_compiler_Syntax_PackagePair.deserializeUsing_(serialization_), ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.deserializeUsing_(serialization_), ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.deserializeUsing_(serialization_), ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_compiler_Syntax.ff_core_Serializable_Serializable$ff_compiler_Syntax_Type).deserializeUsing_(serialization_))
1700
+ return
1701
+ }
1702
+ }
1703
+ {
1704
+ 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)})
1705
+ return
1706
+ }
1707
+ }
1708
+ },
1709
+ async serializeUsing_$(serialization_, value_, $task) {
1710
+ {
1711
+ const serialization_a = serialization_;
1712
+ const value_a = value_;
1713
+ {
1714
+ const v_ = value_a;
1715
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 37), 0);
1716
+ ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 0);
1717
+ serialization_.offset_ += 1;
1718
+ ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String).serializeUsing_(serialization_, v_.generics_);
1719
+ ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_compiler_Syntax.ff_core_Serializable_Serializable$ff_compiler_Syntax_Constraint).serializeUsing_(serialization_, v_.constraints_);
1720
+ ff_compiler_Syntax.ff_core_Serializable_Serializable$ff_compiler_Syntax_PackagePair.serializeUsing_(serialization_, v_.packagePair_);
1721
+ ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.serializeUsing_(serialization_, v_.moduleName_);
1722
+ ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.serializeUsing_(serialization_, v_.traitName_);
1723
+ ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_compiler_Syntax.ff_core_Serializable_Serializable$ff_compiler_Syntax_Type).serializeUsing_(serialization_, v_.typeArguments_)
1724
+ return
1725
+ }
1726
+ }
1727
+ },
1728
+ async deserializeUsing_$(serialization_, $task) {
1729
+ const variantIndex_ = ff_core_Buffer.Buffer_grabUint8(serialization_.buffer_, serialization_.offset_);
1730
+ serialization_.offset_ += 1;
1731
+ {
1732
+ const _1 = variantIndex_;
1733
+ {
1734
+ if(_1 == 0) {
1735
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 37), 0);
1736
+ return ff_compiler_Unification.InstanceValue(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String).deserializeUsing_(serialization_), ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_compiler_Syntax.ff_core_Serializable_Serializable$ff_compiler_Syntax_Constraint).deserializeUsing_(serialization_), ff_compiler_Syntax.ff_core_Serializable_Serializable$ff_compiler_Syntax_PackagePair.deserializeUsing_(serialization_), ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.deserializeUsing_(serialization_), ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.deserializeUsing_(serialization_), ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_compiler_Syntax.ff_core_Serializable_Serializable$ff_compiler_Syntax_Type).deserializeUsing_(serialization_))
1737
+ return
1738
+ }
1739
+ }
1740
+ {
1741
+ 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)})
1742
+ return
1743
+ }
1744
+ }
1745
+ }
1746
+ };
1747
+
1748
+