New Generation Computing, 22(2004)1-36
Ohmsha, Ltd. and Springer-Verlag
Received 30 September 2002
Revised manuscript received 28 November 2002
We present a generalized let-polymorphic type inference algorithm, prove that any of its instances is sound and complete with respect to the Hindley/Milner let-polymorphic type system, and find a condition on two instance algorithms so that one algorithm should find type errors earlier than the other. By instantiating the generalized algorithm with different parameters, we can obtain not only the two opposite algorithms (the bottom-up standard algorithm W and the top-down algorithm M) but also other hybrid algorithms which are used in real compilers. Such instances' soundness and completeness follow automatically, and their relative earliness in detecting type-errors is determined by checking a simple condition. The set of instances of the generalized algorithm is a superset of those used in the two most popular ML compilers: SML/NJ and OCaml.
Keywords:Type System, Type Inference Algorithm, Let-Polymorphism, Generalization.
(Footnote)
*1) This work is supported by Creative Research Initiatives of the Korean Ministry
of Science and Technology
*2) National Creative Research Institute Center, http://ropas.kaist.ac.kr
*3) Work done while the third author was associated with Korea Advanced Institute
of Science and Technology