Compositional explanation of types and algorithmic debugging of type errors

  • Authors:
  • Olaf Chitil

  • Affiliations:
  • Univ. of York, York, UK

  • Venue:
  • Proceedings of the sixth ACM SIGPLAN international conference on Functional programming
  • Year:
  • 2001

Quantified Score

Hi-index 0.00

Visualization

Abstract

The type systems of most typed functional programming languages arebased on the Hindley-Milner type system. A practical problem withthese type systems is that it is often hard to understand why aprogram is not type correct or a function does not have theintended type. We suggest that at the core of this problem is thedifficulty of explaining why a given expression has a certain type.The type system is not defined compositionally. We propose toexplain types using a variant of the Hindley-Milner type systemthat defines a compositional type explanation graph of principaltyping. We describe how the programmer understands types byinteractive navigation through the explanation graph. Furthermore,the explanation graph can be the foundation for algorithmicdebugging of type errors, that is, semi-automatic localisation ofthe source of a type error without even having to understand thetype inference steps. We implemented a prototype of a tool toexplore the usefulness of the proposed methods.