Generalizing Hindley-Milner Type Inference Algorithms

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.

[1]  Bruce James McAdam On the unification of substitutions in type inference , 1999 .

[2]  Amitabha Sanyal,et al.  Correcting Errors in the Curry System , 1996, FSTTCS.

[3]  Mitchell Wand Finding the source of type errors , 1986, POPL '86.

[4]  Ryan Stansifer,et al.  Explaining type errors in polymorphic languages , 1993, LOPL.

[5]  Kwangkeun Yi,et al.  Proofs about a folklore let-polymorphic type inference algorithm , 1998, TOPL.

[6]  Jun Yang Explaining Type Errors by Finding the Source of a Type Conflict , 1999, Scottish Functional Programming Workshop.

[7]  Chang Liu,et al.  Term rewriting and all that , 2000, SOEN.

[8]  Venkatesh Choppella,et al.  Diagnosis of Ill-typed Programs , 1995 .

[9]  Alexander Aiken,et al.  Introduction to Set Constraint-Based Program Analysis , 1999, Sci. Comput. Program..

[10]  Martin Sulzmann,et al.  Hindley/Milner style type systems in constraint form , 1999 .

[11]  Rishiyur S. Nikhil,et al.  Practical Polymorphism , 1985, FPCA.

[12]  Eugene W. Stark,et al.  Debugging Type Errors (Full version) , 1995 .

[13]  Graeme S. Port A Simple Approach to Finding the Cause of Non-Unifiability , 1988, ICLP/SLP.

[14]  Dominic Duggan,et al.  Explaining Type Inference , 1996, Sci. Comput. Program..

[15]  Robin Milner,et al.  Principal type-schemes for functional programs , 1982, POPL '82.

[16]  Gregory F. Johnson,et al.  A maximum-flow approach to anomaly isolation in unification-based incremental type inference , 1986, POPL '86.

[17]  Kwangkeun Yi,et al.  A Generalization of Hybrid Let-Polymorphic Type Inference Algorithms , 2000, APLAS.

[18]  Robin Milner,et al.  A Theory of Type Polymorphism in Programming , 1978, J. Comput. Syst. Sci..

[19]  Bruce J. McAdam Generalising Techniques for Type Debugging , 1999, Scottish Functional Programming Workshop.