7 Nov 2008 09:24
Minimal type reconstruction
[ The Types Forum, http://lists.seas.upenn.edu/mailman/listinfo/types-list ] Hi all, One way to look at type inference in Hindley-Milner-like disciplines is not just as the problem of finding a principal type scheme for a term in a given type environment, but as the problem of reconstructing an explicitly typed term in the style of System F that corresponds to such a principal type scheme. As an obvious example, consider the "completion" of the implicitly typed polymorphic identity function λx. x , resulting in the explicitly typed Λα. λx : α. x . Typically, type inference for Hindley-Milner-like systems proceeds by assigning each let-bound variable its principal type. For example, completion of let id = λx. x in id 2 + id 3 ni yields let id = Λα. λx : α. x in id [ℕ] 2 + id [ℕ] 3 ni . However, in this particular example the type abstraction in the definition of id and, hence, the type applications in the body of the local definition are unnecessary; another perfectly valid completion(Continue reading)
RSS Feed