The Easiest Way to Build a Type Checker
11 points by FedericoSchonborn
11 points by FedericoSchonborn
As with most type checking tutorials online this also makes the fatal mistake of simplifying the checked language too much. Without some kind of polymorphism (parametric or subtyping) and local inference it's not possible to have complicated type checking anyway. If you remove the parts about polymorphism and inference from HM (modify it to use type annotations) it will also become trivial.
I definitely could add polymorphism with out too much trouble. But trying to explain unification and type variables made the post too long and made it a bit muddled. The plan is a post explaining unification and adding it to our type checker.
It almost certainly is too easy for many people. But lots of people don’t even understand generics. Have no idea how type checking works at all. This is for them.