|
|||||||||||||||||||||
|
|||||||||||||||||||||
ABSTRACT
MLF is an alternative to ML that permits second-order polymorphism as in System F but retains (partial) type inference a la ML. Type annotations are requested only on parameters of functions that are used polymorphically. Type abstractions and type applications are entirely alleviated. Inpractice, very few type annotations are actually needed. Moreover, small program transformations such as commutation of arguments, η-expansion, etc. never require extra type annotations. MLF is a conservative extension of ML that allows to type all of System-F terms-and a few more. Types of MLF extend those of System-F with instance-bounded polymorphism so that more expressions have principal types and also abstraction-bounded polymorphism so that first-class types may always be treated abstractly during type inference. However, types may be more concisely described as the superposition of a standard term-dag representation of first-order types and a binding tree, with well-formedness conditions relating the two. This allows for a simple definition of type instance and leads to an efficient unification algorithm on types. This graphical presentation of types may also be extended to represent type schemes and unification and instantiation constraints as additional edges. Typing rules, type inference, and type soundness can then all be described using type constraints. Type inference for MLF is performed much as for ML and is about as efficient. INDEX TERMS
Primary Classification:
Additional Classification:
General Terms:
Keywords:
|
|||||||||||||||||||||