A cute collection of type checker implementations demonstrating modern type checking algorithms from the last fifty years of programming language design.
Robin Milner's classic Hindley-Milner type inference algorithm from A Theory of Type Polymorphism in Programming.
Second-order lambda calculus with parametric polymorphism using bidirectional type checking.
An implementation of bidirectional algorithm from Complete and Easy Bidirectional Typechecking for Higher-rank Polymorphism.
Complete implementation of System F-ω with higher-kinded types, DK bidirectional type checking, existential type variables, polymorphic constructor applications, pattern matching, and lambda expressions with type inference.
Uses the method of A Mechanical Formalization of Higher-Ranked Polymorphic Type Inference.
The Calculus of Constructions with a hierarchy of non-cumulative universes, inductive types and universe polymorphism. Limited support for higher-order unification.
Uses a bidirectional dependent typechecker outlined in A universe polymorphic type system by Vladimir Voevodsky.
- Rust (latest stable)
- Just build system:
cargo install just
brew install just
just build # Build all projects
just test # Run all tests
The tutorial is built with mdBook
and mdbook-include-rs
preprocessor.
just install-docs # Install mdbook and dependencies
just build-docs # Build documentation
just serve-docs # Serve with live reload
If you want to contribute, please fork the repository and submit a pull request.
# Clone the repository
git clone https://github.com/sdiehl/typechecker-zoo.git
cd typechecker-zoo/docs
# Install mdBook and the include preprocessor
cargo install --git https://github.com/sdiehl/mdbook-include-rs.git
# Start the mdBook preview
just serve-docs
# Make your edits to markdown files in src/
Then open a pull request on Github. Any contributions are welcome, especially typo fixes and improvements. 🙏
MIT Licensed. Copyright 2025 Stephen Diehl.