firefly-compiler 0.4.17 → 0.4.19
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/Builder.ff +1 -1
- package/compiler/Compiler.ff +6 -5
- package/compiler/Inference.ff +31 -19
- package/compiler/JsEmitter.ff +98 -71
- package/compiler/JsImporter.ff +1 -1
- package/compiler/LspHook.ff +4 -4
- package/compiler/Main.ff +6 -6
- package/compiler/Parser.ff +39 -39
- package/compiler/Patterns.ff +2 -0
- package/compiler/Syntax.ff +1 -1
- package/compiler/Tokenizer.ff +2 -2
- package/compiler/Workspace.ff +2 -2
- package/core/Array.ff +135 -294
- package/core/Buffer.ff +3 -3
- package/core/BuildSystem.ff +1 -1
- package/core/Equal.ff +36 -52
- package/core/HttpClient.ff +1 -1
- package/core/IntMap.ff +14 -18
- package/core/JsSystem.ff +1 -1
- package/core/JsValue.ff +6 -12
- package/core/Json.ff +19 -28
- package/core/List.ff +281 -312
- package/core/Map.ff +4 -8
- package/core/NodeSystem.ff +2 -2
- package/core/Option.ff +0 -4
- package/core/Ordering.ff +10 -6
- package/core/Pair.ff +0 -4
- package/core/Random.ff +12 -26
- package/core/RbMap.ff +216 -216
- package/core/Serializable.ff +9 -18
- package/core/Set.ff +0 -1
- package/core/SourceLocation.ff +1 -1
- package/core/Stack.ff +32 -45
- package/core/Stream.ff +10 -14
- package/core/String.ff +24 -6
- package/core/StringMap.ff +15 -19
- package/guide/Main.ff +20 -2
- package/lsp/CompletionHandler.ff +4 -4
- package/lsp/Handler.ff +45 -34
- package/lsp/HoverHandler.ff +2 -2
- package/lsp/LanguageServer.ff +2 -2
- package/lsp/SignatureHelpHandler.ff +1 -1
- package/lsp/SymbolHandler.ff +1 -1
- package/lux/Lux.ff +3 -3
- package/output/js/ff/compiler/Builder.mjs +19 -21
- package/output/js/ff/compiler/Compiler.mjs +18 -20
- package/output/js/ff/compiler/Dependencies.mjs +8 -10
- package/output/js/ff/compiler/Deriver.mjs +234 -236
- package/output/js/ff/compiler/Dictionaries.mjs +6 -8
- package/output/js/ff/compiler/Environment.mjs +42 -44
- package/output/js/ff/compiler/Inference.mjs +346 -304
- package/output/js/ff/compiler/JsEmitter.mjs +907 -833
- package/output/js/ff/compiler/JsImporter.mjs +0 -2
- package/output/js/ff/compiler/LspHook.mjs +10 -12
- package/output/js/ff/compiler/Main.mjs +109 -111
- package/output/js/ff/compiler/Parser.mjs +405 -407
- package/output/js/ff/compiler/Patterns.mjs +64 -50
- package/output/js/ff/compiler/Resolver.mjs +36 -38
- package/output/js/ff/compiler/Substitution.mjs +4 -6
- package/output/js/ff/compiler/Syntax.mjs +160 -162
- package/output/js/ff/compiler/Token.mjs +52 -54
- package/output/js/ff/compiler/Tokenizer.mjs +16 -18
- package/output/js/ff/compiler/Unification.mjs +24 -26
- package/output/js/ff/compiler/Wildcards.mjs +0 -2
- package/output/js/ff/compiler/Workspace.mjs +18 -20
- package/output/js/ff/core/Any.mjs +0 -2
- package/output/js/ff/core/Array.mjs +216 -613
- package/output/js/ff/core/AssetSystem.mjs +2 -4
- package/output/js/ff/core/Atomic.mjs +0 -2
- package/output/js/ff/core/Bool.mjs +0 -2
- package/output/js/ff/core/Box.mjs +0 -2
- package/output/js/ff/core/BrowserSystem.mjs +0 -2
- package/output/js/ff/core/Buffer.mjs +0 -2
- package/output/js/ff/core/BuildSystem.mjs +12 -14
- package/output/js/ff/core/Channel.mjs +0 -2
- package/output/js/ff/core/Char.mjs +0 -2
- package/output/js/ff/core/Core.mjs +0 -2
- package/output/js/ff/core/Duration.mjs +0 -2
- package/output/js/ff/core/Equal.mjs +0 -22
- package/output/js/ff/core/Error.mjs +0 -2
- package/output/js/ff/core/FileHandle.mjs +0 -2
- package/output/js/ff/core/Float.mjs +0 -2
- package/output/js/ff/core/HttpClient.mjs +2 -4
- package/output/js/ff/core/Instant.mjs +0 -2
- package/output/js/ff/core/Int.mjs +8 -10
- package/output/js/ff/core/IntMap.mjs +32 -42
- package/output/js/ff/core/JsSystem.mjs +1 -3
- package/output/js/ff/core/JsValue.mjs +5 -12
- package/output/js/ff/core/Json.mjs +23 -56
- package/output/js/ff/core/List.mjs +648 -1989
- package/output/js/ff/core/Lock.mjs +0 -2
- package/output/js/ff/core/Log.mjs +0 -2
- package/output/js/ff/core/Map.mjs +10 -20
- package/output/js/ff/core/NodeSystem.mjs +6 -8
- package/output/js/ff/core/Nothing.mjs +0 -2
- package/output/js/ff/core/Option.mjs +8 -18
- package/output/js/ff/core/Ordering.mjs +20 -98
- package/output/js/ff/core/Pair.mjs +6 -16
- package/output/js/ff/core/Path.mjs +12 -14
- package/output/js/ff/core/Random.mjs +24 -54
- package/output/js/ff/core/RbMap.mjs +54 -56
- package/output/js/ff/core/Serializable.mjs +19 -36
- package/output/js/ff/core/Set.mjs +0 -14
- package/output/js/ff/core/Show.mjs +0 -2
- package/output/js/ff/core/SourceLocation.mjs +0 -2
- package/output/js/ff/core/Stream.mjs +34 -44
- package/output/js/ff/core/String.mjs +31 -5
- package/output/js/ff/core/StringMap.mjs +32 -42
- package/output/js/ff/core/Task.mjs +0 -2
- package/output/js/ff/core/Try.mjs +0 -2
- package/output/js/ff/core/Unit.mjs +0 -2
- package/package.json +1 -1
- package/vscode/package.json +1 -1
- package/webserver/WebServer.ff +8 -8
- package/output/js/ff/core/Stack.mjs +0 -603
|
@@ -78,8 +78,6 @@ import * as ff_core_Show from "../../ff/core/Show.mjs"
|
|
|
78
78
|
|
|
79
79
|
import * as ff_core_SourceLocation from "../../ff/core/SourceLocation.mjs"
|
|
80
80
|
|
|
81
|
-
import * as ff_core_Stack from "../../ff/core/Stack.mjs"
|
|
82
|
-
|
|
83
81
|
import * as ff_core_Stream from "../../ff/core/Stream.mjs"
|
|
84
82
|
|
|
85
83
|
import * as ff_core_String from "../../ff/core/String.mjs"
|
|
@@ -97,36 +95,58 @@ import * as ff_core_Unit from "../../ff/core/Unit.mjs"
|
|
|
97
95
|
|
|
98
96
|
|
|
99
97
|
|
|
100
|
-
export function
|
|
101
|
-
|
|
102
|
-
return [];
|
|
103
|
-
|
|
98
|
+
export function make_() {
|
|
99
|
+
return {array: []}
|
|
104
100
|
}
|
|
105
101
|
|
|
106
102
|
export function fill_(size_, value_) {
|
|
107
103
|
|
|
108
|
-
return new Array(size_).fill(value_);
|
|
104
|
+
return {array: new Array(size_).fill(value_)};
|
|
109
105
|
|
|
110
106
|
}
|
|
111
107
|
|
|
112
108
|
export function fillBy_(size_, body_) {
|
|
113
109
|
|
|
114
|
-
return Array.from({length: size_}, (_, i) => body_(i));
|
|
110
|
+
return {array: Array.from({length: size_}, (_, i) => body_(i))};
|
|
115
111
|
|
|
116
112
|
}
|
|
117
113
|
|
|
118
114
|
export function range_(size_) {
|
|
119
115
|
|
|
120
|
-
return Array.from({length: size_}, (_, i) => i);
|
|
116
|
+
return {array: Array.from({length: size_}, (_, i) => i)};
|
|
121
117
|
|
|
122
118
|
}
|
|
123
119
|
|
|
124
|
-
export function
|
|
125
|
-
|
|
120
|
+
export function sortRange_(array_, compare_, start_, end_) {
|
|
121
|
+
if(((end_ - start_) < 2)) {
|
|
122
|
+
|
|
123
|
+
} else {
|
|
124
|
+
let middle_ = (start_ + ((end_ - start_) / 2));
|
|
125
|
+
ff_core_Array.sortRange_(array_, compare_, start_, middle_);
|
|
126
|
+
ff_core_Array.sortRange_(array_, compare_, middle_, end_);
|
|
127
|
+
let i_ = start_;
|
|
128
|
+
let j_ = middle_;
|
|
129
|
+
while(((i_ < middle_) && (j_ < end_))) {
|
|
130
|
+
if((compare_(ff_core_Array.Array_grab(array_, i_), ff_core_Array.Array_grab(array_, j_)) !== ff_core_Ordering.OrderingAfter())) {
|
|
131
|
+
i_ += 1
|
|
132
|
+
} else {
|
|
133
|
+
const value_ = ff_core_Array.Array_grab(array_, j_);
|
|
134
|
+
let k_ = j_;
|
|
135
|
+
while((k_ > i_)) {
|
|
136
|
+
ff_core_Array.Array_set(array_, k_, ff_core_Array.Array_grab(array_, (k_ - 1)));
|
|
137
|
+
k_ -= 1
|
|
138
|
+
};
|
|
139
|
+
ff_core_Array.Array_set(array_, i_, value_);
|
|
140
|
+
i_ += 1;
|
|
141
|
+
middle_ += 1;
|
|
142
|
+
j_ += 1
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
126
146
|
}
|
|
127
147
|
|
|
128
|
-
export async function
|
|
129
|
-
throw new Error('Function
|
|
148
|
+
export async function make_$($task) {
|
|
149
|
+
throw new Error('Function make is missing on this target in async context.');
|
|
130
150
|
}
|
|
131
151
|
|
|
132
152
|
export async function fill_$(size_, value_, $task) {
|
|
@@ -134,60 +154,66 @@ throw new Error('Function fill is missing on this target in async context.');
|
|
|
134
154
|
}
|
|
135
155
|
|
|
136
156
|
export async function fillBy_$(size_, body_, $task) {
|
|
137
|
-
|
|
138
|
-
const array = new Array(size_);
|
|
139
|
-
for(let i = 0; i < size_; i++) {
|
|
140
|
-
array[i] = await(body_(_i));
|
|
141
|
-
}
|
|
142
|
-
return array;
|
|
143
|
-
|
|
157
|
+
throw new Error('Function fillBy is missing on this target in async context.');
|
|
144
158
|
}
|
|
145
159
|
|
|
146
160
|
export async function range_$(size_, $task) {
|
|
147
161
|
throw new Error('Function range is missing on this target in async context.');
|
|
148
162
|
}
|
|
149
163
|
|
|
150
|
-
export async function
|
|
151
|
-
|
|
152
|
-
}
|
|
164
|
+
export async function sortRange_$(array_, compare_, start_, end_, $task) {
|
|
165
|
+
if(((end_ - start_) < 2)) {
|
|
153
166
|
|
|
154
|
-
|
|
155
|
-
|
|
167
|
+
} else {
|
|
168
|
+
let middle_ = (start_ + ((end_ - start_) / 2));
|
|
169
|
+
(await ff_core_Array.sortRange_$(array_, compare_, start_, middle_, $task));
|
|
170
|
+
(await ff_core_Array.sortRange_$(array_, compare_, middle_, end_, $task));
|
|
171
|
+
let i_ = start_;
|
|
172
|
+
let j_ = middle_;
|
|
173
|
+
while(((i_ < middle_) && (j_ < end_))) {
|
|
174
|
+
if(((await compare_(ff_core_Array.Array_grab(array_, i_), ff_core_Array.Array_grab(array_, j_), $task)) !== ff_core_Ordering.OrderingAfter())) {
|
|
175
|
+
i_ += 1
|
|
176
|
+
} else {
|
|
177
|
+
const value_ = ff_core_Array.Array_grab(array_, j_);
|
|
178
|
+
let k_ = j_;
|
|
179
|
+
while((k_ > i_)) {
|
|
180
|
+
ff_core_Array.Array_set(array_, k_, ff_core_Array.Array_grab(array_, (k_ - 1)));
|
|
181
|
+
k_ -= 1
|
|
182
|
+
};
|
|
183
|
+
ff_core_Array.Array_set(array_, i_, value_);
|
|
184
|
+
i_ += 1;
|
|
185
|
+
middle_ += 1;
|
|
186
|
+
j_ += 1
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
156
190
|
}
|
|
157
191
|
|
|
158
192
|
export function Array_isEmpty(self_) {
|
|
159
|
-
return self_.length === 0
|
|
193
|
+
return self_.array.length === 0
|
|
160
194
|
}
|
|
161
195
|
|
|
162
196
|
export function Array_size(self_) {
|
|
163
|
-
return self_.length
|
|
197
|
+
return self_.array.length
|
|
164
198
|
}
|
|
165
199
|
|
|
166
200
|
export function Array_get(self_, index_) {
|
|
167
201
|
|
|
168
|
-
return index_ >= 0 && index_ < self_.length
|
|
169
|
-
? ff_core_Option.Some(self_[index_])
|
|
202
|
+
return index_ >= 0 && index_ < self_.array.length
|
|
203
|
+
? ff_core_Option.Some(self_.array[index_])
|
|
170
204
|
: ff_core_Option.None()
|
|
171
205
|
|
|
172
206
|
}
|
|
173
207
|
|
|
174
208
|
export function Array_grab(self_, index_) {
|
|
175
209
|
|
|
176
|
-
if(index_ < 0 || index_ >= self_.length) {
|
|
210
|
+
if(index_ < 0 || index_ >= self_.array.length) {
|
|
177
211
|
ff_core_Try.internalThrowGrabException_()
|
|
178
212
|
}
|
|
179
|
-
return self_[index_]
|
|
213
|
+
return self_.array[index_]
|
|
180
214
|
|
|
181
215
|
}
|
|
182
216
|
|
|
183
|
-
export function Array_first(self_) {
|
|
184
|
-
return ff_core_Array.Array_get(self_, 0)
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
export function Array_last(self_) {
|
|
188
|
-
return ff_core_Array.Array_get(self_, (ff_core_Array.Array_size(self_) - 1))
|
|
189
|
-
}
|
|
190
|
-
|
|
191
217
|
export function Array_grabFirst(self_) {
|
|
192
218
|
return ff_core_Array.Array_grab(self_, 0)
|
|
193
219
|
}
|
|
@@ -196,144 +222,110 @@ export function Array_grabLast(self_) {
|
|
|
196
222
|
return ff_core_Array.Array_grab(self_, (ff_core_Array.Array_size(self_) - 1))
|
|
197
223
|
}
|
|
198
224
|
|
|
199
|
-
export function
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
225
|
+
export function Array_first(self_) {
|
|
226
|
+
|
|
227
|
+
return self_.array.length > 0
|
|
228
|
+
? ff_core_Option.Some(self_.array[0])
|
|
229
|
+
: ff_core_Option.None()
|
|
230
|
+
|
|
205
231
|
}
|
|
206
232
|
|
|
207
|
-
export function
|
|
208
|
-
|
|
233
|
+
export function Array_last(self_) {
|
|
234
|
+
|
|
235
|
+
return self_.array.length > 0
|
|
236
|
+
? ff_core_Option.Some(self_.array[self_.array.length - 1])
|
|
237
|
+
: ff_core_Option.None()
|
|
238
|
+
|
|
209
239
|
}
|
|
210
240
|
|
|
211
|
-
export function
|
|
212
|
-
|
|
241
|
+
export function Array_push(self_, value_) {
|
|
242
|
+
self_.array.push(value_)
|
|
213
243
|
}
|
|
214
244
|
|
|
215
|
-
export function
|
|
216
|
-
|
|
217
|
-
return ff_core_Array.Array_map(self_, ((x_) => {
|
|
218
|
-
const r_ = ff_core_Pair.Pair(i_, x_);
|
|
219
|
-
i_ += 1;
|
|
220
|
-
return r_
|
|
221
|
-
}))
|
|
245
|
+
export function Array_pushArray(self_, value_) {
|
|
246
|
+
self_.array.push(...value_.array)
|
|
222
247
|
}
|
|
223
248
|
|
|
224
|
-
export function
|
|
225
|
-
|
|
249
|
+
export function Array_pushList(self_, value_) {
|
|
250
|
+
self_.array.push(...value_)
|
|
226
251
|
}
|
|
227
252
|
|
|
228
|
-
export function
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
253
|
+
export function Array_pop(self_) {
|
|
254
|
+
|
|
255
|
+
return self_.array.length > 0
|
|
256
|
+
? ff_core_Option.Some(self_.array.pop())
|
|
257
|
+
: ff_core_Option.None()
|
|
258
|
+
|
|
234
259
|
}
|
|
235
260
|
|
|
236
|
-
export function
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
261
|
+
export function Array_set(self_, index_, value_) {
|
|
262
|
+
|
|
263
|
+
if(index_ < 0 || index_ > self_.array.length) {
|
|
264
|
+
ff_core_Try.internalThrowGrabException_()
|
|
265
|
+
}
|
|
266
|
+
self_.array[index_] = value_
|
|
267
|
+
|
|
240
268
|
}
|
|
241
269
|
|
|
242
270
|
export function Array_modify(self_, index_, body_) {
|
|
243
271
|
|
|
244
|
-
if(index_ < 0 || index_ >= self_.length) {
|
|
272
|
+
if(index_ < 0 || index_ >= self_.array.length) {
|
|
245
273
|
ff_core_Try.internalThrowGrabException_()
|
|
246
274
|
}
|
|
247
|
-
|
|
248
|
-
result[index_] = body_(result[index_]);
|
|
249
|
-
return result;
|
|
275
|
+
self_.array[index_] = body_(self_.array[index_])
|
|
250
276
|
|
|
251
277
|
}
|
|
252
278
|
|
|
253
|
-
export function
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
i_ += 1;
|
|
258
|
-
return ff_core_Pair.Pair(x_, ff_core_Array.Array_grab(that_, i_))
|
|
259
|
-
}))
|
|
260
|
-
} else {
|
|
261
|
-
let i_ = (-1);
|
|
262
|
-
return ff_core_Array.Array_map(that_, ((y_) => {
|
|
263
|
-
i_ += 1;
|
|
264
|
-
return ff_core_Pair.Pair(ff_core_Array.Array_grab(self_, i_), y_)
|
|
265
|
-
}))
|
|
266
|
-
}
|
|
279
|
+
export function Array_fill(self_, value_, start_ = 0, end_ = 9007199254740991) {
|
|
280
|
+
|
|
281
|
+
self_.array.fill(value_, start_, end_);
|
|
282
|
+
|
|
267
283
|
}
|
|
268
284
|
|
|
269
|
-
export function
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
ff_core_Array.Array_each(self_, ((item_) => {
|
|
274
|
-
if((added_ < chunkSize_)) {
|
|
275
|
-
added_ += 1
|
|
276
|
-
} else {
|
|
277
|
-
ff_core_Stack.Stack_push(results_, ff_core_Stack.Stack_drain(result_));
|
|
278
|
-
added_ = 1
|
|
279
|
-
};
|
|
280
|
-
ff_core_Stack.Stack_push(result_, item_)
|
|
281
|
-
}));
|
|
282
|
-
if((added_ !== 0)) {
|
|
283
|
-
ff_core_Stack.Stack_push(results_, ff_core_Stack.Stack_drain(result_))
|
|
284
|
-
};
|
|
285
|
-
return ff_core_Stack.Stack_drain(results_)
|
|
285
|
+
export function Array_copy(self_, target_, start_, end_) {
|
|
286
|
+
|
|
287
|
+
self_.array.copyWithin(target_, start_, end_);
|
|
288
|
+
|
|
286
289
|
}
|
|
287
290
|
|
|
288
|
-
export function
|
|
291
|
+
export function Array_delete(self_, start_, deleteCount_) {
|
|
289
292
|
|
|
290
|
-
|
|
291
|
-
for(let i = self_.length - 1; i >= 0; i--) {
|
|
292
|
-
result = ff_core_List.Link(self_[i], result);
|
|
293
|
-
}
|
|
294
|
-
return result;
|
|
293
|
+
self_.array.splice(start_, deleteCount_);
|
|
295
294
|
|
|
296
295
|
}
|
|
297
296
|
|
|
298
|
-
export function
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
const result_ = ff_core_Array.Array_grab(self_, index_);
|
|
304
|
-
index_ += 1;
|
|
305
|
-
return result_
|
|
306
|
-
})())
|
|
307
|
-
} else if((cycle_ && (index_ !== 0))) {
|
|
308
|
-
return ff_core_Option.Some((function() {
|
|
309
|
-
const result_ = ff_core_Array.Array_grab(self_, 0);
|
|
310
|
-
index_ = 1;
|
|
311
|
-
return result_
|
|
312
|
-
})())
|
|
313
|
-
} else return ff_core_Option.None()
|
|
314
|
-
}), (() => {
|
|
297
|
+
export function Array_insert(self_, start_, value_, deleteCount_ = 0) {
|
|
298
|
+
|
|
299
|
+
self_.array.splice(start_, deleteCount_, value_);
|
|
300
|
+
|
|
301
|
+
}
|
|
315
302
|
|
|
316
|
-
|
|
303
|
+
export function Array_insertArray(self_, start_, value_, deleteCount_ = 0) {
|
|
304
|
+
|
|
305
|
+
self_.array.splice(start_, deleteCount_, ...value_.array);
|
|
306
|
+
|
|
317
307
|
}
|
|
318
308
|
|
|
319
|
-
export function
|
|
320
|
-
|
|
309
|
+
export function Array_insertList(self_, start_, value_, deleteCount_ = 0) {
|
|
310
|
+
|
|
311
|
+
self_.array.splice(start_, deleteCount_, ...value_);
|
|
312
|
+
|
|
321
313
|
}
|
|
322
314
|
|
|
323
315
|
export function Array_each(self_, body_) {
|
|
324
316
|
|
|
325
|
-
return self_.forEach(body_);
|
|
317
|
+
return self_.array.forEach(body_);
|
|
326
318
|
|
|
327
319
|
}
|
|
328
320
|
|
|
329
321
|
export function Array_eachWhile(self_, body_) {
|
|
330
|
-
for(const value of self_) if(!body_(value)) break
|
|
322
|
+
for(const value of self_.array) if(!body_(value)) break
|
|
331
323
|
}
|
|
332
324
|
|
|
333
325
|
export function Array_all(self_, body_) {
|
|
334
326
|
let result_ = true;
|
|
335
327
|
ff_core_Array.Array_eachWhile(self_, ((x_) => {
|
|
336
|
-
result_ =
|
|
328
|
+
result_ = body_(x_);
|
|
337
329
|
return result_
|
|
338
330
|
}));
|
|
339
331
|
return result_
|
|
@@ -342,7 +334,7 @@ return result_
|
|
|
342
334
|
export function Array_any(self_, body_) {
|
|
343
335
|
let result_ = false;
|
|
344
336
|
ff_core_Array.Array_eachWhile(self_, ((x_) => {
|
|
345
|
-
result_ =
|
|
337
|
+
result_ = body_(x_);
|
|
346
338
|
return (!result_)
|
|
347
339
|
}));
|
|
348
340
|
return result_
|
|
@@ -361,104 +353,43 @@ return true
|
|
|
361
353
|
return result_
|
|
362
354
|
}
|
|
363
355
|
|
|
364
|
-
export function
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
356
|
+
export function Array_indexWhere(self_, body_) {
|
|
357
|
+
let i_ = (-1);
|
|
358
|
+
let result_ = false;
|
|
359
|
+
ff_core_Array.Array_eachWhile(self_, ((x_) => {
|
|
360
|
+
i_ += 1;
|
|
361
|
+
result_ = body_(x_);
|
|
362
|
+
return (!result_)
|
|
370
363
|
}));
|
|
371
|
-
|
|
364
|
+
if(result_) {
|
|
365
|
+
return ff_core_Option.Some(i_)
|
|
366
|
+
} else return ff_core_Option.None()
|
|
372
367
|
}
|
|
373
368
|
|
|
374
|
-
export function
|
|
375
|
-
|
|
376
|
-
return (!body_(_w1))
|
|
377
|
-
})))
|
|
369
|
+
export function Array_drain(self_) {
|
|
370
|
+
const result = self_.array; self_.array = []; return result
|
|
378
371
|
}
|
|
379
372
|
|
|
380
|
-
export function
|
|
381
|
-
|
|
382
|
-
return self_.map(body_)
|
|
383
|
-
|
|
373
|
+
export function Array_toList(self_, start_ = 0, end_ = 9007199254740991) {
|
|
374
|
+
return self_.array.slice(start_, end_)
|
|
384
375
|
}
|
|
385
376
|
|
|
386
|
-
export function
|
|
387
|
-
|
|
388
|
-
ff_core_Array.Array_each(self_, ((x_) => {
|
|
389
|
-
ff_core_Stack.Stack_pushArray(results_, body_(x_))
|
|
390
|
-
}));
|
|
391
|
-
return ff_core_Stack.Stack_drain(results_)
|
|
377
|
+
export function Array_toStream(self_, start_ = 0, end_ = 9007199254740991) {
|
|
378
|
+
return ff_core_List.List_toStream(ff_core_Array.Array_toList(self_, start_, end_), false)
|
|
392
379
|
}
|
|
393
380
|
|
|
394
|
-
export function
|
|
395
|
-
|
|
396
|
-
ff_core_Array.Array_each(self_, ((x_) => {
|
|
397
|
-
ff_core_Option.Option_each(body_(x_), ((_w1) => {
|
|
398
|
-
ff_core_Stack.Stack_push(result_, _w1)
|
|
399
|
-
}))
|
|
400
|
-
}));
|
|
401
|
-
return ff_core_Stack.Stack_drain(result_)
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
export function Array_collectFirst(self_, body_) {
|
|
405
|
-
let result_ = ff_core_Option.None();
|
|
406
|
-
ff_core_Array.Array_eachWhile(self_, ((x_) => {
|
|
407
|
-
{
|
|
408
|
-
const _1 = body_(x_);
|
|
409
|
-
{
|
|
410
|
-
if(_1.None) {
|
|
411
|
-
return true
|
|
412
|
-
return
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
{
|
|
416
|
-
const o_ = _1;
|
|
417
|
-
result_ = o_;
|
|
418
|
-
return false
|
|
419
|
-
return
|
|
420
|
-
}
|
|
421
|
-
}
|
|
422
|
-
}));
|
|
423
|
-
return result_
|
|
381
|
+
export function Array_reverse(self_) {
|
|
382
|
+
self_.array.reverse()
|
|
424
383
|
}
|
|
425
384
|
|
|
426
385
|
export function Array_sortBy(self_, body_, ff_core_Ordering_Order$S) {
|
|
427
|
-
|
|
386
|
+
ff_core_Array.Array_sortWith(self_, ((_w1, _w2) => {
|
|
428
387
|
return ff_core_Ordering_Order$S.compare_(body_(_w1), body_(_w2))
|
|
429
388
|
}))
|
|
430
389
|
}
|
|
431
390
|
|
|
432
391
|
export function Array_sortWith(self_, ordering_) {
|
|
433
|
-
|
|
434
|
-
ff_core_Stack.Stack_sortWith(stack_, ordering_);
|
|
435
|
-
return ff_core_Stack.Stack_drain(stack_)
|
|
436
|
-
}
|
|
437
|
-
|
|
438
|
-
export function Array_reverse(self_) {
|
|
439
|
-
return ff_core_Array.Array_map(ff_core_List.List_toArray(ff_core_Int.Int_to(1, ff_core_Array.Array_size(self_))), ((i_) => {
|
|
440
|
-
return ff_core_Array.Array_grab(self_, (ff_core_Array.Array_size(self_) - i_))
|
|
441
|
-
}))
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
export function Array_separate(self_, separator_) {
|
|
445
|
-
const stack_ = ff_core_Stack.make_();
|
|
446
|
-
ff_core_Array.Array_each(ff_core_Array.Array_pairs(self_), ((_1) => {
|
|
447
|
-
{
|
|
448
|
-
const i_ = _1.first_;
|
|
449
|
-
const x_ = _1.second_;
|
|
450
|
-
if((i_ !== 0)) {
|
|
451
|
-
ff_core_Stack.Stack_pushArray(stack_, separator_)
|
|
452
|
-
};
|
|
453
|
-
ff_core_Stack.Stack_push(stack_, x_)
|
|
454
|
-
return
|
|
455
|
-
}
|
|
456
|
-
}));
|
|
457
|
-
return ff_core_Stack.Stack_drain(stack_)
|
|
458
|
-
}
|
|
459
|
-
|
|
460
|
-
export async function Array_addAll$(self_, that_, $task) {
|
|
461
|
-
throw new Error('Function Array_addAll is missing on this target in async context.');
|
|
392
|
+
self_.array.sort((x, y) => ff_core_Ordering.Ordering_toInt(ordering_(x, y)))
|
|
462
393
|
}
|
|
463
394
|
|
|
464
395
|
export async function Array_isEmpty$(self_, $task) {
|
|
@@ -477,14 +408,6 @@ export async function Array_grab$(self_, index_, $task) {
|
|
|
477
408
|
throw new Error('Function Array_grab is missing on this target in async context.');
|
|
478
409
|
}
|
|
479
410
|
|
|
480
|
-
export async function Array_first$(self_, $task) {
|
|
481
|
-
return ff_core_Array.Array_get(self_, 0)
|
|
482
|
-
}
|
|
483
|
-
|
|
484
|
-
export async function Array_last$(self_, $task) {
|
|
485
|
-
return ff_core_Array.Array_get(self_, (ff_core_Array.Array_size(self_) - 1))
|
|
486
|
-
}
|
|
487
|
-
|
|
488
411
|
export async function Array_grabFirst$(self_, $task) {
|
|
489
412
|
return ff_core_Array.Array_grab(self_, 0)
|
|
490
413
|
}
|
|
@@ -493,140 +416,83 @@ export async function Array_grabLast$(self_, $task) {
|
|
|
493
416
|
return ff_core_Array.Array_grab(self_, (ff_core_Array.Array_size(self_) - 1))
|
|
494
417
|
}
|
|
495
418
|
|
|
496
|
-
export async function
|
|
497
|
-
throw new Error('Function
|
|
498
|
-
}
|
|
499
|
-
|
|
500
|
-
export async function Array_takeLast$(self_, count_ = 1, $task) {
|
|
501
|
-
throw new Error('Function Array_takeLast is missing on this target in async context.');
|
|
419
|
+
export async function Array_first$(self_, $task) {
|
|
420
|
+
throw new Error('Function Array_first is missing on this target in async context.');
|
|
502
421
|
}
|
|
503
422
|
|
|
504
|
-
export async function
|
|
505
|
-
throw new Error('Function
|
|
423
|
+
export async function Array_last$(self_, $task) {
|
|
424
|
+
throw new Error('Function Array_last is missing on this target in async context.');
|
|
506
425
|
}
|
|
507
426
|
|
|
508
|
-
export async function
|
|
509
|
-
throw new Error('Function
|
|
427
|
+
export async function Array_push$(self_, value_, $task) {
|
|
428
|
+
throw new Error('Function Array_push is missing on this target in async context.');
|
|
510
429
|
}
|
|
511
430
|
|
|
512
|
-
export async function
|
|
513
|
-
|
|
514
|
-
return ff_core_Array.Array_map(self_, ((x_) => {
|
|
515
|
-
const r_ = ff_core_Pair.Pair(i_, x_);
|
|
516
|
-
i_ += 1;
|
|
517
|
-
return r_
|
|
518
|
-
}))
|
|
431
|
+
export async function Array_pushArray$(self_, value_, $task) {
|
|
432
|
+
throw new Error('Function Array_pushArray is missing on this target in async context.');
|
|
519
433
|
}
|
|
520
434
|
|
|
521
|
-
export async function
|
|
522
|
-
|
|
435
|
+
export async function Array_pushList$(self_, value_, $task) {
|
|
436
|
+
throw new Error('Function Array_pushList is missing on this target in async context.');
|
|
523
437
|
}
|
|
524
438
|
|
|
525
|
-
export async function
|
|
526
|
-
|
|
527
|
-
(await ff_core_Array.Array_each$(self_, (async (x_, $task) => {
|
|
528
|
-
result_ = (await body_(result_, x_, $task))
|
|
529
|
-
}), $task));
|
|
530
|
-
return result_
|
|
439
|
+
export async function Array_pop$(self_, $task) {
|
|
440
|
+
throw new Error('Function Array_pop is missing on this target in async context.');
|
|
531
441
|
}
|
|
532
442
|
|
|
533
|
-
export async function
|
|
534
|
-
|
|
535
|
-
return value_
|
|
536
|
-
}))
|
|
443
|
+
export async function Array_set$(self_, index_, value_, $task) {
|
|
444
|
+
throw new Error('Function Array_set is missing on this target in async context.');
|
|
537
445
|
}
|
|
538
446
|
|
|
539
447
|
export async function Array_modify$(self_, index_, body_, $task) {
|
|
540
448
|
|
|
541
|
-
if(index_ < 0 || index_ >= self_.length) {
|
|
449
|
+
if(index_ < 0 || index_ >= self_.array.length) {
|
|
542
450
|
ff_core_Try.internalThrowGrabException_()
|
|
543
451
|
}
|
|
544
|
-
|
|
545
|
-
result[index_] = await body_(result[index_], $task);
|
|
546
|
-
return result;
|
|
452
|
+
self_.array[index_] = await body_(self_.array[index_], $task)
|
|
547
453
|
|
|
548
454
|
}
|
|
549
455
|
|
|
550
|
-
export async function
|
|
551
|
-
|
|
552
|
-
let i_ = (-1);
|
|
553
|
-
return ff_core_Array.Array_map(self_, ((x_) => {
|
|
554
|
-
i_ += 1;
|
|
555
|
-
return ff_core_Pair.Pair(x_, ff_core_Array.Array_grab(that_, i_))
|
|
556
|
-
}))
|
|
557
|
-
} else {
|
|
558
|
-
let i_ = (-1);
|
|
559
|
-
return ff_core_Array.Array_map(that_, ((y_) => {
|
|
560
|
-
i_ += 1;
|
|
561
|
-
return ff_core_Pair.Pair(ff_core_Array.Array_grab(self_, i_), y_)
|
|
562
|
-
}))
|
|
563
|
-
}
|
|
456
|
+
export async function Array_fill$(self_, value_, start_ = 0, end_ = 9007199254740991, $task) {
|
|
457
|
+
throw new Error('Function Array_fill is missing on this target in async context.');
|
|
564
458
|
}
|
|
565
459
|
|
|
566
|
-
export async function
|
|
567
|
-
|
|
568
|
-
const result_ = ff_core_Stack.make_();
|
|
569
|
-
let added_ = 0;
|
|
570
|
-
ff_core_Array.Array_each(self_, ((item_) => {
|
|
571
|
-
if((added_ < chunkSize_)) {
|
|
572
|
-
added_ += 1
|
|
573
|
-
} else {
|
|
574
|
-
ff_core_Stack.Stack_push(results_, ff_core_Stack.Stack_drain(result_));
|
|
575
|
-
added_ = 1
|
|
576
|
-
};
|
|
577
|
-
ff_core_Stack.Stack_push(result_, item_)
|
|
578
|
-
}));
|
|
579
|
-
if((added_ !== 0)) {
|
|
580
|
-
ff_core_Stack.Stack_push(results_, ff_core_Stack.Stack_drain(result_))
|
|
581
|
-
};
|
|
582
|
-
return ff_core_Stack.Stack_drain(results_)
|
|
460
|
+
export async function Array_copy$(self_, target_, start_, end_, $task) {
|
|
461
|
+
throw new Error('Function Array_copy is missing on this target in async context.');
|
|
583
462
|
}
|
|
584
463
|
|
|
585
|
-
export async function
|
|
586
|
-
throw new Error('Function
|
|
464
|
+
export async function Array_delete$(self_, start_, deleteCount_, $task) {
|
|
465
|
+
throw new Error('Function Array_delete is missing on this target in async context.');
|
|
587
466
|
}
|
|
588
467
|
|
|
589
|
-
export async function
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
if((index_ < ff_core_Array.Array_size(self_))) {
|
|
593
|
-
return ff_core_Option.Some((await (async function() {
|
|
594
|
-
const result_ = ff_core_Array.Array_grab(self_, index_);
|
|
595
|
-
index_ += 1;
|
|
596
|
-
return result_
|
|
597
|
-
})()))
|
|
598
|
-
} else if((cycle_ && (index_ !== 0))) {
|
|
599
|
-
return ff_core_Option.Some((await (async function() {
|
|
600
|
-
const result_ = ff_core_Array.Array_grab(self_, 0);
|
|
601
|
-
index_ = 1;
|
|
602
|
-
return result_
|
|
603
|
-
})()))
|
|
604
|
-
} else return ff_core_Option.None()
|
|
605
|
-
}), (async ($task) => {
|
|
468
|
+
export async function Array_insert$(self_, start_, value_, deleteCount_ = 0, $task) {
|
|
469
|
+
throw new Error('Function Array_insert is missing on this target in async context.');
|
|
470
|
+
}
|
|
606
471
|
|
|
607
|
-
|
|
472
|
+
export async function Array_insertArray$(self_, start_, value_, deleteCount_ = 0, $task) {
|
|
473
|
+
throw new Error('Function Array_insertArray is missing on this target in async context.');
|
|
608
474
|
}
|
|
609
475
|
|
|
610
|
-
export async function
|
|
611
|
-
throw new Error('Function
|
|
476
|
+
export async function Array_insertList$(self_, start_, value_, deleteCount_ = 0, $task) {
|
|
477
|
+
throw new Error('Function Array_insertList is missing on this target in async context.');
|
|
612
478
|
}
|
|
613
479
|
|
|
614
480
|
export async function Array_each$(self_, body_, $task) {
|
|
615
481
|
|
|
616
|
-
for(let i = 0; i < self_.length; i++) {
|
|
617
|
-
await body_(self_[i], $task)
|
|
482
|
+
for(let i = 0; i < self_.array.length; i++) {
|
|
483
|
+
await body_(self_.array[i], $task)
|
|
618
484
|
}
|
|
619
485
|
|
|
620
486
|
}
|
|
621
487
|
|
|
622
488
|
export async function Array_eachWhile$(self_, body_, $task) {
|
|
623
|
-
for(const value of self_) if(!await body_(value, $task)) break
|
|
489
|
+
for(const value of self_.array) if(!await body_(value, $task)) break
|
|
624
490
|
}
|
|
625
491
|
|
|
626
492
|
export async function Array_all$(self_, body_, $task) {
|
|
627
493
|
let result_ = true;
|
|
628
494
|
(await ff_core_Array.Array_eachWhile$(self_, (async (x_, $task) => {
|
|
629
|
-
result_ = (
|
|
495
|
+
result_ = (await body_(x_, $task));
|
|
630
496
|
return result_
|
|
631
497
|
}), $task));
|
|
632
498
|
return result_
|
|
@@ -635,7 +501,7 @@ return result_
|
|
|
635
501
|
export async function Array_any$(self_, body_, $task) {
|
|
636
502
|
let result_ = false;
|
|
637
503
|
(await ff_core_Array.Array_eachWhile$(self_, (async (x_, $task) => {
|
|
638
|
-
result_ = (
|
|
504
|
+
result_ = (await body_(x_, $task));
|
|
639
505
|
return (!result_)
|
|
640
506
|
}), $task));
|
|
641
507
|
return result_
|
|
@@ -654,250 +520,59 @@ return true
|
|
|
654
520
|
return result_
|
|
655
521
|
}
|
|
656
522
|
|
|
657
|
-
export async function
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
523
|
+
export async function Array_indexWhere$(self_, body_, $task) {
|
|
524
|
+
let i_ = (-1);
|
|
525
|
+
let result_ = false;
|
|
526
|
+
(await ff_core_Array.Array_eachWhile$(self_, (async (x_, $task) => {
|
|
527
|
+
i_ += 1;
|
|
528
|
+
result_ = (await body_(x_, $task));
|
|
529
|
+
return (!result_)
|
|
663
530
|
}), $task));
|
|
664
|
-
|
|
531
|
+
if(result_) {
|
|
532
|
+
return ff_core_Option.Some(i_)
|
|
533
|
+
} else return ff_core_Option.None()
|
|
665
534
|
}
|
|
666
535
|
|
|
667
|
-
export async function
|
|
668
|
-
|
|
669
|
-
return (!(await body_(_w1, $task)))
|
|
670
|
-
}), $task)))
|
|
536
|
+
export async function Array_drain$(self_, $task) {
|
|
537
|
+
throw new Error('Function Array_drain is missing on this target in async context.');
|
|
671
538
|
}
|
|
672
539
|
|
|
673
|
-
export async function
|
|
674
|
-
|
|
675
|
-
let result = [];
|
|
676
|
-
for(let i = self_.length - 1; i >= 0; i--) {
|
|
677
|
-
result.push(await body_(self_[i], $task));
|
|
678
|
-
}
|
|
679
|
-
return result;
|
|
680
|
-
|
|
681
|
-
}
|
|
682
|
-
|
|
683
|
-
export async function Array_flatMap$(self_, body_, $task) {
|
|
684
|
-
const results_ = ff_core_Stack.make_();
|
|
685
|
-
(await ff_core_Array.Array_each$(self_, (async (x_, $task) => {
|
|
686
|
-
ff_core_Stack.Stack_pushArray(results_, (await body_(x_, $task)))
|
|
687
|
-
}), $task));
|
|
688
|
-
return ff_core_Stack.Stack_drain(results_)
|
|
540
|
+
export async function Array_toList$(self_, start_ = 0, end_ = 9007199254740991, $task) {
|
|
541
|
+
throw new Error('Function Array_toList is missing on this target in async context.');
|
|
689
542
|
}
|
|
690
543
|
|
|
691
|
-
export async function
|
|
692
|
-
|
|
693
|
-
(await ff_core_Array.Array_each$(self_, (async (x_, $task) => {
|
|
694
|
-
ff_core_Option.Option_each((await body_(x_, $task)), ((_w1) => {
|
|
695
|
-
ff_core_Stack.Stack_push(result_, _w1)
|
|
696
|
-
}))
|
|
697
|
-
}), $task));
|
|
698
|
-
return ff_core_Stack.Stack_drain(result_)
|
|
544
|
+
export async function Array_toStream$(self_, start_ = 0, end_ = 9007199254740991, $task) {
|
|
545
|
+
return (await ff_core_List.List_toStream$(ff_core_Array.Array_toList(self_, start_, end_), false, $task))
|
|
699
546
|
}
|
|
700
547
|
|
|
701
|
-
export async function
|
|
702
|
-
|
|
703
|
-
(await ff_core_Array.Array_eachWhile$(self_, (async (x_, $task) => {
|
|
704
|
-
{
|
|
705
|
-
const _1 = (await body_(x_, $task));
|
|
706
|
-
{
|
|
707
|
-
if(_1.None) {
|
|
708
|
-
return true
|
|
709
|
-
return
|
|
710
|
-
}
|
|
711
|
-
}
|
|
712
|
-
{
|
|
713
|
-
const o_ = _1;
|
|
714
|
-
result_ = o_;
|
|
715
|
-
return false
|
|
716
|
-
return
|
|
717
|
-
}
|
|
718
|
-
}
|
|
719
|
-
}), $task));
|
|
720
|
-
return result_
|
|
548
|
+
export async function Array_reverse$(self_, $task) {
|
|
549
|
+
throw new Error('Function Array_reverse is missing on this target in async context.');
|
|
721
550
|
}
|
|
722
551
|
|
|
723
552
|
export async function Array_sortBy$(self_, body_, ff_core_Ordering_Order$S, $task) {
|
|
724
|
-
|
|
553
|
+
(await ff_core_Array.Array_sortWith$(self_, (async (_w1, _w2, $task) => {
|
|
725
554
|
return ff_core_Ordering_Order$S.compare_((await body_(_w1, $task)), (await body_(_w2, $task)))
|
|
726
555
|
}), $task))
|
|
727
556
|
}
|
|
728
557
|
|
|
729
558
|
export async function Array_sortWith$(self_, ordering_, $task) {
|
|
730
|
-
|
|
731
|
-
(await ff_core_Stack.Stack_sortWith$(stack_, ordering_, $task));
|
|
732
|
-
return ff_core_Stack.Stack_drain(stack_)
|
|
733
|
-
}
|
|
734
|
-
|
|
735
|
-
export async function Array_reverse$(self_, $task) {
|
|
736
|
-
return ff_core_Array.Array_map(ff_core_List.List_toArray(ff_core_Int.Int_to(1, ff_core_Array.Array_size(self_))), ((i_) => {
|
|
737
|
-
return ff_core_Array.Array_grab(self_, (ff_core_Array.Array_size(self_) - i_))
|
|
738
|
-
}))
|
|
739
|
-
}
|
|
740
|
-
|
|
741
|
-
export async function Array_separate$(self_, separator_, $task) {
|
|
742
|
-
const stack_ = ff_core_Stack.make_();
|
|
743
|
-
ff_core_Array.Array_each(ff_core_Array.Array_pairs(self_), ((_1) => {
|
|
744
|
-
{
|
|
745
|
-
const i_ = _1.first_;
|
|
746
|
-
const x_ = _1.second_;
|
|
747
|
-
if((i_ !== 0)) {
|
|
748
|
-
ff_core_Stack.Stack_pushArray(stack_, separator_)
|
|
749
|
-
};
|
|
750
|
-
ff_core_Stack.Stack_push(stack_, x_)
|
|
751
|
-
return
|
|
752
|
-
}
|
|
753
|
-
}));
|
|
754
|
-
return ff_core_Stack.Stack_drain(stack_)
|
|
559
|
+
throw new Error('Function Array_sortWith is missing on this target in async context.');
|
|
755
560
|
}
|
|
756
561
|
|
|
757
562
|
export function Array_sort(self_, ff_core_Ordering_Order$T) {
|
|
758
|
-
|
|
563
|
+
ff_core_Array.Array_sortWith(self_, ((x_, y_) => {
|
|
759
564
|
return ff_core_Ordering_Order$T.compare_(x_, y_)
|
|
760
565
|
}))
|
|
761
566
|
}
|
|
762
567
|
|
|
763
|
-
export function Array_toSet(self_, ff_core_Ordering_Order$T) {
|
|
764
|
-
return ff_core_List.List_toSet(ff_core_Array.Array_toList(self_), ff_core_Ordering_Order$T)
|
|
765
|
-
}
|
|
766
|
-
|
|
767
|
-
export function Array_distinct(self_, ff_core_Ordering_Order$T) {
|
|
768
|
-
let seen_ = ff_core_List.List_toSet(ff_core_List.Empty(), ff_core_Ordering_Order$T);
|
|
769
|
-
return ff_core_Array.Array_filter(self_, ((_1) => {
|
|
770
|
-
{
|
|
771
|
-
const item_ = _1;
|
|
772
|
-
const _guard1 = (!ff_core_Set.Set_contains(seen_, item_, ff_core_Ordering_Order$T));
|
|
773
|
-
if(_guard1) {
|
|
774
|
-
seen_ = ff_core_Set.Set_add(seen_, item_, ff_core_Ordering_Order$T);
|
|
775
|
-
return true
|
|
776
|
-
return
|
|
777
|
-
}
|
|
778
|
-
}
|
|
779
|
-
{
|
|
780
|
-
return false
|
|
781
|
-
return
|
|
782
|
-
}
|
|
783
|
-
}))
|
|
784
|
-
}
|
|
785
|
-
|
|
786
568
|
export async function Array_sort$(self_, ff_core_Ordering_Order$T, $task) {
|
|
787
|
-
|
|
569
|
+
ff_core_Array.Array_sortWith(self_, ((x_, y_) => {
|
|
788
570
|
return ff_core_Ordering_Order$T.compare_(x_, y_)
|
|
789
571
|
}))
|
|
790
572
|
}
|
|
791
573
|
|
|
792
|
-
export async function Array_toSet$(self_, ff_core_Ordering_Order$T, $task) {
|
|
793
|
-
return ff_core_List.List_toSet(ff_core_Array.Array_toList(self_), ff_core_Ordering_Order$T)
|
|
794
|
-
}
|
|
795
|
-
|
|
796
|
-
export async function Array_distinct$(self_, ff_core_Ordering_Order$T, $task) {
|
|
797
|
-
let seen_ = ff_core_List.List_toSet(ff_core_List.Empty(), ff_core_Ordering_Order$T);
|
|
798
|
-
return ff_core_Array.Array_filter(self_, ((_1) => {
|
|
799
|
-
{
|
|
800
|
-
const item_ = _1;
|
|
801
|
-
const _guard1 = (!ff_core_Set.Set_contains(seen_, item_, ff_core_Ordering_Order$T));
|
|
802
|
-
if(_guard1) {
|
|
803
|
-
seen_ = ff_core_Set.Set_add(seen_, item_, ff_core_Ordering_Order$T);
|
|
804
|
-
return true
|
|
805
|
-
return
|
|
806
|
-
}
|
|
807
|
-
}
|
|
808
|
-
{
|
|
809
|
-
return false
|
|
810
|
-
return
|
|
811
|
-
}
|
|
812
|
-
}))
|
|
813
|
-
}
|
|
814
|
-
|
|
815
|
-
export function Array_flatten(self_) {
|
|
816
|
-
const result_ = ff_core_Stack.make_();
|
|
817
|
-
ff_core_Array.Array_each(self_, ((xs_) => {
|
|
818
|
-
ff_core_Stack.Stack_pushArray(result_, xs_)
|
|
819
|
-
}));
|
|
820
|
-
return ff_core_Stack.Stack_drain(result_)
|
|
821
|
-
}
|
|
822
|
-
|
|
823
|
-
export async function Array_flatten$(self_, $task) {
|
|
824
|
-
const result_ = ff_core_Stack.make_();
|
|
825
|
-
ff_core_Array.Array_each(self_, ((xs_) => {
|
|
826
|
-
ff_core_Stack.Stack_pushArray(result_, xs_)
|
|
827
|
-
}));
|
|
828
|
-
return ff_core_Stack.Stack_drain(result_)
|
|
829
|
-
}
|
|
830
|
-
|
|
831
|
-
export function Array_toMap(self_, ff_core_Ordering_Order$K) {
|
|
832
|
-
return ff_core_List.List_toMap(ff_core_Array.Array_toList(self_), ff_core_Ordering_Order$K)
|
|
833
|
-
}
|
|
834
|
-
|
|
835
|
-
export function Array_group(self_, ff_core_Ordering_Order$K) {
|
|
836
|
-
let map_ = ff_core_Map.empty_();
|
|
837
|
-
ff_core_Array.Array_each(self_, ((_1) => {
|
|
838
|
-
{
|
|
839
|
-
const k_ = _1.first_;
|
|
840
|
-
const v_ = _1.second_;
|
|
841
|
-
map_ = ff_core_Map.Map_push(map_, k_, v_, ff_core_Ordering_Order$K)
|
|
842
|
-
return
|
|
843
|
-
}
|
|
844
|
-
}));
|
|
845
|
-
return ff_core_Map.Map_mapValues(map_, ((_, v_) => {
|
|
846
|
-
return ff_core_Stack.Stack_drain(v_)
|
|
847
|
-
}), ff_core_Ordering_Order$K)
|
|
848
|
-
}
|
|
849
|
-
|
|
850
|
-
export async function Array_toMap$(self_, ff_core_Ordering_Order$K, $task) {
|
|
851
|
-
return ff_core_List.List_toMap(ff_core_Array.Array_toList(self_), ff_core_Ordering_Order$K)
|
|
852
|
-
}
|
|
853
|
-
|
|
854
|
-
export async function Array_group$(self_, ff_core_Ordering_Order$K, $task) {
|
|
855
|
-
let map_ = ff_core_Map.empty_();
|
|
856
|
-
ff_core_Array.Array_each(self_, ((_1) => {
|
|
857
|
-
{
|
|
858
|
-
const k_ = _1.first_;
|
|
859
|
-
const v_ = _1.second_;
|
|
860
|
-
map_ = ff_core_Map.Map_push(map_, k_, v_, ff_core_Ordering_Order$K)
|
|
861
|
-
return
|
|
862
|
-
}
|
|
863
|
-
}));
|
|
864
|
-
return ff_core_Map.Map_mapValues(map_, ((_, v_) => {
|
|
865
|
-
return ff_core_Stack.Stack_drain(v_)
|
|
866
|
-
}), ff_core_Ordering_Order$K)
|
|
867
|
-
}
|
|
868
|
-
|
|
869
|
-
export function Array_unzip(self_) {
|
|
870
|
-
const first_ = ff_core_Stack.make_();
|
|
871
|
-
const second_ = ff_core_Stack.make_();
|
|
872
|
-
ff_core_Array.Array_each(self_, ((_1) => {
|
|
873
|
-
{
|
|
874
|
-
const x_ = _1.first_;
|
|
875
|
-
const y_ = _1.second_;
|
|
876
|
-
ff_core_Stack.Stack_push(first_, x_);
|
|
877
|
-
ff_core_Stack.Stack_push(second_, y_)
|
|
878
|
-
return
|
|
879
|
-
}
|
|
880
|
-
}));
|
|
881
|
-
return ff_core_Pair.Pair(ff_core_Stack.Stack_drain(first_), ff_core_Stack.Stack_drain(second_))
|
|
882
|
-
}
|
|
883
|
-
|
|
884
|
-
export async function Array_unzip$(self_, $task) {
|
|
885
|
-
const first_ = ff_core_Stack.make_();
|
|
886
|
-
const second_ = ff_core_Stack.make_();
|
|
887
|
-
ff_core_Array.Array_each(self_, ((_1) => {
|
|
888
|
-
{
|
|
889
|
-
const x_ = _1.first_;
|
|
890
|
-
const y_ = _1.second_;
|
|
891
|
-
ff_core_Stack.Stack_push(first_, x_);
|
|
892
|
-
ff_core_Stack.Stack_push(second_, y_)
|
|
893
|
-
return
|
|
894
|
-
}
|
|
895
|
-
}));
|
|
896
|
-
return ff_core_Pair.Pair(ff_core_Stack.Stack_drain(first_), ff_core_Stack.Stack_drain(second_))
|
|
897
|
-
}
|
|
898
|
-
|
|
899
574
|
export function Array_join(self_, separator_ = "") {
|
|
900
|
-
return self_.join(separator_)
|
|
575
|
+
return self_.array.join(separator_)
|
|
901
576
|
}
|
|
902
577
|
|
|
903
578
|
export async function Array_join$(self_, separator_ = "", $task) {
|
|
@@ -906,100 +581,28 @@ throw new Error('Function Array_join is missing on this target in async context.
|
|
|
906
581
|
|
|
907
582
|
export function ff_core_Show_Show$ff_core_Array_Array(ff_core_Show_Show$T) { return {
|
|
908
583
|
show_(value_) {
|
|
909
|
-
const
|
|
910
|
-
|
|
584
|
+
const array_ = ff_core_Array.make_();
|
|
585
|
+
ff_core_Array.Array_push(array_, "[");
|
|
911
586
|
ff_core_Array.Array_each(value_, ((x_) => {
|
|
912
|
-
if((
|
|
913
|
-
|
|
587
|
+
if((ff_core_Array.Array_size(array_) > 1)) {
|
|
588
|
+
ff_core_Array.Array_push(array_, ", ")
|
|
914
589
|
};
|
|
915
|
-
|
|
590
|
+
ff_core_Array.Array_push(array_, ff_core_Show_Show$T.show_(x_))
|
|
916
591
|
}));
|
|
917
|
-
|
|
918
|
-
return
|
|
592
|
+
ff_core_Array.Array_push(array_, "].toArray()");
|
|
593
|
+
return ff_core_Array.Array_join(array_, "")
|
|
919
594
|
},
|
|
920
595
|
async show_$(value_, $task) {
|
|
921
|
-
const
|
|
922
|
-
|
|
596
|
+
const array_ = ff_core_Array.make_();
|
|
597
|
+
ff_core_Array.Array_push(array_, "[");
|
|
923
598
|
ff_core_Array.Array_each(value_, ((x_) => {
|
|
924
|
-
if((
|
|
925
|
-
|
|
599
|
+
if((ff_core_Array.Array_size(array_) > 1)) {
|
|
600
|
+
ff_core_Array.Array_push(array_, ", ")
|
|
926
601
|
};
|
|
927
|
-
|
|
602
|
+
ff_core_Array.Array_push(array_, ff_core_Show_Show$T.show_(x_))
|
|
928
603
|
}));
|
|
929
|
-
|
|
930
|
-
return
|
|
931
|
-
}
|
|
932
|
-
}}
|
|
933
|
-
|
|
934
|
-
export function ff_core_Equal_Equal$ff_core_Array_Array(ff_core_Equal_Equal$T) { return {
|
|
935
|
-
equals_(x_, y_) {
|
|
936
|
-
if(ff_core_Array.internalSame_(x_, y_)) {
|
|
937
|
-
return true
|
|
938
|
-
} else {
|
|
939
|
-
if((ff_core_Array.Array_size(x_) !== ff_core_Array.Array_size(y_))) {
|
|
940
|
-
return false
|
|
941
|
-
} else {
|
|
942
|
-
let i_ = (-1);
|
|
943
|
-
return ff_core_Array.Array_all(x_, ((l_) => {
|
|
944
|
-
i_ += 1;
|
|
945
|
-
return ff_core_Equal_Equal$T.equals_(l_, ff_core_Array.Array_grab(y_, i_))
|
|
946
|
-
}))
|
|
947
|
-
}
|
|
948
|
-
}
|
|
949
|
-
},
|
|
950
|
-
async equals_$(x_, y_, $task) {
|
|
951
|
-
if(ff_core_Array.internalSame_(x_, y_)) {
|
|
952
|
-
return true
|
|
953
|
-
} else {
|
|
954
|
-
if((ff_core_Array.Array_size(x_) !== ff_core_Array.Array_size(y_))) {
|
|
955
|
-
return false
|
|
956
|
-
} else {
|
|
957
|
-
let i_ = (-1);
|
|
958
|
-
return ff_core_Array.Array_all(x_, ((l_) => {
|
|
959
|
-
i_ += 1;
|
|
960
|
-
return ff_core_Equal_Equal$T.equals_(l_, ff_core_Array.Array_grab(y_, i_))
|
|
961
|
-
}))
|
|
962
|
-
}
|
|
963
|
-
}
|
|
964
|
-
}
|
|
965
|
-
}}
|
|
966
|
-
|
|
967
|
-
export function ff_core_Ordering_Order$ff_core_Array_Array(ff_core_Ordering_Order$T) { return {
|
|
968
|
-
compare_(x_, y_) {
|
|
969
|
-
if(ff_core_Array.internalSame_(x_, y_)) {
|
|
970
|
-
return ff_core_Ordering.OrderingSame()
|
|
971
|
-
} else {
|
|
972
|
-
const size_ = ff_core_Int.Int_min(ff_core_Array.Array_size(x_), ff_core_Array.Array_size(y_));
|
|
973
|
-
let i_ = 0;
|
|
974
|
-
let ordering_ = ff_core_Ordering.OrderingSame();
|
|
975
|
-
while(((ordering_ === ff_core_Ordering.OrderingSame()) && (i_ < size_))) {
|
|
976
|
-
ordering_ = ff_core_Ordering_Order$T.compare_(ff_core_Array.Array_grab(x_, i_), ff_core_Array.Array_grab(y_, i_));
|
|
977
|
-
i_ += 1
|
|
978
|
-
};
|
|
979
|
-
if((ordering_ !== ff_core_Ordering.OrderingSame())) {
|
|
980
|
-
return ordering_
|
|
981
|
-
} else {
|
|
982
|
-
return ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int.compare_(ff_core_Array.Array_size(x_), ff_core_Array.Array_size(y_))
|
|
983
|
-
}
|
|
984
|
-
}
|
|
985
|
-
},
|
|
986
|
-
async compare_$(x_, y_, $task) {
|
|
987
|
-
if(ff_core_Array.internalSame_(x_, y_)) {
|
|
988
|
-
return ff_core_Ordering.OrderingSame()
|
|
989
|
-
} else {
|
|
990
|
-
const size_ = ff_core_Int.Int_min(ff_core_Array.Array_size(x_), ff_core_Array.Array_size(y_));
|
|
991
|
-
let i_ = 0;
|
|
992
|
-
let ordering_ = ff_core_Ordering.OrderingSame();
|
|
993
|
-
while(((ordering_ === ff_core_Ordering.OrderingSame()) && (i_ < size_))) {
|
|
994
|
-
ordering_ = ff_core_Ordering_Order$T.compare_(ff_core_Array.Array_grab(x_, i_), ff_core_Array.Array_grab(y_, i_));
|
|
995
|
-
i_ += 1
|
|
996
|
-
};
|
|
997
|
-
if((ordering_ !== ff_core_Ordering.OrderingSame())) {
|
|
998
|
-
return ordering_
|
|
999
|
-
} else {
|
|
1000
|
-
return ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int.compare_(ff_core_Array.Array_size(x_), ff_core_Array.Array_size(y_))
|
|
1001
|
-
}
|
|
1002
|
-
}
|
|
604
|
+
ff_core_Array.Array_push(array_, "].toArray()");
|
|
605
|
+
return ff_core_Array.Array_join(array_, "")
|
|
1003
606
|
}
|
|
1004
607
|
}}
|
|
1005
608
|
|