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.
Files changed (115) hide show
  1. package/compiler/Builder.ff +1 -1
  2. package/compiler/Compiler.ff +6 -5
  3. package/compiler/Inference.ff +31 -19
  4. package/compiler/JsEmitter.ff +98 -71
  5. package/compiler/JsImporter.ff +1 -1
  6. package/compiler/LspHook.ff +4 -4
  7. package/compiler/Main.ff +6 -6
  8. package/compiler/Parser.ff +39 -39
  9. package/compiler/Patterns.ff +2 -0
  10. package/compiler/Syntax.ff +1 -1
  11. package/compiler/Tokenizer.ff +2 -2
  12. package/compiler/Workspace.ff +2 -2
  13. package/core/Array.ff +135 -294
  14. package/core/Buffer.ff +3 -3
  15. package/core/BuildSystem.ff +1 -1
  16. package/core/Equal.ff +36 -52
  17. package/core/HttpClient.ff +1 -1
  18. package/core/IntMap.ff +14 -18
  19. package/core/JsSystem.ff +1 -1
  20. package/core/JsValue.ff +6 -12
  21. package/core/Json.ff +19 -28
  22. package/core/List.ff +281 -312
  23. package/core/Map.ff +4 -8
  24. package/core/NodeSystem.ff +2 -2
  25. package/core/Option.ff +0 -4
  26. package/core/Ordering.ff +10 -6
  27. package/core/Pair.ff +0 -4
  28. package/core/Random.ff +12 -26
  29. package/core/RbMap.ff +216 -216
  30. package/core/Serializable.ff +9 -18
  31. package/core/Set.ff +0 -1
  32. package/core/SourceLocation.ff +1 -1
  33. package/core/Stack.ff +32 -45
  34. package/core/Stream.ff +10 -14
  35. package/core/String.ff +24 -6
  36. package/core/StringMap.ff +15 -19
  37. package/guide/Main.ff +20 -2
  38. package/lsp/CompletionHandler.ff +4 -4
  39. package/lsp/Handler.ff +45 -34
  40. package/lsp/HoverHandler.ff +2 -2
  41. package/lsp/LanguageServer.ff +2 -2
  42. package/lsp/SignatureHelpHandler.ff +1 -1
  43. package/lsp/SymbolHandler.ff +1 -1
  44. package/lux/Lux.ff +3 -3
  45. package/output/js/ff/compiler/Builder.mjs +19 -21
  46. package/output/js/ff/compiler/Compiler.mjs +18 -20
  47. package/output/js/ff/compiler/Dependencies.mjs +8 -10
  48. package/output/js/ff/compiler/Deriver.mjs +234 -236
  49. package/output/js/ff/compiler/Dictionaries.mjs +6 -8
  50. package/output/js/ff/compiler/Environment.mjs +42 -44
  51. package/output/js/ff/compiler/Inference.mjs +346 -304
  52. package/output/js/ff/compiler/JsEmitter.mjs +907 -833
  53. package/output/js/ff/compiler/JsImporter.mjs +0 -2
  54. package/output/js/ff/compiler/LspHook.mjs +10 -12
  55. package/output/js/ff/compiler/Main.mjs +109 -111
  56. package/output/js/ff/compiler/Parser.mjs +405 -407
  57. package/output/js/ff/compiler/Patterns.mjs +64 -50
  58. package/output/js/ff/compiler/Resolver.mjs +36 -38
  59. package/output/js/ff/compiler/Substitution.mjs +4 -6
  60. package/output/js/ff/compiler/Syntax.mjs +160 -162
  61. package/output/js/ff/compiler/Token.mjs +52 -54
  62. package/output/js/ff/compiler/Tokenizer.mjs +16 -18
  63. package/output/js/ff/compiler/Unification.mjs +24 -26
  64. package/output/js/ff/compiler/Wildcards.mjs +0 -2
  65. package/output/js/ff/compiler/Workspace.mjs +18 -20
  66. package/output/js/ff/core/Any.mjs +0 -2
  67. package/output/js/ff/core/Array.mjs +216 -613
  68. package/output/js/ff/core/AssetSystem.mjs +2 -4
  69. package/output/js/ff/core/Atomic.mjs +0 -2
  70. package/output/js/ff/core/Bool.mjs +0 -2
  71. package/output/js/ff/core/Box.mjs +0 -2
  72. package/output/js/ff/core/BrowserSystem.mjs +0 -2
  73. package/output/js/ff/core/Buffer.mjs +0 -2
  74. package/output/js/ff/core/BuildSystem.mjs +12 -14
  75. package/output/js/ff/core/Channel.mjs +0 -2
  76. package/output/js/ff/core/Char.mjs +0 -2
  77. package/output/js/ff/core/Core.mjs +0 -2
  78. package/output/js/ff/core/Duration.mjs +0 -2
  79. package/output/js/ff/core/Equal.mjs +0 -22
  80. package/output/js/ff/core/Error.mjs +0 -2
  81. package/output/js/ff/core/FileHandle.mjs +0 -2
  82. package/output/js/ff/core/Float.mjs +0 -2
  83. package/output/js/ff/core/HttpClient.mjs +2 -4
  84. package/output/js/ff/core/Instant.mjs +0 -2
  85. package/output/js/ff/core/Int.mjs +8 -10
  86. package/output/js/ff/core/IntMap.mjs +32 -42
  87. package/output/js/ff/core/JsSystem.mjs +1 -3
  88. package/output/js/ff/core/JsValue.mjs +5 -12
  89. package/output/js/ff/core/Json.mjs +23 -56
  90. package/output/js/ff/core/List.mjs +648 -1989
  91. package/output/js/ff/core/Lock.mjs +0 -2
  92. package/output/js/ff/core/Log.mjs +0 -2
  93. package/output/js/ff/core/Map.mjs +10 -20
  94. package/output/js/ff/core/NodeSystem.mjs +6 -8
  95. package/output/js/ff/core/Nothing.mjs +0 -2
  96. package/output/js/ff/core/Option.mjs +8 -18
  97. package/output/js/ff/core/Ordering.mjs +20 -98
  98. package/output/js/ff/core/Pair.mjs +6 -16
  99. package/output/js/ff/core/Path.mjs +12 -14
  100. package/output/js/ff/core/Random.mjs +24 -54
  101. package/output/js/ff/core/RbMap.mjs +54 -56
  102. package/output/js/ff/core/Serializable.mjs +19 -36
  103. package/output/js/ff/core/Set.mjs +0 -14
  104. package/output/js/ff/core/Show.mjs +0 -2
  105. package/output/js/ff/core/SourceLocation.mjs +0 -2
  106. package/output/js/ff/core/Stream.mjs +34 -44
  107. package/output/js/ff/core/String.mjs +31 -5
  108. package/output/js/ff/core/StringMap.mjs +32 -42
  109. package/output/js/ff/core/Task.mjs +0 -2
  110. package/output/js/ff/core/Try.mjs +0 -2
  111. package/output/js/ff/core/Unit.mjs +0 -2
  112. package/package.json +1 -1
  113. package/vscode/package.json +1 -1
  114. package/webserver/WebServer.ff +8 -8
  115. 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"
