Skip to content

Use a structural approach to type inference#3

Merged
kyay10 merged 16 commits into
masterfrom
structural
Jul 10, 2026
Merged

Use a structural approach to type inference#3
kyay10 merged 16 commits into
masterfrom
structural

Conversation

@kyay10

@kyay10 kyay10 commented Jul 10, 2026

Copy link
Copy Markdown
Owner

Currently, we use a nominal approach, forcing users to explicitly state (and thus ask us for proof) that some function F applied to A results in FA. We do so by tracking all the functions F and their argument A that a user has cast a type to. This PR uses a purely structural approach. The typefunction F is forced to be inferred first. Then, and only then, we magically resolve the constraints on FA, thus verifying that it's indeed equivalent to K<F, A>. This seems to work pretty well, but it's also horribly tricky to get right
To be honest, I don't remember the exact details of this. It was all written by me, no AI (other than copilot auto-completion), so I'm sure I can work it out again if needed.

@kyay10 kyay10 merged commit 573badd into master Jul 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant