Bidirectional Type Checking

preview_player
Показать описание
Compose NYC 2019
Speaker: David Christiansen

When implementing a type checker, one must answer two questions: how to compare types for sameness, be it a subsumption check for subtyping, a unification algorithm for type inference, or normalization for dependent types, and when to check for sameness. The way most type systems are written provides little guidance on this question. One solution to the problem is bidirectional type checking, in which the typing judgment is split into two modes, one that checks an expression against a given type, and one that concocts a type for an expression. Bidirectional type checking tends to require a relatively low burden of annotations, it scales to powerful type systems, and it tends to do a good job associating type errors with source locations. I’ll discuss the history of bidirectional type checking, show how to bidirectionalize known type systems, and walk through some implementations.
Рекомендации по теме
Комментарии
Автор

The slide at 28:55 is incorrect. The code sample should read:

check G other t2 =
let t1 = synth G other
in isSubtype t1 t2

anchpop
Автор

Nat <: nat, so how influenced is this from Russell's type theory?
Also you can't derive subsumption rule when row type instantiated
Jury is still out on, if 0 is nat

asitisj