@@ -143,10 +141,6 @@ export function array_(json_) {
143
141
 
144
142
  }
145
143
 
146
- export function list_(json_) {
147
- return ff_core_Json.array_(ff_core_List.List_toArray(json_))
148
- }
149
-
150
144
  export function object_() {
151
145
 
152
146
  return {};
@@ -273,10 +267,6 @@ export async function array_$(json_, $task) {
273
267
  throw new Error('Function array is missing on this target in async context.');
274
268
  }
275
269
 
276
- export async function list_$(json_, $task) {
277
- return ff_core_Json.array_(ff_core_List.List_toArray(json_))
278
- }
279
-
280
270
  export async function object_$($task) {
281
271
  throw new Error('Function object is missing on this target in async context.');
282
272
  }
@@ -511,19 +501,19 @@ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_core_Core.G
511
501
  }
512
502
 
513
503
  export function Json_map(self_, body_) {
514
- const stack_ = ff_core_Stack.make_();
504
+ const array_ = ff_core_Array.make_();
515
505
  ff_core_Json.Json_each(self_, ((field_, value_) => {
516
- ff_core_Stack.Stack_push(stack_, body_(field_, value_))
506
+ ff_core_Array.Array_push(array_, body_(field_, value_))
517
507
  }));
518
- return ff_core_Stack.Stack_drain(stack_)
508
+ return ff_core_Array.Array_drain(array_)
519
509
  }
520
510
 
521
511
  export function Json_flatMap(self_, body_) {
522
- const stack_ = ff_core_Stack.make_();
512
+ const array_ = ff_core_Array.make_();
523
513
  ff_core_Json.Json_each(self_, ((field_, value_) => {
524
- ff_core_Stack.Stack_pushArray(stack_, body_(field_, value_))
514
+ ff_core_Array.Array_pushList(array_, body_(field_, value_))
525
515
  }));
526
- return ff_core_Stack.Stack_drain(stack_)
516
+ return ff_core_Array.Array_drain(array_)
527
517
  }
528
518
 
529
519
  export function Json_each(self_, body_) {
@@ -687,19 +677,19 @@ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_core_Core.G
687
677
  }
688
678
 
689
679
  export async function Json_map$(self_, body_, $task) {
690
- const stack_ = ff_core_Stack.make_();
680
+ const array_ = ff_core_Array.make_();
691
681
  (await ff_core_Json.Json_each$(self_, (async (field_, value_, $task) => {
692
- ff_core_Stack.Stack_push(stack_, (await body_(field_, value_, $task)))
682
+ ff_core_Array.Array_push(array_, (await body_(field_, value_, $task)))
693
683
  }), $task));
694
- return ff_core_Stack.Stack_drain(stack_)
684
+ return ff_core_Array.Array_drain(array_)
695
685
  }
696
686
 
697
687
  export async function Json_flatMap$(self_, body_, $task) {
698
- const stack_ = ff_core_Stack.make_();
688
+ const array_ = ff_core_Array.make_();
699
689
  (await ff_core_Json.Json_each$(self_, (async (field_, value_, $task) => {
700
- ff_core_Stack.Stack_pushArray(stack_, (await body_(field_, value_, $task)))
690
+ ff_core_Array.Array_pushList(array_, (await body_(field_, value_, $task)))
701
691
  }), $task));
702
- return ff_core_Stack.Stack_drain(stack_)
692
+ return ff_core_Array.Array_drain(array_)
703
693
  }
704
694
 
705
695
  export async function Json_each$(self_, body_, $task) {
@@ -847,17 +837,17 @@ return
847
837
  }
848
838
  };
849
839
 
850
- export function ff_core_Json_JsonLike$ff_core_Array_Array(ff_core_Json_JsonLike$T) { return {
840
+ export function ff_core_Json_JsonLike$ff_core_List_List(ff_core_Json_JsonLike$T) { return {
851
841
  toJson_(value_) {
852
- return ff_core_Json.array_(ff_core_Array.Array_map(value_, ((value_) => {
842
+ return ff_core_Json.array_(ff_core_List.List_map(value_, ((value_) => {
853
843
  return ff_core_Json_JsonLike$T.toJson_(value_)
854
844
  })))
855
845
  },
856
846
  fromJson_(json_) {
857
847
  return ff_core_Option.Option_flatMap(ff_core_Json.Json_getArray(json_), ((array_) => {
858
848
  let convertible_ = true;
859
- const stack_ = ff_core_Stack.make_();
860
- ff_core_Array.Array_eachWhile(array_, ((item_) => {
849
+ const result_ = ff_core_Array.make_();
850
+ ff_core_List.List_eachWhile(array_, ((item_) => {
861
851
  do {
862
852
  const _1 = ff_core_Json_JsonLike$T.fromJson_(item_);
863
853
  {
@@ -869,7 +859,7 @@ break
869
859
  {
870
860
  if(_1.Some) {
871
861
  const value_ = _1.value_;
872
- ff_core_Stack.Stack_push(stack_, value_)
862
+ ff_core_Array.Array_push(result_, value_)
873
863
  break
874
864
  }
875
865
  }
@@ -877,20 +867,20 @@ break
877
867
  return convertible_
878
868
  }));
879
869
  if(convertible_) {
880
- return ff_core_Option.Some(ff_core_Stack.Stack_drain(stack_))
870
+ return ff_core_Option.Some(ff_core_Array.Array_drain(result_))
881
871
  } else return ff_core_Option.None()
882
872
  }))
883
873
  },
884
874
  async toJson_$(value_, $task) {
885
- return ff_core_Json.array_(ff_core_Array.Array_map(value_, ((value_) => {
875
+ return ff_core_Json.array_(ff_core_List.List_map(value_, ((value_) => {
886
876
  return ff_core_Json_JsonLike$T.toJson_(value_)
887
877
  })))
888
878
  },
889
879
  async fromJson_$(json_, $task) {
890
880
  return ff_core_Option.Option_flatMap(ff_core_Json.Json_getArray(json_), ((array_) => {
891
881
  let convertible_ = true;
892
- const stack_ = ff_core_Stack.make_();
893
- ff_core_Array.Array_eachWhile(array_, ((item_) => {
882
+ const result_ = ff_core_Array.make_();
883
+ ff_core_List.List_eachWhile(array_, ((item_) => {
894
884
  do {
895
885
  const _1 = ff_core_Json_JsonLike$T.fromJson_(item_);
896
886
  {
@@ -902,7 +892,7 @@ break
902
892
  {
903
893
  if(_1.Some) {
904
894
  const value_ = _1.value_;
905
- ff_core_Stack.Stack_push(stack_, value_)
895
+ ff_core_Array.Array_push(result_, value_)
906
896
  break
907
897
  }
908
898
  }
@@ -910,35 +900,12 @@ break
910
900
  return convertible_
911
901
  }));
912
902
  if(convertible_) {
913
- return ff_core_Option.Some(ff_core_Stack.Stack_drain(stack_))
903
+ return ff_core_Option.Some(ff_core_Array.Array_drain(result_))
914
904
  } else return ff_core_Option.None()
915
905
  }))
916
906
  }
917
907
  }}
918
908
 
919
- export function ff_core_Json_JsonLike$ff_core_List_List(ff_core_Json_JsonLike$T) { return {
920
- toJson_(value_) {
921
- return ff_core_Json.list_(ff_core_List.List_map(value_, ((value_) => {
922
- return ff_core_Json_JsonLike$T.toJson_(value_)
923
- })))
924
- },
925
- fromJson_(json_) {
926
- return ff_core_Option.Option_map(ff_core_Json.ff_core_Json_JsonLike$ff_core_Array_Array(ff_core_Json_JsonLike$T).fromJson_(json_), ((_w1) => {
927
- return ff_core_Array.Array_toList(_w1)
928
- }))
929
- },
930
- async toJson_$(value_, $task) {
931
- return ff_core_Json.list_(ff_core_List.List_map(value_, ((value_) => {
932
- return ff_core_Json_JsonLike$T.toJson_(value_)
933
- })))
934
- },
935
- async fromJson_$(json_, $task) {
936
- return ff_core_Option.Option_map(ff_core_Json.ff_core_Json_JsonLike$ff_core_Array_Array(ff_core_Json_JsonLike$T).fromJson_(json_), ((_w1) => {
937
- return ff_core_Array.Array_toList(_w1)
938
- }))
939
- }
940
- }}
941
-
942
909
  export function ff_core_Json_JsonLike$ff_core_StringMap_StringMap(ff_core_Json_JsonLike$T) { return {
943
910
  toJson_(value_) {
944
911
  return ff_core_Json.fields_(((setField_) => {