Extending hindley-milner type inference with coercive structural subtyping

  • Authors:
  • Dmitriy Traytel;Stefan Berghofer;Tobias Nipkow

  • Affiliations:
  • Institut für Informatik, Technische Universität München, Garching, Germany;Institut für Informatik, Technische Universität München, Garching, Germany;Institut für Informatik, Technische Universität München, Garching, Germany

  • Venue:
  • APLAS'11 Proceedings of the 9th Asian conference on Programming Languages and Systems
  • Year:
  • 2011

Quantified Score

Hi-index 0.00

Visualization

Abstract

We investigate how to add coercive structural subtyping to a type system for simply-typed lambda calculus with Hindley-Milner polymorphism. Coercions allow to convert between different types, and their automatic insertion can greatly increase readability of terms. We present a type inference algorithm that, given a term without type information, computes a type assignment and determines at which positions in the term coercions have to be inserted to make it type-correct according to the standard Hindley-Milner system (without any subtypes). The algorithm is sound and, if the subtype relation on base types is a disjoint union of lattices, also complete. The algorithm has been implemented in the proof assistant Isabelle.