Principal Type Inference under a Prefix: A Fresh Look at Static OverloadingDistinguished Paper
At the heart of the Damas-Hindley-Milner (HM) type system lies the abstraction rule which derives a function type for a lambda expression. In this rule, the type of the parameter can be "guessed", and can be any type that fits the derivation. The beauty of the HM system is that there always exists a most general type that encompasses all possible derivations – Algorithm W is used to infer these most general types in practice.
Unfortunately, this property is also the bane of the HM type rules. Many languages extend HM typing with additional features which often require complex side conditions to the type rules to maintain principal types. For example, various type systems for impredicative type inference, like HMF, FreezeML, or Boxy types, require let-bindings to always assign most general types. Such a restriction is difficult to specify as a logical deduction rule though, as it ranges over all possible derivations. Despite these complications, the actual implementations of various type inference algorithms are usually straightforward extensions of algorithm\ W, and from an implementation perspective, much of the complexity of various type system extensions, like boxes or polymorphic weights, is in some sense artificial.
In this article we rephrase the HM type rules as type inference under a prefix, called HMQ. HMQ is sound and complete with respect to the HM type rules, but always derives principal types that correspond to the types inferred by algorithm W. The HMQ type rules are close to the clarity of the declarative HM type rules, but also specific enough to "read off" an inference algorithm, and can form an excellent basis to describe type system extensions in practice. We show in particular how to describe the FreezeML and HMF systems in terms of inference under a prefix, and how we no longer require complex side conditions. We also show a novel formalization of static overloading in HMQ as implemented in Koka language.
Thu 19 JunDisplayed time zone: Seoul change
14:00 - 15:00 | Language DesignPLDI Research Papers at Cosmos, Violet & Tulip Chair(s): Chris Casinghino Jane Street | ||
14:00 20mTalk | Tree BorrowsDistinguished Paper PLDI Research Papers Neven Villani University of Grenoble Alpes - VERIMAG, Johannes Hostert ETH Zurich, Derek Dreyer MPI-SWS, Ralf Jung ETH Zurich Link to publication DOI | ||
14:20 20mTalk | Principal Type Inference under a Prefix: A Fresh Look at Static OverloadingDistinguished Paper PLDI Research Papers DOI Pre-print | ||
14:40 20mTalk | Efficient, Portable, Census-Polymorphic Choreographic Programming PLDI Research Papers Mako P. Bates University of Vermont, Shun Kashiwa University of California at San Diego, Syed Jafri University of Vermont, Gan Shen University of California at Santa Cruz, Lindsey Kuper University of California, Santa Cruz, Joseph P. Near University of Vermont DOI Pre-print |