Advanced search
1 file | 768.24 KB Add to list

OUTSIDEIN(X) : modular type inference with local assumptions

(2011) JOURNAL OF FUNCTIONAL PROGRAMMING. 21(4-5). p.333-412
Author
Organization
Abstract
Advanced type system features, such as GADTs, type classes and type families, have proven to be invaluable language extensions for ensuring data invariants and program correctness. Unfortunately, they pose a tough problem for type inference when they are used as local type assumptions. Local type assumptions often result in the lack of principal types and cast the generalisation of local let-bindings prohibitively difficult to implement and specify. User-declared axioms only make this situation worse. In this paper, we explain the problems and - perhaps controversially - argue for abandoning local let-binding generalisation. We give empirical results that local let generalisation is only sporadically used by Haskell programmers. Moving on, we present a novel constraint-based type inference approach for local type assumptions. Our system, called OUTSIDEIN(X), is parameterised over the particular underlying constraint domain X, in the same way as HM(X). This stratification allows us to use a common metatheory and inference algorithm. OUTSIDEIN(X) extends the constraints of X by introducing implication constraints on top. We describe the strategy for solving these implication constraints, which, in turn, relies on a constraint solver for X. We characterise the properties of the constraint solver for X so that the resulting algorithm only accepts programs with principal types, even when the type system specification accepts programs that do not enjoy principal types. Going beyond the general framework, we give a particular constraint solver for X = type classes + GADTs + type families, a non-trivial challenge in its own right. This constraint solver has been implemented and distributed as part of GHC 7.
Keywords
type system, type inference, local assumtions, type classes, GADTs, type families, Haskell, CONSTRAINT HANDLING RULES, CONGRUENCE CLOSURE

Downloads

  • (...).pdf
    • full text
    • |
    • UGent only
    • |
    • PDF
    • |
    • 768.24 KB

Citation

Please use this url to cite or link to this publication:

MLA
Vytiniotis, Dimitrios, et al. “OUTSIDEIN(X) : Modular Type Inference with Local Assumptions.” JOURNAL OF FUNCTIONAL PROGRAMMING, vol. 21, no. 4–5, 2011, pp. 333–412, doi:10.1017/S0956796811000098.
APA
Vytiniotis, D., Peyton Jones, S., Schrijvers, T., & Sulzmann, M. (2011). OUTSIDEIN(X) : modular type inference with local assumptions. JOURNAL OF FUNCTIONAL PROGRAMMING, 21(4–5), 333–412. https://doi.org/10.1017/S0956796811000098
Chicago author-date
Vytiniotis, Dimitrios, Simon Peyton Jones, Tom Schrijvers, and Martin Sulzmann. 2011. “OUTSIDEIN(X) : Modular Type Inference with Local Assumptions.” JOURNAL OF FUNCTIONAL PROGRAMMING 21 (4–5): 333–412. https://doi.org/10.1017/S0956796811000098.
Chicago author-date (all authors)
Vytiniotis, Dimitrios, Simon Peyton Jones, Tom Schrijvers, and Martin Sulzmann. 2011. “OUTSIDEIN(X) : Modular Type Inference with Local Assumptions.” JOURNAL OF FUNCTIONAL PROGRAMMING 21 (4–5): 333–412. doi:10.1017/S0956796811000098.
Vancouver
1.
Vytiniotis D, Peyton Jones S, Schrijvers T, Sulzmann M. OUTSIDEIN(X) : modular type inference with local assumptions. JOURNAL OF FUNCTIONAL PROGRAMMING. 2011;21(4–5):333–412.
IEEE
[1]
D. Vytiniotis, S. Peyton Jones, T. Schrijvers, and M. Sulzmann, “OUTSIDEIN(X) : modular type inference with local assumptions,” JOURNAL OF FUNCTIONAL PROGRAMMING, vol. 21, no. 4–5, pp. 333–412, 2011.
@article{1202271,
  abstract     = {{Advanced type system features, such as GADTs, type classes and type families, have proven to be invaluable language extensions for ensuring data invariants and program correctness. Unfortunately, they pose a tough problem for type inference when they are used as local type assumptions. Local type assumptions often result in the lack of principal types and cast the generalisation of local let-bindings prohibitively difficult to implement and specify. User-declared axioms only make this situation worse. In this paper, we explain the problems and - perhaps controversially - argue for abandoning local let-binding generalisation. We give empirical results that local let generalisation is only sporadically used by Haskell programmers. Moving on, we present a novel constraint-based type inference approach for local type assumptions. Our system, called OUTSIDEIN(X), is parameterised over the particular underlying constraint domain X, in the same way as HM(X). This stratification allows us to use a common metatheory and inference algorithm. OUTSIDEIN(X) extends the constraints of X by introducing implication constraints on top. We describe the strategy for solving these implication constraints, which, in turn, relies on a constraint solver for X. We characterise the properties of the constraint solver for X so that the resulting algorithm only accepts programs with principal types, even when the type system specification accepts programs that do not enjoy principal types. Going beyond the general framework, we give a particular constraint solver for X = type classes + GADTs + type families, a non-trivial challenge in its own right. This constraint solver has been implemented and distributed as part of GHC 7.}},
  author       = {{Vytiniotis, Dimitrios and Peyton Jones, Simon and Schrijvers, Tom and Sulzmann, Martin}},
  issn         = {{0956-7968}},
  journal      = {{JOURNAL OF FUNCTIONAL PROGRAMMING}},
  keywords     = {{type system,type inference,local assumtions,type classes,GADTs,type families,Haskell,CONSTRAINT HANDLING RULES,CONGRUENCE CLOSURE}},
  language     = {{eng}},
  number       = {{4-5}},
  pages        = {{333--412}},
  title        = {{OUTSIDEIN(X) : modular type inference with local assumptions}},
  url          = {{http://doi.org/10.1017/S0956796811000098}},
  volume       = {{21}},
  year         = {{2011}},
}

Altmetric
View in Altmetric
Web of Science
Times cited: