A Type Inferencer for ML in 200 Lines of Scala
summary
Shows a working implementation of Wand's algorithm for a tiny Standard ML subset implemented in 200 lines of Scala, with the compiler split into type annotation + constraint generation + unification. The code generates type placeholders, emits set-based constraints, and solves them by unification to recover ML-style polymorphism; it handles ordinary ML programs but fails on higher-rank polymorphism (undecidable cases) and some construct combinations that require more than simple unification. Code and slides are available.
AI-written summary · about
chapters (5)
related talks
21mOmnidirectional type inference for ML
21mSeamless Scope-Safe Metaprogramming Through Polymorphic Subtype Inference (Short Paper)
15mA compilation method for dynamic typing in ML
23mBetter Defunctionalization through Lambda Set Specialization
30mDotty and types: the story so far
45mTypelevel Programming 101: The Subspace of Scala
18mConcrete Type Inference for Code Optimization using Machine Learning with SMT S...
15mType-safe generation of modules in applicative and generative styles
