jade-lang 0.1.0

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 (326) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +23 -0
  3. data/LICENSE +21 -0
  4. data/README.md +386 -0
  5. data/exe/jade +6 -0
  6. data/lib/jade/ast/node.rb +44 -0
  7. data/lib/jade/ast/nodes.rb +35 -0
  8. data/lib/jade/ast/pretty_printer.rb +50 -0
  9. data/lib/jade/ast.rb +723 -0
  10. data/lib/jade/calendar/runtime.rb +15 -0
  11. data/lib/jade/cli/fmt.rb +96 -0
  12. data/lib/jade/cli/lsp.rb +13 -0
  13. data/lib/jade/cli/q.rb +113 -0
  14. data/lib/jade/cli.rb +43 -0
  15. data/lib/jade/clock/runtime.rb +13 -0
  16. data/lib/jade/codegen/boundary/cache.rb +94 -0
  17. data/lib/jade/codegen/boundary/specialized/list.rb +65 -0
  18. data/lib/jade/codegen/boundary/specialized/maybe.rb +40 -0
  19. data/lib/jade/codegen/boundary/specialized/record.rb +165 -0
  20. data/lib/jade/codegen/boundary/specialized/scalar.rb +67 -0
  21. data/lib/jade/codegen/boundary/specialized.rb +106 -0
  22. data/lib/jade/codegen/boundary.rb +189 -0
  23. data/lib/jade/codegen/constructor_reference.rb +18 -0
  24. data/lib/jade/codegen/context.rb +96 -0
  25. data/lib/jade/codegen/emitter.rb +81 -0
  26. data/lib/jade/codegen/function_call.rb +367 -0
  27. data/lib/jade/codegen/function_declaration.rb +199 -0
  28. data/lib/jade/codegen/helpers.rb +103 -0
  29. data/lib/jade/codegen/implementation.rb +178 -0
  30. data/lib/jade/codegen/inline.rb +89 -0
  31. data/lib/jade/codegen/inlines.rb +326 -0
  32. data/lib/jade/codegen/method_names.rb +54 -0
  33. data/lib/jade/codegen/pattern/constructor.rb +57 -0
  34. data/lib/jade/codegen/port_decoder.rb +77 -0
  35. data/lib/jade/codegen/pretty.rb +53 -0
  36. data/lib/jade/codegen/transforms/fold_shape.rb +222 -0
  37. data/lib/jade/codegen/transforms/self_call.rb +80 -0
  38. data/lib/jade/codegen/transforms/tail_call.rb +120 -0
  39. data/lib/jade/codegen/variant_declaration.rb +41 -0
  40. data/lib/jade/codegen.rb +400 -0
  41. data/lib/jade/compiler.rb +69 -0
  42. data/lib/jade/decode.rb +320 -0
  43. data/lib/jade/diagnostics/renderer.rb +121 -0
  44. data/lib/jade/diagnostics.rb +77 -0
  45. data/lib/jade/did_you_mean.rb +16 -0
  46. data/lib/jade/entry.rb +177 -0
  47. data/lib/jade/error.rb +72 -0
  48. data/lib/jade/formatter/accesses.rb +37 -0
  49. data/lib/jade/formatter/bindings.rb +29 -0
  50. data/lib/jade/formatter/body.rb +50 -0
  51. data/lib/jade/formatter/calls.rb +51 -0
  52. data/lib/jade/formatter/case_of.rb +31 -0
  53. data/lib/jade/formatter/case_of_branch.rb +59 -0
  54. data/lib/jade/formatter/collections.rb +78 -0
  55. data/lib/jade/formatter/declarations.rb +178 -0
  56. data/lib/jade/formatter/exposing.rb +48 -0
  57. data/lib/jade/formatter/function_declaration.rb +72 -0
  58. data/lib/jade/formatter/helper.rb +122 -0
  59. data/lib/jade/formatter/if_then_else.rb +64 -0
  60. data/lib/jade/formatter/infix_application.rb +69 -0
  61. data/lib/jade/formatter/lambda.rb +50 -0
  62. data/lib/jade/formatter/leaves.rb +111 -0
  63. data/lib/jade/formatter/module_node.rb +26 -0
  64. data/lib/jade/formatter/pattern.rb +61 -0
  65. data/lib/jade/formatter/type.rb +67 -0
  66. data/lib/jade/formatter.rb +38 -0
  67. data/lib/jade/frontend/comment_attacher.rb +121 -0
  68. data/lib/jade/frontend/desugaring/placeholder.rb +39 -0
  69. data/lib/jade/frontend/desugaring/resolved.rb +63 -0
  70. data/lib/jade/frontend/desugaring.rb +217 -0
  71. data/lib/jade/frontend/fixity_fixer.rb +209 -0
  72. data/lib/jade/frontend/forward_declaration/body.rb +30 -0
  73. data/lib/jade/frontend/forward_declaration/error/bad_import.rb +19 -0
  74. data/lib/jade/frontend/forward_declaration/error/exposed_type_not_found.rb +18 -0
  75. data/lib/jade/frontend/forward_declaration/error/exposed_value_not_found.rb +18 -0
  76. data/lib/jade/frontend/forward_declaration/error/module_not_found.rb +18 -0
  77. data/lib/jade/frontend/forward_declaration/error/private_type_expansion.rb +19 -0
  78. data/lib/jade/frontend/forward_declaration/error/tuple_arity_overflow.rb +25 -0
  79. data/lib/jade/frontend/forward_declaration/error/type_not_found.rb +29 -0
  80. data/lib/jade/frontend/forward_declaration/error/type_not_lowerable.rb +16 -0
  81. data/lib/jade/frontend/forward_declaration/error/unknown_extends_interface.rb +18 -0
  82. data/lib/jade/frontend/forward_declaration/error.rb +11 -0
  83. data/lib/jade/frontend/forward_declaration/function_declaration.rb +32 -0
  84. data/lib/jade/frontend/forward_declaration/helper.rb +91 -0
  85. data/lib/jade/frontend/forward_declaration/implementation.rb +63 -0
  86. data/lib/jade/frontend/forward_declaration/implementation_function.rb +39 -0
  87. data/lib/jade/frontend/forward_declaration/import_declaration.rb +115 -0
  88. data/lib/jade/frontend/forward_declaration/interface_declaration.rb +66 -0
  89. data/lib/jade/frontend/forward_declaration/interop_import_declaration.rb +99 -0
  90. data/lib/jade/frontend/forward_declaration/module.rb +98 -0
  91. data/lib/jade/frontend/forward_declaration/struct_declaration.rb +42 -0
  92. data/lib/jade/frontend/forward_declaration/type_declaration.rb +42 -0
  93. data/lib/jade/frontend/forward_declaration.rb +71 -0
  94. data/lib/jade/frontend/pattern_analysis/exhaustiveness.rb +65 -0
  95. data/lib/jade/frontend/pattern_analysis/matrix.rb +235 -0
  96. data/lib/jade/frontend/pattern_analysis.rb +40 -0
  97. data/lib/jade/frontend/semantic_analysis/assign.rb +20 -0
  98. data/lib/jade/frontend/semantic_analysis/body.rb +33 -0
  99. data/lib/jade/frontend/semantic_analysis/case_of.rb +19 -0
  100. data/lib/jade/frontend/semantic_analysis/case_of_branch.rb +20 -0
  101. data/lib/jade/frontend/semantic_analysis/char_literal.rb +14 -0
  102. data/lib/jade/frontend/semantic_analysis/constructor_reference.rb +64 -0
  103. data/lib/jade/frontend/semantic_analysis/error/circular_extends.rb +19 -0
  104. data/lib/jade/frontend/semantic_analysis/error/constant_not_callable.rb +24 -0
  105. data/lib/jade/frontend/semantic_analysis/error/constructor_not_found.rb +34 -0
  106. data/lib/jade/frontend/semantic_analysis/error/constructor_pattern_arity_mismatch.rb +24 -0
  107. data/lib/jade/frontend/semantic_analysis/error/duplicate_field.rb +18 -0
  108. data/lib/jade/frontend/semantic_analysis/error/duplicate_function_declaration.rb +25 -0
  109. data/lib/jade/frontend/semantic_analysis/error/duplicate_record_field.rb +19 -0
  110. data/lib/jade/frontend/semantic_analysis/error/invalid_list_rest_pattern.rb +21 -0
  111. data/lib/jade/frontend/semantic_analysis/error/kwargs_on_non_constructor.rb +17 -0
  112. data/lib/jade/frontend/semantic_analysis/error/missing_exposing_clause.rb +17 -0
  113. data/lib/jade/frontend/semantic_analysis/error/missing_extends_implementation.rb +21 -0
  114. data/lib/jade/frontend/semantic_analysis/error/missing_field.rb +20 -0
  115. data/lib/jade/frontend/semantic_analysis/error/missing_implementation_function.rb +19 -0
  116. data/lib/jade/frontend/semantic_analysis/error/module_not_found.rb +22 -0
  117. data/lib/jade/frontend/semantic_analysis/error/nested_task_port.rb +19 -0
  118. data/lib/jade/frontend/semantic_analysis/error/non_task_port.rb +22 -0
  119. data/lib/jade/frontend/semantic_analysis/error/orphan_implementation.rb +20 -0
  120. data/lib/jade/frontend/semantic_analysis/error/predicate_must_return_bool.rb +22 -0
  121. data/lib/jade/frontend/semantic_analysis/error/predicate_name_not_allowed.rb +25 -0
  122. data/lib/jade/frontend/semantic_analysis/error/shadowing_error.rb +22 -0
  123. data/lib/jade/frontend/semantic_analysis/error/type_args_mismatch.rb +25 -0
  124. data/lib/jade/frontend/semantic_analysis/error/type_param_required.rb +19 -0
  125. data/lib/jade/frontend/semantic_analysis/error/unbound_type_variable.rb +22 -0
  126. data/lib/jade/frontend/semantic_analysis/error/undefined_variable.rb +29 -0
  127. data/lib/jade/frontend/semantic_analysis/error/unknown_field.rb +20 -0
  128. data/lib/jade/frontend/semantic_analysis/error/unknown_implementation_function.rb +19 -0
  129. data/lib/jade/frontend/semantic_analysis/error/unused_interface_type_param.rb +24 -0
  130. data/lib/jade/frontend/semantic_analysis/error/value_not_exposed.rb +23 -0
  131. data/lib/jade/frontend/semantic_analysis/error/variable_not_found.rb +25 -0
  132. data/lib/jade/frontend/semantic_analysis/error.rb +40 -0
  133. data/lib/jade/frontend/semantic_analysis/function_call.rb +60 -0
  134. data/lib/jade/frontend/semantic_analysis/function_declaration.rb +58 -0
  135. data/lib/jade/frontend/semantic_analysis/grouping.rb +17 -0
  136. data/lib/jade/frontend/semantic_analysis/helper.rb +152 -0
  137. data/lib/jade/frontend/semantic_analysis/if_then_else.rb +20 -0
  138. data/lib/jade/frontend/semantic_analysis/implementation.rb +143 -0
  139. data/lib/jade/frontend/semantic_analysis/implementation_function.rb +16 -0
  140. data/lib/jade/frontend/semantic_analysis/import_declaration.rb +14 -0
  141. data/lib/jade/frontend/semantic_analysis/interface_declaration.rb +45 -0
  142. data/lib/jade/frontend/semantic_analysis/interop_import_declaration.rb +69 -0
  143. data/lib/jade/frontend/semantic_analysis/keyed_call/validation.rb +109 -0
  144. data/lib/jade/frontend/semantic_analysis/keyed_call.rb +88 -0
  145. data/lib/jade/frontend/semantic_analysis/lambda.rb +23 -0
  146. data/lib/jade/frontend/semantic_analysis/list.rb +17 -0
  147. data/lib/jade/frontend/semantic_analysis/literal.rb +23 -0
  148. data/lib/jade/frontend/semantic_analysis/member_access.rb +87 -0
  149. data/lib/jade/frontend/semantic_analysis/module_node.rb +27 -0
  150. data/lib/jade/frontend/semantic_analysis/pattern_binding.rb +27 -0
  151. data/lib/jade/frontend/semantic_analysis/pattern_constructor.rb +47 -0
  152. data/lib/jade/frontend/semantic_analysis/pattern_list.rb +33 -0
  153. data/lib/jade/frontend/semantic_analysis/pattern_literal.rb +17 -0
  154. data/lib/jade/frontend/semantic_analysis/pattern_record.rb +25 -0
  155. data/lib/jade/frontend/semantic_analysis/pattern_wildcard.rb +14 -0
  156. data/lib/jade/frontend/semantic_analysis/qualified_access.rb +14 -0
  157. data/lib/jade/frontend/semantic_analysis/record_access.rb +14 -0
  158. data/lib/jade/frontend/semantic_analysis/record_field.rb +17 -0
  159. data/lib/jade/frontend/semantic_analysis/record_literal.rb +21 -0
  160. data/lib/jade/frontend/semantic_analysis/record_update.rb +21 -0
  161. data/lib/jade/frontend/semantic_analysis/struct_declaration.rb +44 -0
  162. data/lib/jade/frontend/semantic_analysis/tuple.rb +17 -0
  163. data/lib/jade/frontend/semantic_analysis/type_declaration.rb +69 -0
  164. data/lib/jade/frontend/semantic_analysis/variable_reference.rb +27 -0
  165. data/lib/jade/frontend/semantic_analysis/variant_declaration.rb +18 -0
  166. data/lib/jade/frontend/semantic_analysis.rb +161 -0
  167. data/lib/jade/frontend/type_checking/canonicalize.rb +97 -0
  168. data/lib/jade/frontend/type_checking/constraints/deriving/decodable.rb +144 -0
  169. data/lib/jade/frontend/type_checking/constraints/deriving/encodable.rb +144 -0
  170. data/lib/jade/frontend/type_checking/constraints/deriving/eq.rb +265 -0
  171. data/lib/jade/frontend/type_checking/constraints/deriving/helpers.rb +59 -0
  172. data/lib/jade/frontend/type_checking/constraints/deriving.rb +28 -0
  173. data/lib/jade/frontend/type_checking/constraints.rb +101 -0
  174. data/lib/jade/frontend/type_checking/definition.rb +71 -0
  175. data/lib/jade/frontend/type_checking/env.rb +79 -0
  176. data/lib/jade/frontend/type_checking/error/case_of_branches_type_mismatch.rb +19 -0
  177. data/lib/jade/frontend/type_checking/error/derivation_failed.rb +21 -0
  178. data/lib/jade/frontend/type_checking/error/function_body_type_mismatch.rb +23 -0
  179. data/lib/jade/frontend/type_checking/error/function_call_type_mismatch.rb +37 -0
  180. data/lib/jade/frontend/type_checking/error/if_branch_type_mismatch.rb +19 -0
  181. data/lib/jade/frontend/type_checking/error/if_branches_type_mismatch.rb +18 -0
  182. data/lib/jade/frontend/type_checking/error/if_condition_type_mismatch.rb +17 -0
  183. data/lib/jade/frontend/type_checking/error/implementation_type_mismatch.rb +20 -0
  184. data/lib/jade/frontend/type_checking/error/list_item_type_mismatch.rb +19 -0
  185. data/lib/jade/frontend/type_checking/error/missing_implementation.rb +20 -0
  186. data/lib/jade/frontend/type_checking/error/missing_patterns.rb +26 -0
  187. data/lib/jade/frontend/type_checking/error/pattern_type_mismatch.rb +13 -0
  188. data/lib/jade/frontend/type_checking/error/port_not_decodable.rb +38 -0
  189. data/lib/jade/frontend/type_checking/error/record_access_type_mismatch.rb +14 -0
  190. data/lib/jade/frontend/type_checking/error/type_mismatch.rb +23 -0
  191. data/lib/jade/frontend/type_checking/error/unresolved_constraint.rb +20 -0
  192. data/lib/jade/frontend/type_checking/error.rb +18 -0
  193. data/lib/jade/frontend/type_checking/expected.rb +23 -0
  194. data/lib/jade/frontend/type_checking/generalization.rb +17 -0
  195. data/lib/jade/frontend/type_checking/generalizer.rb +38 -0
  196. data/lib/jade/frontend/type_checking/inference/assign.rb +58 -0
  197. data/lib/jade/frontend/type_checking/inference/body.rb +45 -0
  198. data/lib/jade/frontend/type_checking/inference/case_of.rb +102 -0
  199. data/lib/jade/frontend/type_checking/inference/constructor_reference.rb +21 -0
  200. data/lib/jade/frontend/type_checking/inference/function_call.rb +132 -0
  201. data/lib/jade/frontend/type_checking/inference/function_declaration.rb +70 -0
  202. data/lib/jade/frontend/type_checking/inference/grouping.rb +18 -0
  203. data/lib/jade/frontend/type_checking/inference/helpers.rb +34 -0
  204. data/lib/jade/frontend/type_checking/inference/if_then_else.rb +46 -0
  205. data/lib/jade/frontend/type_checking/inference/implementation.rb +150 -0
  206. data/lib/jade/frontend/type_checking/inference/import_declaration.rb +19 -0
  207. data/lib/jade/frontend/type_checking/inference/interface_declaration.rb +18 -0
  208. data/lib/jade/frontend/type_checking/inference/interop_import_declaration.rb +18 -0
  209. data/lib/jade/frontend/type_checking/inference/lambda.rb +87 -0
  210. data/lib/jade/frontend/type_checking/inference/list.rb +52 -0
  211. data/lib/jade/frontend/type_checking/inference/literal.rb +24 -0
  212. data/lib/jade/frontend/type_checking/inference/module.rb +18 -0
  213. data/lib/jade/frontend/type_checking/inference/pattern.rb +135 -0
  214. data/lib/jade/frontend/type_checking/inference/qualified_access.rb +23 -0
  215. data/lib/jade/frontend/type_checking/inference/record_access.rb +35 -0
  216. data/lib/jade/frontend/type_checking/inference/record_field.rb +19 -0
  217. data/lib/jade/frontend/type_checking/inference/record_literal.rb +24 -0
  218. data/lib/jade/frontend/type_checking/inference/record_update.rb +37 -0
  219. data/lib/jade/frontend/type_checking/inference/struct_declaration.rb +18 -0
  220. data/lib/jade/frontend/type_checking/inference/type_declaration.rb +18 -0
  221. data/lib/jade/frontend/type_checking/inference/variable_reference.rb +27 -0
  222. data/lib/jade/frontend/type_checking/inference.rb +27 -0
  223. data/lib/jade/frontend/type_checking/instantiation.rb +24 -0
  224. data/lib/jade/frontend/type_checking/loader.rb +80 -0
  225. data/lib/jade/frontend/type_checking/placeholder.rb +12 -0
  226. data/lib/jade/frontend/type_checking/port_resolution.rb +123 -0
  227. data/lib/jade/frontend/type_checking/result.rb +41 -0
  228. data/lib/jade/frontend/type_checking/scheme.rb +20 -0
  229. data/lib/jade/frontend/type_checking/state.rb +52 -0
  230. data/lib/jade/frontend/type_checking/substitution.rb +93 -0
  231. data/lib/jade/frontend/type_checking/unification.rb +282 -0
  232. data/lib/jade/frontend/type_checking/var_gen.rb +33 -0
  233. data/lib/jade/frontend/type_checking.rb +129 -0
  234. data/lib/jade/frontend/unused_analysis.rb +41 -0
  235. data/lib/jade/frontend/usage_analysis/reference_index.rb +53 -0
  236. data/lib/jade/frontend/usage_analysis.rb +195 -0
  237. data/lib/jade/frontend.rb +101 -0
  238. data/lib/jade/interop/boundary.rb +68 -0
  239. data/lib/jade/interop/error.rb +84 -0
  240. data/lib/jade/interop/lowering/error.rb +32 -0
  241. data/lib/jade/interop/lowering.rb +53 -0
  242. data/lib/jade/interop/runtime.rb +24 -0
  243. data/lib/jade/interop.rb +1 -0
  244. data/lib/jade/lexer.rb +189 -0
  245. data/lib/jade/lsp/converters.rb +542 -0
  246. data/lib/jade/lsp/handlers.rb +340 -0
  247. data/lib/jade/lsp/server.rb +63 -0
  248. data/lib/jade/lsp/snippets.rb +100 -0
  249. data/lib/jade/lsp/state.rb +25 -0
  250. data/lib/jade/lsp.rb +16 -0
  251. data/lib/jade/module_loader/cache.rb +56 -0
  252. data/lib/jade/module_loader/dependency_graph.rb +23 -0
  253. data/lib/jade/module_loader/dependency_resolver.rb +48 -0
  254. data/lib/jade/module_loader/normalize.rb +34 -0
  255. data/lib/jade/module_loader/topological_sort.rb +41 -0
  256. data/lib/jade/module_loader.rb +127 -0
  257. data/lib/jade/parsing/combinators.rb +291 -0
  258. data/lib/jade/parsing/error.rb +154 -0
  259. data/lib/jade/parsing/token.rb +12 -0
  260. data/lib/jade/parsing/type.rb +92 -0
  261. data/lib/jade/parsing.rb +674 -0
  262. data/lib/jade/port.rb +1 -0
  263. data/lib/jade/registry.rb +79 -0
  264. data/lib/jade/result.rb +121 -0
  265. data/lib/jade/runtime.rb +127 -0
  266. data/lib/jade/source.rb +62 -0
  267. data/lib/jade/stdlib/basics.rb +214 -0
  268. data/lib/jade/stdlib/bytes.rb +70 -0
  269. data/lib/jade/stdlib/calendar.rb +405 -0
  270. data/lib/jade/stdlib/char.rb +27 -0
  271. data/lib/jade/stdlib/clock.rb +342 -0
  272. data/lib/jade/stdlib/compiled.rb +48 -0
  273. data/lib/jade/stdlib/decode/params.rb +154 -0
  274. data/lib/jade/stdlib/decode.rb +315 -0
  275. data/lib/jade/stdlib/dict.rb +134 -0
  276. data/lib/jade/stdlib/encode.rb +143 -0
  277. data/lib/jade/stdlib/intrinsics.rb +280 -0
  278. data/lib/jade/stdlib/list.rb +214 -0
  279. data/lib/jade/stdlib/maybe.rb +73 -0
  280. data/lib/jade/stdlib/result.rb +131 -0
  281. data/lib/jade/stdlib/set.rb +123 -0
  282. data/lib/jade/stdlib/string.rb +65 -0
  283. data/lib/jade/stdlib/task.rb +55 -0
  284. data/lib/jade/stdlib/tuple.rb +21 -0
  285. data/lib/jade/stdlib.rb +112 -0
  286. data/lib/jade/symbol/anonymous_record.rb +7 -0
  287. data/lib/jade/symbol/base.rb +15 -0
  288. data/lib/jade/symbol/constructor.rb +11 -0
  289. data/lib/jade/symbol/derived_function.rb +5 -0
  290. data/lib/jade/symbol/function.rb +15 -0
  291. data/lib/jade/symbol/function_type.rb +7 -0
  292. data/lib/jade/symbol/implementation.rb +17 -0
  293. data/lib/jade/symbol/implementation_template.rb +13 -0
  294. data/lib/jade/symbol/interface.rb +11 -0
  295. data/lib/jade/symbol/interface_function.rb +18 -0
  296. data/lib/jade/symbol/interop_function.rb +22 -0
  297. data/lib/jade/symbol/lambda.rb +7 -0
  298. data/lib/jade/symbol/parser.rb +79 -0
  299. data/lib/jade/symbol/partial_application.rb +7 -0
  300. data/lib/jade/symbol/record_type.rb +8 -0
  301. data/lib/jade/symbol/stdlib_function.rb +15 -0
  302. data/lib/jade/symbol/stdlib_implementation.rb +7 -0
  303. data/lib/jade/symbol/struct.rb +15 -0
  304. data/lib/jade/symbol/type_application.rb +8 -0
  305. data/lib/jade/symbol/type_ref.rb +11 -0
  306. data/lib/jade/symbol/union.rb +15 -0
  307. data/lib/jade/symbol/value_ref.rb +15 -0
  308. data/lib/jade/symbol/variable.rb +7 -0
  309. data/lib/jade/symbol/variant.rb +11 -0
  310. data/lib/jade/symbol.rb +162 -0
  311. data/lib/jade/task.rb +103 -0
  312. data/lib/jade/tasks/rspec.rb +266 -0
  313. data/lib/jade/tasks.rb +70 -0
  314. data/lib/jade/type/anonymous_record.rb +33 -0
  315. data/lib/jade/type/application.rb +21 -0
  316. data/lib/jade/type/base.rb +9 -0
  317. data/lib/jade/type/constraint.rb +17 -0
  318. data/lib/jade/type/constructor.rb +19 -0
  319. data/lib/jade/type/function.rb +18 -0
  320. data/lib/jade/type/partial_application.rb +17 -0
  321. data/lib/jade/type/unit.rb +15 -0
  322. data/lib/jade/type/var.rb +21 -0
  323. data/lib/jade/type.rb +259 -0
  324. data/lib/jade/version.rb +3 -0
  325. data/lib/jade.rb +55 -0
  326. metadata +387 -0
