Polymorphic type reconstruction using type equations

  • Authors:
  • Venkatesh Choppella

  • Affiliations:
  • Indian Institute of Information Technology and Management Kerala, Thiruvananthapuram, Kerala, India

  • Venue:
  • IFL'03 Proceedings of the 15th international conference on Implementation of Functional Languages
  • Year:
  • 2003

Quantified Score

Hi-index 0.00

Visualization

Abstract

The W algorithm of Milner [Mil78] and its numerous variants [McA98,LY98,YTMW00] implement type reconstruction by building type substitutions. We define an algorithm WE centered around building type equations rather than substitutions. The design of WE is motivated by the belief that reasoning with substitutions is awkward. More seriously, substitutions fail to preserve the exact syntactic form of the type equations they solve. This makes analysing the source of type errors more difficult. By replacing substitution composition with unions of sets of type equations and eliminating the application of substitution to environments, we obtain an algorithm for type reconstruction that is simple and also useful for type error reconstruction. We employ a sequentiality principle for unifier composition and a constructive account of mgu-induced variable occurrence relation to design WE and prove its correctness. We introduce syntax equations as a formal syntax for progam slices. We use a simple constraint generation relation to relate syntax equations with type equations to trace program slices responsible for a type error.