A toy implementation of Hindley-Milner type inference. The program walks through a given expression node, generates a set of constraints and unifies them to produce a set of substitutions.
Blog post: Type Inference
Here are the resources I used to learn this algorithm:
- Chapter 30 in Programming Languages: Application and Interpretation (first edition)
- Chapter 15.3.2 in Programming Languages: Application and Interpretation (second edition)
- Unification - A blog post.
- type-unify.rkt - An unification implementation in Racket.