metadata ADDED
@@ -0,0 +1,387 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jade-lang
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Agustin Cornu
8
+ bindir: exe
9
+ cert_chain: []
10
+ date: 2026-06-14 00:00:00.000000000 Z
11
+ dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: base64
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - "~>"
17
+ - !ruby/object:Gem::Version
18
+ version: '0.2'
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - "~>"
24
+ - !ruby/object:Gem::Version
25
+ version: '0.2'
26
+ description: |
27
+ Jade is a statically typed functional language, inspired by Elm, that
28
+ compiles to readable Ruby. It brings Hindley-Milner type inference, union
29
+ types, records, exhaustive pattern matching, and typed boundaries to the
30
+ Ruby ecosystem, while staying interoperable with existing Ruby code.
31
+ email:
32
+ - agustincornu@fastmail.com
33
+ executables:
34
+ - jade
35
+ extensions: []
36
+ extra_rdoc_files: []
37
+ files:
38
+ - CHANGELOG.md
39
+ - LICENSE
40
+ - README.md
41
+ - exe/jade
42
+ - lib/jade.rb
43
+ - lib/jade/ast.rb
44
+ - lib/jade/ast/node.rb
45
+ - lib/jade/ast/nodes.rb
46
+ - lib/jade/ast/pretty_printer.rb
47
+ - lib/jade/calendar/runtime.rb
48
+ - lib/jade/cli.rb
49
+ - lib/jade/cli/fmt.rb
50
+ - lib/jade/cli/lsp.rb
51
+ - lib/jade/cli/q.rb
52
+ - lib/jade/clock/runtime.rb
53
+ - lib/jade/codegen.rb
54
+ - lib/jade/codegen/boundary.rb
55
+ - lib/jade/codegen/boundary/cache.rb
56
+ - lib/jade/codegen/boundary/specialized.rb
57
+ - lib/jade/codegen/boundary/specialized/list.rb
58
+ - lib/jade/codegen/boundary/specialized/maybe.rb
59
+ - lib/jade/codegen/boundary/specialized/record.rb
60
+ - lib/jade/codegen/boundary/specialized/scalar.rb
61
+ - lib/jade/codegen/constructor_reference.rb
62
+ - lib/jade/codegen/context.rb
63
+ - lib/jade/codegen/emitter.rb
64
+ - lib/jade/codegen/function_call.rb
65
+ - lib/jade/codegen/function_declaration.rb
66
+ - lib/jade/codegen/helpers.rb
67
+ - lib/jade/codegen/implementation.rb
68
+ - lib/jade/codegen/inline.rb
69
+ - lib/jade/codegen/inlines.rb
70
+ - lib/jade/codegen/method_names.rb
71
+ - lib/jade/codegen/pattern/constructor.rb
72
+ - lib/jade/codegen/port_decoder.rb
73
+ - lib/jade/codegen/pretty.rb
74
+ - lib/jade/codegen/transforms/fold_shape.rb
75
+ - lib/jade/codegen/transforms/self_call.rb
76
+ - lib/jade/codegen/transforms/tail_call.rb
77
+ - lib/jade/codegen/variant_declaration.rb
78
+ - lib/jade/compiler.rb
79
+ - lib/jade/decode.rb
80
+ - lib/jade/diagnostics.rb
81
+ - lib/jade/diagnostics/renderer.rb
82
+ - lib/jade/did_you_mean.rb
83
+ - lib/jade/entry.rb
84
+ - lib/jade/error.rb
85
+ - lib/jade/formatter.rb
86
+ - lib/jade/formatter/accesses.rb
87
+ - lib/jade/formatter/bindings.rb
88
+ - lib/jade/formatter/body.rb
89
+ - lib/jade/formatter/calls.rb
90
+ - lib/jade/formatter/case_of.rb
91
+ - lib/jade/formatter/case_of_branch.rb
92
+ - lib/jade/formatter/collections.rb
93
+ - lib/jade/formatter/declarations.rb
94
+ - lib/jade/formatter/exposing.rb
95
+ - lib/jade/formatter/function_declaration.rb
96
+ - lib/jade/formatter/helper.rb
97
+ - lib/jade/formatter/if_then_else.rb
98
+ - lib/jade/formatter/infix_application.rb
99
+ - lib/jade/formatter/lambda.rb
100
+ - lib/jade/formatter/leaves.rb
101
+ - lib/jade/formatter/module_node.rb
102
+ - lib/jade/formatter/pattern.rb
103
+ - lib/jade/formatter/type.rb
104
+ - lib/jade/frontend.rb
105
+ - lib/jade/frontend/comment_attacher.rb
106
+ - lib/jade/frontend/desugaring.rb
107
+ - lib/jade/frontend/desugaring/placeholder.rb
108
+ - lib/jade/frontend/desugaring/resolved.rb
109
+ - lib/jade/frontend/fixity_fixer.rb
110
+ - lib/jade/frontend/forward_declaration.rb
111
+ - lib/jade/frontend/forward_declaration/body.rb
112
+ - lib/jade/frontend/forward_declaration/error.rb
113
+ - lib/jade/frontend/forward_declaration/error/bad_import.rb
114
+ - lib/jade/frontend/forward_declaration/error/exposed_type_not_found.rb
115
+ - lib/jade/frontend/forward_declaration/error/exposed_value_not_found.rb
116
+ - lib/jade/frontend/forward_declaration/error/module_not_found.rb
117
+ - lib/jade/frontend/forward_declaration/error/private_type_expansion.rb
118
+ - lib/jade/frontend/forward_declaration/error/tuple_arity_overflow.rb
119
+ - lib/jade/frontend/forward_declaration/error/type_not_found.rb
120
+ - lib/jade/frontend/forward_declaration/error/type_not_lowerable.rb
121
+ - lib/jade/frontend/forward_declaration/error/unknown_extends_interface.rb
122
+ - lib/jade/frontend/forward_declaration/function_declaration.rb
123
+ - lib/jade/frontend/forward_declaration/helper.rb
124
+ - lib/jade/frontend/forward_declaration/implementation.rb
125
+ - lib/jade/frontend/forward_declaration/implementation_function.rb
126
+ - lib/jade/frontend/forward_declaration/import_declaration.rb
127
+ - lib/jade/frontend/forward_declaration/interface_declaration.rb
128
+ - lib/jade/frontend/forward_declaration/interop_import_declaration.rb
129
+ - lib/jade/frontend/forward_declaration/module.rb
130
+ - lib/jade/frontend/forward_declaration/struct_declaration.rb
131
+ - lib/jade/frontend/forward_declaration/type_declaration.rb
132
+ - lib/jade/frontend/pattern_analysis.rb
133
+ - lib/jade/frontend/pattern_analysis/exhaustiveness.rb
134
+ - lib/jade/frontend/pattern_analysis/matrix.rb
135
+ - lib/jade/frontend/semantic_analysis.rb
136
+ - lib/jade/frontend/semantic_analysis/assign.rb
137
+ - lib/jade/frontend/semantic_analysis/body.rb
138
+ - lib/jade/frontend/semantic_analysis/case_of.rb
139
+ - lib/jade/frontend/semantic_analysis/case_of_branch.rb
140
+ - lib/jade/frontend/semantic_analysis/char_literal.rb
141
+ - lib/jade/frontend/semantic_analysis/constructor_reference.rb
142
+ - lib/jade/frontend/semantic_analysis/error.rb
143
+ - lib/jade/frontend/semantic_analysis/error/circular_extends.rb
144
+ - lib/jade/frontend/semantic_analysis/error/constant_not_callable.rb
145
+ - lib/jade/frontend/semantic_analysis/error/constructor_not_found.rb
146
+ - lib/jade/frontend/semantic_analysis/error/constructor_pattern_arity_mismatch.rb
147
+ - lib/jade/frontend/semantic_analysis/error/duplicate_field.rb
148
+ - lib/jade/frontend/semantic_analysis/error/duplicate_function_declaration.rb
149
+ - lib/jade/frontend/semantic_analysis/error/duplicate_record_field.rb
150
+ - lib/jade/frontend/semantic_analysis/error/invalid_list_rest_pattern.rb
151
+ - lib/jade/frontend/semantic_analysis/error/kwargs_on_non_constructor.rb
152
+ - lib/jade/frontend/semantic_analysis/error/missing_exposing_clause.rb
153
+ - lib/jade/frontend/semantic_analysis/error/missing_extends_implementation.rb
154
+ - lib/jade/frontend/semantic_analysis/error/missing_field.rb
155
+ - lib/jade/frontend/semantic_analysis/error/missing_implementation_function.rb
156
+ - lib/jade/frontend/semantic_analysis/error/module_not_found.rb
157
+ - lib/jade/frontend/semantic_analysis/error/nested_task_port.rb
158
+ - lib/jade/frontend/semantic_analysis/error/non_task_port.rb
159
+ - lib/jade/frontend/semantic_analysis/error/orphan_implementation.rb
160
+ - lib/jade/frontend/semantic_analysis/error/predicate_must_return_bool.rb
161
+ - lib/jade/frontend/semantic_analysis/error/predicate_name_not_allowed.rb
162
+ - lib/jade/frontend/semantic_analysis/error/shadowing_error.rb
163
+ - lib/jade/frontend/semantic_analysis/error/type_args_mismatch.rb
164
+ - lib/jade/frontend/semantic_analysis/error/type_param_required.rb
165
+ - lib/jade/frontend/semantic_analysis/error/unbound_type_variable.rb
166
+ - lib/jade/frontend/semantic_analysis/error/undefined_variable.rb
167
+ - lib/jade/frontend/semantic_analysis/error/unknown_field.rb
168
+ - lib/jade/frontend/semantic_analysis/error/unknown_implementation_function.rb
169
+ - lib/jade/frontend/semantic_analysis/error/unused_interface_type_param.rb
170
+ - lib/jade/frontend/semantic_analysis/error/value_not_exposed.rb
171
+ - lib/jade/frontend/semantic_analysis/error/variable_not_found.rb
172
+ - lib/jade/frontend/semantic_analysis/function_call.rb
173
+ - lib/jade/frontend/semantic_analysis/function_declaration.rb
174
+ - lib/jade/frontend/semantic_analysis/grouping.rb
175
+ - lib/jade/frontend/semantic_analysis/helper.rb
176
+ - lib/jade/frontend/semantic_analysis/if_then_else.rb
177
+ - lib/jade/frontend/semantic_analysis/implementation.rb
178
+ - lib/jade/frontend/semantic_analysis/implementation_function.rb
179
+ - lib/jade/frontend/semantic_analysis/import_declaration.rb
180
+ - lib/jade/frontend/semantic_analysis/interface_declaration.rb
181
+ - lib/jade/frontend/semantic_analysis/interop_import_declaration.rb
182
+ - lib/jade/frontend/semantic_analysis/keyed_call.rb
183
+ - lib/jade/frontend/semantic_analysis/keyed_call/validation.rb
184
+ - lib/jade/frontend/semantic_analysis/lambda.rb
185
+ - lib/jade/frontend/semantic_analysis/list.rb
186
+ - lib/jade/frontend/semantic_analysis/literal.rb
187
+ - lib/jade/frontend/semantic_analysis/member_access.rb
188
+ - lib/jade/frontend/semantic_analysis/module_node.rb
189
+ - lib/jade/frontend/semantic_analysis/pattern_binding.rb
190
+ - lib/jade/frontend/semantic_analysis/pattern_constructor.rb
191
+ - lib/jade/frontend/semantic_analysis/pattern_list.rb
192
+ - lib/jade/frontend/semantic_analysis/pattern_literal.rb
193
+ - lib/jade/frontend/semantic_analysis/pattern_record.rb
194
+ - lib/jade/frontend/semantic_analysis/pattern_wildcard.rb
195
+ - lib/jade/frontend/semantic_analysis/qualified_access.rb
196
+ - lib/jade/frontend/semantic_analysis/record_access.rb
197
+ - lib/jade/frontend/semantic_analysis/record_field.rb
198
+ - lib/jade/frontend/semantic_analysis/record_literal.rb
199
+ - lib/jade/frontend/semantic_analysis/record_update.rb
200
+ - lib/jade/frontend/semantic_analysis/struct_declaration.rb
201
+ - lib/jade/frontend/semantic_analysis/tuple.rb
202
+ - lib/jade/frontend/semantic_analysis/type_declaration.rb
203
+ - lib/jade/frontend/semantic_analysis/variable_reference.rb
204
+ - lib/jade/frontend/semantic_analysis/variant_declaration.rb
205
+ - lib/jade/frontend/type_checking.rb
206
+ - lib/jade/frontend/type_checking/canonicalize.rb
207
+ - lib/jade/frontend/type_checking/constraints.rb
208
+ - lib/jade/frontend/type_checking/constraints/deriving.rb
209
+ - lib/jade/frontend/type_checking/constraints/deriving/decodable.rb
210
+ - lib/jade/frontend/type_checking/constraints/deriving/encodable.rb
211
+ - lib/jade/frontend/type_checking/constraints/deriving/eq.rb
212
+ - lib/jade/frontend/type_checking/constraints/deriving/helpers.rb
213
+ - lib/jade/frontend/type_checking/definition.rb
214
+ - lib/jade/frontend/type_checking/env.rb
215
+ - lib/jade/frontend/type_checking/error.rb
216
+ - lib/jade/frontend/type_checking/error/case_of_branches_type_mismatch.rb
217
+ - lib/jade/frontend/type_checking/error/derivation_failed.rb
218
+ - lib/jade/frontend/type_checking/error/function_body_type_mismatch.rb
219
+ - lib/jade/frontend/type_checking/error/function_call_type_mismatch.rb
220
+ - lib/jade/frontend/type_checking/error/if_branch_type_mismatch.rb
221
+ - lib/jade/frontend/type_checking/error/if_branches_type_mismatch.rb
222
+ - lib/jade/frontend/type_checking/error/if_condition_type_mismatch.rb
223
+ - lib/jade/frontend/type_checking/error/implementation_type_mismatch.rb
224
+ - lib/jade/frontend/type_checking/error/list_item_type_mismatch.rb
225
+ - lib/jade/frontend/type_checking/error/missing_implementation.rb
226
+ - lib/jade/frontend/type_checking/error/missing_patterns.rb
227
+ - lib/jade/frontend/type_checking/error/pattern_type_mismatch.rb
228
+ - lib/jade/frontend/type_checking/error/port_not_decodable.rb
229
+ - lib/jade/frontend/type_checking/error/record_access_type_mismatch.rb
230
+ - lib/jade/frontend/type_checking/error/type_mismatch.rb
231
+ - lib/jade/frontend/type_checking/error/unresolved_constraint.rb
232
+ - lib/jade/frontend/type_checking/expected.rb
233
+ - lib/jade/frontend/type_checking/generalization.rb
234
+ - lib/jade/frontend/type_checking/generalizer.rb
235
+ - lib/jade/frontend/type_checking/inference.rb
236
+ - lib/jade/frontend/type_checking/inference/assign.rb
237
+ - lib/jade/frontend/type_checking/inference/body.rb
238
+ - lib/jade/frontend/type_checking/inference/case_of.rb
239
+ - lib/jade/frontend/type_checking/inference/constructor_reference.rb
240
+ - lib/jade/frontend/type_checking/inference/function_call.rb
241
+ - lib/jade/frontend/type_checking/inference/function_declaration.rb
242
+ - lib/jade/frontend/type_checking/inference/grouping.rb
243
+ - lib/jade/frontend/type_checking/inference/helpers.rb
244
+ - lib/jade/frontend/type_checking/inference/if_then_else.rb
245
+ - lib/jade/frontend/type_checking/inference/implementation.rb
246
+ - lib/jade/frontend/type_checking/inference/import_declaration.rb
247
+ - lib/jade/frontend/type_checking/inference/interface_declaration.rb
248
+ - lib/jade/frontend/type_checking/inference/interop_import_declaration.rb
249
+ - lib/jade/frontend/type_checking/inference/lambda.rb
250
+ - lib/jade/frontend/type_checking/inference/list.rb
251
+ - lib/jade/frontend/type_checking/inference/literal.rb
252
+ - lib/jade/frontend/type_checking/inference/module.rb
253
+ - lib/jade/frontend/type_checking/inference/pattern.rb
254
+ - lib/jade/frontend/type_checking/inference/qualified_access.rb
255
+ - lib/jade/frontend/type_checking/inference/record_access.rb
256
+ - lib/jade/frontend/type_checking/inference/record_field.rb
257
+ - lib/jade/frontend/type_checking/inference/record_literal.rb
258
+ - lib/jade/frontend/type_checking/inference/record_update.rb
259
+ - lib/jade/frontend/type_checking/inference/struct_declaration.rb
260
+ - lib/jade/frontend/type_checking/inference/type_declaration.rb
261
+ - lib/jade/frontend/type_checking/inference/variable_reference.rb
262
+ - lib/jade/frontend/type_checking/instantiation.rb
263
+ - lib/jade/frontend/type_checking/loader.rb
264
+ - lib/jade/frontend/type_checking/placeholder.rb
265
+ - lib/jade/frontend/type_checking/port_resolution.rb
266
+ - lib/jade/frontend/type_checking/result.rb
267
+ - lib/jade/frontend/type_checking/scheme.rb
268
+ - lib/jade/frontend/type_checking/state.rb
269
+ - lib/jade/frontend/type_checking/substitution.rb
270
+ - lib/jade/frontend/type_checking/unification.rb
271
+ - lib/jade/frontend/type_checking/var_gen.rb
272
+ - lib/jade/frontend/unused_analysis.rb
273
+ - lib/jade/frontend/usage_analysis.rb
274
+ - lib/jade/frontend/usage_analysis/reference_index.rb
275
+ - lib/jade/interop.rb
276
+ - lib/jade/interop/boundary.rb
277
+ - lib/jade/interop/error.rb
278
+ - lib/jade/interop/lowering.rb
279
+ - lib/jade/interop/lowering/error.rb
280
+ - lib/jade/interop/runtime.rb
281
+ - lib/jade/lexer.rb
282
+ - lib/jade/lsp.rb
283
+ - lib/jade/lsp/converters.rb
284
+ - lib/jade/lsp/handlers.rb
285
+ - lib/jade/lsp/server.rb
286
+ - lib/jade/lsp/snippets.rb
287
+ - lib/jade/lsp/state.rb
288
+ - lib/jade/module_loader.rb
289
+ - lib/jade/module_loader/cache.rb
290
+ - lib/jade/module_loader/dependency_graph.rb
291
+ - lib/jade/module_loader/dependency_resolver.rb
292
+ - lib/jade/module_loader/normalize.rb
293
+ - lib/jade/module_loader/topological_sort.rb
294
+ - lib/jade/parsing.rb
295
+ - lib/jade/parsing/combinators.rb
296
+ - lib/jade/parsing/error.rb
297
+ - lib/jade/parsing/token.rb
298
+ - lib/jade/parsing/type.rb
299
+ - lib/jade/port.rb
300
+ - lib/jade/registry.rb
301
+ - lib/jade/result.rb
302
+ - lib/jade/runtime.rb
303
+ - lib/jade/source.rb
304
+ - lib/jade/stdlib.rb
305
+ - lib/jade/stdlib/basics.rb
306
+ - lib/jade/stdlib/bytes.rb
307
+ - lib/jade/stdlib/calendar.rb
308
+ - lib/jade/stdlib/char.rb
309
+ - lib/jade/stdlib/clock.rb
310
+ - lib/jade/stdlib/compiled.rb
311
+ - lib/jade/stdlib/decode.rb
312
+ - lib/jade/stdlib/decode/params.rb
313
+ - lib/jade/stdlib/dict.rb
314
+ - lib/jade/stdlib/encode.rb
315
+ - lib/jade/stdlib/intrinsics.rb
316
+ - lib/jade/stdlib/list.rb
317
+ - lib/jade/stdlib/maybe.rb
318
+ - lib/jade/stdlib/result.rb
319
+ - lib/jade/stdlib/set.rb
320
+ - lib/jade/stdlib/string.rb
321
+ - lib/jade/stdlib/task.rb
322
+ - lib/jade/stdlib/tuple.rb
323
+ - lib/jade/symbol.rb
324
+ - lib/jade/symbol/anonymous_record.rb
325
+ - lib/jade/symbol/base.rb
326
+ - lib/jade/symbol/constructor.rb
327
+ - lib/jade/symbol/derived_function.rb
328
+ - lib/jade/symbol/function.rb
329
+ - lib/jade/symbol/function_type.rb
330
+ - lib/jade/symbol/implementation.rb
331
+ - lib/jade/symbol/implementation_template.rb
332
+ - lib/jade/symbol/interface.rb
333
+ - lib/jade/symbol/interface_function.rb
334
+ - lib/jade/symbol/interop_function.rb
335
+ - lib/jade/symbol/lambda.rb
336
+ - lib/jade/symbol/parser.rb
337
+ - lib/jade/symbol/partial_application.rb
338
+ - lib/jade/symbol/record_type.rb
339
+ - lib/jade/symbol/stdlib_function.rb
340
+ - lib/jade/symbol/stdlib_implementation.rb
341
+ - lib/jade/symbol/struct.rb
342
+ - lib/jade/symbol/type_application.rb
343
+ - lib/jade/symbol/type_ref.rb
344
+ - lib/jade/symbol/union.rb
345
+ - lib/jade/symbol/value_ref.rb
346
+ - lib/jade/symbol/variable.rb
347
+ - lib/jade/symbol/variant.rb
348
+ - lib/jade/task.rb
349
+ - lib/jade/tasks.rb
350
+ - lib/jade/tasks/rspec.rb
351
+ - lib/jade/type.rb
352
+ - lib/jade/type/anonymous_record.rb
353
+ - lib/jade/type/application.rb
354
+ - lib/jade/type/base.rb
355
+ - lib/jade/type/constraint.rb
356
+ - lib/jade/type/constructor.rb
357
+ - lib/jade/type/function.rb
358
+ - lib/jade/type/partial_application.rb
359
+ - lib/jade/type/unit.rb
360
+ - lib/jade/type/var.rb
361
+ - lib/jade/version.rb
362
+ homepage: https://github.com/agustinrhcp/jade
363
+ licenses:
364
+ - MIT
365
+ metadata:
366
+ source_code_uri: https://github.com/agustinrhcp/jade
367
+ changelog_uri: https://github.com/agustinrhcp/jade/blob/master/CHANGELOG.md
368
+ bug_tracker_uri: https://github.com/agustinrhcp/jade/issues
369
+ rubygems_mfa_required: 'true'
370
+ rdoc_options: []
371
+ require_paths:
372
+ - lib
373
+ required_ruby_version: !ruby/object:Gem::Requirement
374
+ requirements:
375
+ - - ">="
376
+ - !ruby/object:Gem::Version
377
+ version: '3.4'
378
+ required_rubygems_version: !ruby/object:Gem::Requirement
379
+ requirements:
380
+ - - ">="
381
+ - !ruby/object:Gem::Version
382
+ version: '0'
383
+ requirements: []
384
+ rubygems_version: 3.6.2
385
+ specification_version: 4
386
+ summary: A functional, type-safe language that compiles to readable Ruby.
387
+ test_files: []