Visible Type Application
Visible Type Application
复制标题
可见型应用
DOI:
10.1007/978-3-662-49498-1_10
复制
发表时间:
2016
期刊:
影响因子:
--
通讯作者:
Hamidhasan G. Ahmed
中科院分区:
文献类型:
--
作者:
R. Eisenberg;Stephanie Weirich;Hamidhasan G. Ahmed
The Hindley-Milner HM type system automatically infers the types at which polymorphic functions are used. In HM, the inferred types are unambiguous, and every expression has a principal type. Type annotations make HM compatible with extensions where complete type inference is impossible, such as higher-rank polymorphism and type-level functions. However, programmers cannot use annotations to explicitly provide type arguments to polymorphic functions, as HM requires type instantiations to be inferred.
We describe an extension to HM that allows visible type application. Our extension requires a novel type inference algorithm, yet its declarative presentation is a simple extension to HM. We prove that our extended system is a conservative extension of HM and admits principal types. We then extend our approach to a higher-rank type system with bidirectional type-checking. We have implemented this system in the Glasgow Haskell Compiler and show how our approach scales in the presence of complex type system features.