Home Publications Research Teaching Contact

Generalizing Hindley-Milner Type Inference Algorithms

Bastiaan Heeren, Jurriaan Hage, and Doaitse Swierstra

Type inferencing according to the standard algorithms W and M often yields uninformative error messages. Many times, this is a consequence of a bias inherent in the algorithms. The method developed here is to first collect constraints from the program, and to solve these afterwards, possibly under the influence of a heuristic. We show the soundness and completeness of our algorithm. The algorithms W and M turn out to be deterministic instances of our method, giving the correctness for W and M with respect to the Hindley-Milner typing rules for free. We also show that our algorithm is more flexible, because it naturally allows the generation of multiple messages.

Published as Technical Report UU-CS-2002-031, Department of Information and Computing Sciences, Utrecht University, 2002.

Download report (© 2002)