benrbray / type-safari

An interactive tour of type inference algorithms, powered by `ghc-wasm-meta`.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

type-safari

With this project, I aim to collect reference implementations of type inference algorithms, with particular emphasis on those features which are necessary for practical implementations, such as error reporting and incrementality.

Inspiration

Goals

  • implement a wide range of type inference algorithms in a consistent style to facilitate comparison
  • maintain a clear correspondence between typing judgements on paper and Haskell code
  • develop a generic web interface (not necessarily a language server, but something similar) for debugging and for comparing the behavior of different type systems.
    • should show detailed typing information about the typing context at each source position
    • if possible, allow the user to interactively step through the inference procedure

Road Map / References

Hindley-Milner & Extensions

  • Algorithm W
  • Algorithm M
  • Constraint Generation & First-Order Unification
  • Type Annotations
  • Typed Holes
  • Recursive Definitions
  • Mutual Recursion
  • Pattern Matching
  • Local vs. Top-Level
  • Higher Rank Polymorphism
  • Row Polymorphism
  • Units of Measure, Commutative Group Unification a la Gundry 2013

Normalization by Evaluation

Type Inference for Dependent Types

  • Calculus of Constructions
  • Calculus of Inductive Constructions
  • Bidirectional Type Inference
  • Higher-Order Unification, Pattern Unification

Uncategorized

Here are some topics I hope to cover, but I'm not quite sure how/where they fit in:

  • interacttions between Hindley-Milner and subtyping
  • ML's value restriction, and OCaml's relaxation of the value restriction

Resources

Hindley-Milner

System F

Bidirectional Type Inference

Optimizations

Miscellaneous

About

An interactive tour of type inference algorithms, powered by `ghc-wasm-meta`.

License:MIT License


Languages

Language:JavaScript 87.3%Language:Haskell 7.5%Language:TypeScript 3.9%Language:CSS 0.5%Language:TeX 0.3%Language:C 0.2%Language:HTML 0.2%Language:Shell 0.1%Language:Just 0.0%