Team Gallium

Overall Objectives
Scientific Foundations
Application Domains
New Results
Contracts and Grants with Industry
Other Grants and Activities

Section: New Results

Partial type inference with first-class polymorphism

Participants : Didier Rémy, Boris Yakobowski [ University Paris 7 Diderot ] , Paolo Herms.

The ML language uses simple types (first-order types without quantifiers) enriched with type schemes (simple types with outer-most universal quantifiers). This allows for simple type inference based on first-order unification, relieving the user from the burden of writing type annotations. However, it only enables a limited form of parametric polymorphism. In contrast, System F uses second-order types (types with inner universal quantifiers at arbitrary depth) that are much more expressive. As a result, type inference is undecidable in System F, which forces the user to provide all type annotations.

Didier Le Botlan and Didier Rémy have proposed a type system, called MLF, which enables type synthesis as in ML while retaining the expressiveness of System F. Only type annotations on parameters of functions that are used polymorphically in their body are required. All other type annotations, including all type abstractions and type applications are inferred. Remarkably, type inference in MLF reduces to a new form of unification that amounts to performing first-order unification in the presence of second-order types. The journal version of this work was published this year in Information and Computation [14] . The initial MLF design was then simplified and made more expressive by Boris Yakobowski in his Ph.D. dissertation  [49] , using graphs rather than terms to represent types and also to perform type inference.

This year, Didier Rémy and Boris Yakobowski have further improved the graphical presentation of MLF by following a more algebraic approach. This is described in two journal articles in preparation. Didier Rémy and Boris Yakobowski also revisited the fully explicit version of ML, that can be used both to show the preservation of types during reduction and as an internal language for MLF [33] .

Paolo Herms (master's intern from University of Pisa) and Didier Rémy proposed an extension of MLF with higher-order types. To avoid the problem of undecidable second and higher-order unification that would appear with implicit higher-order types, the implicit type abstraction and type application mechanism of MLF are first combined with the original explicit type abstraction and type application mechanism of System F, and explicit coercions between the two forms. Then, higher-order types can be added but only in the explicit forms. This gives MLFIm2 ${}^\#969 $ the power of System FIm2 ${}^\#969 $ while still retaining the possibility of leaving introduction and elimination of polymorphism at second-order types implicit. Paolo Herms showed how to adapt graphical types to cope with MLFIm2 ${}^\#969 $ [31] .


Logo Inria