Skip to content
This repository has been archived by the owner on Jul 3, 2024. It is now read-only.

Implement type inference for JsonLogic #1

Open
5 of 6 tasks
CharString opened this issue Aug 22, 2023 · 1 comment
Open
5 of 6 tasks

Implement type inference for JsonLogic #1

CharString opened this issue Aug 22, 2023 · 1 comment
Assignees

Comments

@CharString
Copy link
Collaborator

CharString commented Aug 22, 2023

@CharString CharString self-assigned this Aug 22, 2023
@CharString CharString moved this from Todo to In Progress in Development Oct 17, 2023
CharString added a commit that referenced this issue Nov 9, 2023
Vendor the meat of https://github.com/domdomegg/hindley-milner-typescript-minimal
Implementations for

- Algorithm W
  L. Damas and R. Milner, "Principal type-schemes for functional programs", Proceedings of the 9th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages - POPL '82, 1982. https://doi.org/10.1145/582153.582176
- Algorithm M
  O. Lee and K. Yi, "Proofs about a folklore let-polymorphic type inference algorithm", ACM Transactions on Programming Languages and Systems, vol. 20, no. 4, p. 707-723, 1998. https://doi.org/10.1145/291891.291892

Vendoring, because we will need to tailor the models to the JsonLogic language.

Code in this commit is an exact copy; just reformated with prettier.
CharString added a commit that referenced this issue Nov 9, 2023
About a third of these don't typecheck.
CharString added a commit that referenced this issue Nov 9, 2023
Adds

- default Context with type annotations of JsonLogic operations
- parser for JsonLogic "rules"
- parser for JsonLogic "data"
- Number and String literal to the models
- Rename and extend the TypeFunctions
- handling of Number and String to W
CharString added a commit that referenced this issue Nov 9, 2023
Changes "if", "filter", "and" and "or" to take any type as arguments
but the return types should still align.

This change just assumes an implicit "!!" call around the boolean arguments.
CharString added a commit that referenced this issue Nov 9, 2023
- Flag some error messages as TODO
- Add variadic "if" (which is a chain of elifs)
- Add "?:"
- Handle more "var" error cases
CharString added a commit that referenced this issue Nov 13, 2023
Adds

- default Context with type annotations of JsonLogic operations
- parser for JsonLogic "rules"
- parser for JsonLogic "data"
- Number and String literal to the models
- Rename and extend the TypeFunctions
- handling of Number and String to W
CharString added a commit that referenced this issue Nov 13, 2023
Changes "if", "filter", "and" and "or" to take any type as arguments
but the return types should still align.

This change just assumes an implicit "!!" call around the boolean arguments.
CharString added a commit that referenced this issue Nov 13, 2023
- Flag some error messages as TODO
- Add variadic "if" (which is a chain of elifs)
- Add "?:"
- Handle more "var" error cases
@joeribekker
Copy link

Type inference feature was cancelled due to implementation difficulties vs benefits.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants