Explaining ML Type-Errors by Data Flow

Appers in

Implementation and Application of Functional Languages:
16th International Workshop (IFL04)

Lübeck, Germany, September 8-10, 2004,
(Eds. Clemens Grelck, Frank Huch, Greg J. Michaelson, Phil Trinder)
LNCS 3474, Springer Verlag

Abstract

We present a novel approach to explaining ML type errors: Since the type system inhibits data flows that would abort the program at run-time, our type checker identifies as explanations those data flows that violate the typing rules. It also detects the notorious backflows, which are artifacts of unification, and warns the user about the possibly unexpected typing. The generated explanations comprise a detailed textual description and an arrow overlay to the source code, in which each arrow represents one data flow. The description refers only to elementary facts about program evaluation, not to the type checking process itself.

The method integrates well with unification-based type checking: Type-correct programs incur a modest overhead compared to normal type checking. If a type error occurs, a simple depth-first graph traversal yields the explanation. A proof-of-concept implementation is available.

Proof-of-Concept Implementation

explain.zip


Holger Gast
Last modified: Fri Oct 14 10:44:45 MST 2005