firefly-compiler 0.4.21 → 0.4.23
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.
- package/compiler/Dictionaries.ff +10 -10
- package/compiler/Inference.ff +167 -148
- package/compiler/JsEmitter.ff +2 -2
- package/compiler/LspHook.ff +2 -1
- package/compiler/Main.ff +12 -4
- package/compiler/Patterns.ff +1 -1
- package/compiler/Resolver.ff +154 -146
- package/compiler/Substitution.ff +2 -2
- package/compiler/Unification.ff +1 -1
- package/core/Map.ff +8 -0
- package/core/Set.ff +7 -0
- package/lsp/Handler.ff +11 -3
- package/output/js/ff/compiler/Dictionaries.mjs +18 -18
- package/output/js/ff/compiler/Inference.mjs +182 -88
- package/output/js/ff/compiler/JsEmitter.mjs +8 -6
- package/output/js/ff/compiler/LspHook.mjs +4 -2
- package/output/js/ff/compiler/Main.mjs +16 -5
- package/output/js/ff/compiler/Patterns.mjs +4 -4
- package/output/js/ff/compiler/Resolver.mjs +372 -202
- package/output/js/ff/compiler/Substitution.mjs +4 -4
- package/output/js/ff/compiler/Unification.mjs +4 -4
- package/output/js/ff/core/Map.mjs +26 -0
- package/output/js/ff/core/Set.mjs +16 -0
- package/package.json +1 -1
- package/vscode/package.json +1 -1
- package/bin/firefly.mjs +0 -2
- package/guide/Main.ff +0 -22
|
@@ -513,8 +513,8 @@ const t_ = type_a;
|
|
|
513
513
|
const _1 = t_;
|
|
514
514
|
{
|
|
515
515
|
const _c = _1;
|
|
516
|
-
return ff_compiler_Syntax.TConstructor(_c.at_, _c.name_, ff_core_List.List_map(t_.generics_, ((
|
|
517
|
-
return ff_compiler_Substitution.Substitution_substituteType(self_,
|
|
516
|
+
return ff_compiler_Syntax.TConstructor(_c.at_, _c.name_, ff_core_List.List_map(t_.generics_, ((g_) => {
|
|
517
|
+
return ff_compiler_Substitution.Substitution_substituteType(self_, g_)
|
|
518
518
|
})))
|
|
519
519
|
return
|
|
520
520
|
}
|
|
@@ -953,8 +953,8 @@ const t_ = type_a;
|
|
|
953
953
|
const _1 = t_;
|
|
954
954
|
{
|
|
955
955
|
const _c = _1;
|
|
956
|
-
return ff_compiler_Syntax.TConstructor(_c.at_, _c.name_, ff_core_List.List_map(t_.generics_, ((
|
|
957
|
-
return ff_compiler_Substitution.Substitution_substituteType(self_,
|
|
956
|
+
return ff_compiler_Syntax.TConstructor(_c.at_, _c.name_, ff_core_List.List_map(t_.generics_, ((g_) => {
|
|
957
|
+
return ff_compiler_Substitution.Substitution_substituteType(self_, g_)
|
|
958
958
|
})))
|
|
959
959
|
return
|
|
960
960
|
}
|
|
@@ -367,8 +367,8 @@ const t_ = type_a;
|
|
|
367
367
|
const _1 = t_;
|
|
368
368
|
{
|
|
369
369
|
const _c = _1;
|
|
370
|
-
return ff_compiler_Syntax.TConstructor(_c.at_, _c.name_, ff_core_List.List_map(t_.generics_, ((
|
|
371
|
-
return ff_compiler_Unification.Unification_substitute(self_,
|
|
370
|
+
return ff_compiler_Syntax.TConstructor(_c.at_, _c.name_, ff_core_List.List_map(t_.generics_, ((g_) => {
|
|
371
|
+
return ff_compiler_Unification.Unification_substitute(self_, g_)
|
|
372
372
|
})))
|
|
373
373
|
return
|
|
374
374
|
}
|
|
@@ -743,8 +743,8 @@ const t_ = type_a;
|
|
|
743
743
|
const _1 = t_;
|
|
744
744
|
{
|
|
745
745
|
const _c = _1;
|
|
746
|
-
return ff_compiler_Syntax.TConstructor(_c.at_, _c.name_, ff_core_List.List_map(t_.generics_, ((
|
|
747
|
-
return ff_compiler_Unification.Unification_substitute(self_,
|
|
746
|
+
return ff_compiler_Syntax.TConstructor(_c.at_, _c.name_, ff_core_List.List_map(t_.generics_, ((g_) => {
|
|
747
|
+
return ff_compiler_Unification.Unification_substitute(self_, g_)
|
|
748
748
|
})))
|
|
749
749
|
return
|
|
750
750
|
}
|
|
@@ -116,6 +116,19 @@ result_ = ff_core_RbMap.insert_(k_, v_, result_, ff_core_Ordering_Order$K)
|
|
|
116
116
|
return result_
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
+
export function Map_addList(self_, that_, ff_core_Ordering_Order$K) {
|
|
120
|
+
let result_ = self_;
|
|
121
|
+
ff_core_List.List_each(that_, ((_1) => {
|
|
122
|
+
{
|
|
123
|
+
const k_ = _1.first_;
|
|
124
|
+
const v_ = _1.second_;
|
|
125
|
+
result_ = ff_core_RbMap.insert_(k_, v_, result_, ff_core_Ordering_Order$K)
|
|
126
|
+
return
|
|
127
|
+
}
|
|
128
|
+
}));
|
|
129
|
+
return result_
|
|
130
|
+
}
|
|
131
|
+
|
|
119
132
|
export function Map_get(self_, key_, ff_core_Ordering_Order$K) {
|
|
120
133
|
return ff_core_RbMap.RB_get(self_, key_, ff_core_Ordering_Order$K)
|
|
121
134
|
}
|
|
@@ -213,6 +226,19 @@ result_ = ff_core_RbMap.insert_(k_, v_, result_, ff_core_Ordering_Order$K)
|
|
|
213
226
|
return result_
|
|
214
227
|
}
|
|
215
228
|
|
|
229
|
+
export async function Map_addList$(self_, that_, ff_core_Ordering_Order$K, $task) {
|
|
230
|
+
let result_ = self_;
|
|
231
|
+
ff_core_List.List_each(that_, ((_1) => {
|
|
232
|
+
{
|
|
233
|
+
const k_ = _1.first_;
|
|
234
|
+
const v_ = _1.second_;
|
|
235
|
+
result_ = ff_core_RbMap.insert_(k_, v_, result_, ff_core_Ordering_Order$K)
|
|
236
|
+
return
|
|
237
|
+
}
|
|
238
|
+
}));
|
|
239
|
+
return result_
|
|
240
|
+
}
|
|
241
|
+
|
|
216
242
|
export async function Map_get$(self_, key_, ff_core_Ordering_Order$K, $task) {
|
|
217
243
|
return ff_core_RbMap.RB_get(self_, key_, ff_core_Ordering_Order$K)
|
|
218
244
|
}
|
|
@@ -110,6 +110,14 @@ export function Set_addAll(self_, that_, ff_core_Ordering_Order$T) {
|
|
|
110
110
|
return ff_core_Map.Map_addAll(self_, that_, ff_core_Ordering_Order$T)
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
+
export function Set_addList(self_, that_, ff_core_Ordering_Order$T) {
|
|
114
|
+
let result_ = self_;
|
|
115
|
+
ff_core_List.List_each(that_, ((k_) => {
|
|
116
|
+
result_ = ff_core_Map.Map_add(result_, k_, (void 0), ff_core_Ordering_Order$T)
|
|
117
|
+
}));
|
|
118
|
+
return result_
|
|
119
|
+
}
|
|
120
|
+
|
|
113
121
|
export function Set_remove(self_, value_, ff_core_Ordering_Order$T) {
|
|
114
122
|
return ff_core_Map.Map_remove(self_, value_, ff_core_Ordering_Order$T)
|
|
115
123
|
}
|
|
@@ -166,6 +174,14 @@ export async function Set_addAll$(self_, that_, ff_core_Ordering_Order$T, $task)
|
|
|
166
174
|
return ff_core_Map.Map_addAll(self_, that_, ff_core_Ordering_Order$T)
|
|
167
175
|
}
|
|
168
176
|
|
|
177
|
+
export async function Set_addList$(self_, that_, ff_core_Ordering_Order$T, $task) {
|
|
178
|
+
let result_ = self_;
|
|
179
|
+
ff_core_List.List_each(that_, ((k_) => {
|
|
180
|
+
result_ = ff_core_Map.Map_add(result_, k_, (void 0), ff_core_Ordering_Order$T)
|
|
181
|
+
}));
|
|
182
|
+
return result_
|
|
183
|
+
}
|
|
184
|
+
|
|
169
185
|
export async function Set_remove$(self_, value_, ff_core_Ordering_Order$T, $task) {
|
|
170
186
|
return ff_core_Map.Map_remove(self_, value_, ff_core_Ordering_Order$T)
|
|
171
187
|
}
|
package/package.json
CHANGED
package/vscode/package.json
CHANGED
package/bin/firefly.mjs
DELETED
package/guide/Main.ff
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
nodeMain(system: NodeSystem) {
|
|
2
|
-
|
|
3
|
-
//let lines = system.path("data.txt").readText().lines()
|
|
4
|
-
let lines = [
|
|
5
|
-
"Monday: 22.5"
|
|
6
|
-
"Tuesday: 25.7"
|
|
7
|
-
"Wednesday: 23.9"
|
|
8
|
-
"Thursday: 22.4"
|
|
9
|
-
"Friday: 20.3"
|
|
10
|
-
""
|
|
11
|
-
"Saturday: 16.2"
|
|
12
|
-
"Sunday: 21.1 "
|
|
13
|
-
]
|
|
14
|
-
let pairs = lines.map {_.split(':')}.collect {
|
|
15
|
-
| [day, temp] => Some(Pair(day.trim(), temp.trim().grabFloat()))
|
|
16
|
-
| _ => None
|
|
17
|
-
}
|
|
18
|
-
let remaining = pairs.map {_.second}.sort().dropFirst().dropLast()
|
|
19
|
-
let average = remaining.foldLeft(0.0) {_ + _} / remaining.size()
|
|
20
|
-
system.writeLine("Average temperature: " + average)
|
|
21
|
-
|
|
22
|
-
}
|