From ML type inference to stratified type inference

被引:0
|
作者
Pottier, F
机构
[1] INIRIA, Rocquencourt
关键词
D O I
10.1145/1090189.1086367
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
Hindley and Milner's type system, in its purest form, allows what one might call full type inference. Even when a program contains no explicit type information, its very structure gives rise to a conjunction of type equations (or, more generally, to a constraint) whose resolution allows reconstructing the type of every variable and of every sub-expression. Actual programming languages based on this type system, such as Standard ML, Objective Caml, and Haskell, do allow users to provide explicit type information via optional type annotations. Yet, this extra information does not make type inference any easier: it simply gives rise to extra equations, leading to a more specific constraint. There are extensions of Hindley and Milner's type system where full type inference becomes undecidable or intractable. Then, it is common to require explicit type information, via mandatory type annotations. Polymorphic recursion is a simple and well-known instance of this phenomenon. This talk presents two more elaborate instances, commonly known as arbitrary-rank polymorphism and generalized algebraic data types. In both cases, type inference is made tractable thanks to mandatory type annotations. There is a twist, though: these required annotations are often numerous and redundant. So, it seems desirable to make them optional again, and to set up a distinct mechanism to guess some of the elided annotations. This mechanism, referred to as elaboration, can be heuristic. It must be predictable. In the two cases considered in this talk, it is a form of local type inference. This approach leads to a so-called stratified type inference system, where type information is propagated first in a local, ad hoc manner during elaboration, then in a possibly nonlocal, but well-specified manner during constraint solving. This appears to be one of the less displeasing ways of describing type inference systems that are able to exploit optional type annotations to infer better (or different) types.
引用
收藏
页码:1 / 1
页数:1
相关论文
共 50 条
  • [1] From ML to MLF: Graphic Type Constraints with Efficient Type Inference
    Remy, Didier
    Yakobowski, Boris
    [J]. ICFP'08: PROCEEDINGS OF THE 2008 SIGPLAN INTERNATIONAL CONFERENCE ON FUNCTIONAL PROGRAMMING, 2008, : 63 - 74
  • [2] From ML to MLF:: Graphic type constraints with efficient type inference
    Remy, Didier
    Yakobowski, Boris
    [J]. ACM SIGPLAN NOTICES, 2008, 43 (09) : 63 - 74
  • [3] A logical algorithm for ML type inference
    McAllester, D
    [J]. REWRITING TECNIQUES AND APPLICATIONS, PROCEEDINGS, 2003, 2706 : 436 - 451
  • [4] A TYPE INFERENCE ALGORITHM FOR A STRATIFIED POLYMORPHIC TYPE DISCIPLINE
    GIANNINI, P
    DELLAROCCA, SR
    [J]. INFORMATION AND COMPUTATION, 1994, 109 (1-2) : 115 - 173
  • [5] Efficient ML Type Inference Using Ranked Type Variables
    Kuan, George
    MacQueen, David
    [J]. ML'07: PROCEEDINGS OF THE 2007 WORKSHOP ON ML, 2007, : 3 - 14
  • [6] Compositional and Lightweight Dependent Type Inference for ML
    Zhu, He
    Jagannathan, Suresh
    [J]. VERIFICATION, MODEL CHECKING, AND ABSTRACT INTERPRETATION (VMCAI 2013), 2013, 7737 : 295 - 314
  • [7] Stratified type inference for generalized algebraic data types
    Pottier, F
    Régis-Gianas, Y
    [J]. ACM SIGPLAN NOTICES, 2006, 41 (01) : 232 - 244
  • [8] Type inference with rank 1 polymorphism for type-directed compilation of ML
    Ohori, A
    Yoshida, N
    [J]. ACM SIGPLAN NOTICES, 1999, 34 (09) : 160 - 171
  • [9] From type inference to configuration
    Sorensen, MH
    Secher, JP
    [J]. ESSENCE OF COMPUTATION: COMPLEXITY ANALYSIS, TRANSFORMATION, 2002, 2566 : 436 - 471
  • [10] From type inference to configuration
    Sørensen, Morten Heine
    Secher, Jens Peter
    [J]. 2002, Springer Verlag (2566 LNCS):