Abstract
Type inference - the problem of determining whether a program is well-typed - is well-understood. In contrast, elaboration - the task of constructing an explicitly-typed representation of the program - seems to have received relatively little attention, even though, in a non-local type inference system, it is non-trivial. We show that the constraint-based presentation of Hindley-Milner type inference can be extended to deal with elaboration, while preserving its elegance. This involves introducing a new notion of "constraint with a value", which forms an applicative functor.
- Julien Cretin and Didier Rémy. On the power of coercion abstraction. In Principles of Programming Languages (POPL), pages 361--372, 2012. Google Scholar
Digital Library
- Luis Damas and Robin Milner. Principal type-schemes for functional programs. In Principles of Programming Languages (POPL), pages 207--212, 1982. Google Scholar
Digital Library
- Jacques Garrigue. Relaxing the value restriction. In Functional and Logic Programming, volume 2998 of Lecture Notes in Computer Science, pages 196--213. Springer, 2004.Google Scholar
Cross Ref
- Jacques Garrigue and Didier Rémy. Extending ML with semi-explicit higher-order polymorphism. Information and Computation, 155(1):134--169, 1999. Google Scholar
Digital Library
- Jacques Garrigue and Didier Rémy. Ambivalent types for principal type inference with GADTs. In Asian Symposium on Programming Languages and Systems (APLAS), 2013.Google Scholar
Digital Library
- Adam Gundry. Type Inference, Haskell and Dependent Types. PhD thesis, University of Strathclyde, 2013.Google Scholar
Digital Library
- Jörgen Gustavsson and Josef Svenningsson. Constraint abstractions. In Symposium on Programs as Data Objects, volume 2053 of Lecture Notes in Computer Science. Springer, 2001. Google Scholar
Digital Library
- J. Roger Hindley. The principal type-scheme of an object in combinatory logic. Transactions of the American Mathematical Society, 146:29--60, 1969.Google Scholar
- Gérard Huet. Résolution d'équations dans des langages d'ordre 1, 2, : : :, !. PhD thesis, Université Paris 7, 1976.Google Scholar
- John Hughes. Generalising monads to arrows. Science of Computer Programming, 37(1-3):67--111, 2000. Google Scholar
Digital Library
- George Kuan and David MacQueen. Efficient type inference using ranked type variables. In ACM Workshop on ML, pages 3--14, 2007. Google Scholar
Digital Library
- David McAllester. A logical algorithm for ML type inference. In Rewriting Techniques and Applications (RTA), volume 2706 of Lecture Notes in Computer Science, pages 436--451. Springer, 2003. Google Scholar
Digital Library
- Conor McBride and Ross Paterson. Applicative programming with effects. Journal of Functional Programming, 18(1):1--13, 2008. Google Scholar
Digital Library
- Dale Miller. Unification under a mixed prefix. Journal of Symbolic Computation, 14(4):321--358, 1992. Google Scholar
Digital Library
- Robin Milner. A theory of type polymorphism in programming. Journal of Computer and System Sciences, 17(3):348--375, 1978.Google Scholar
- Simon Peyton Jones, Dimitrios Vytiniotis, Stephanie Weirich, and Mark Shields. Practical type inference for arbitrary-rank types. Journal of Functional Programming, 17(1):1--82, 2007. Google Scholar
Digital Library
- François Pottier. Inferno: a library for Hindley-Milner type inference and elaboration, February 2014. http://gallium.inria.fr/~fpottier/inferno/inferno.tar.gz.Google Scholar
- François Pottier and Didier Rémy. The essence of ML type inference. Draft of an extended version. Unpublished, 2003.Google Scholar
- François Pottier and Didier Rémy. The essence of ML type inference. In Benjamin C. Pierce, editor, Advanced Topics in Types and Programming Languages, chapter 10, pages 389--489. MIT Press, 2005.Google Scholar
- Didier Rémy. Extending ML type system with a sorted equational theory. Technical Report 1766, INRIA, 1992.Google Scholar
- Didier Rémy and Boris Yakobowski. A Church-style intermediate language for MLF. Theoretical Computer Science, 435(1):77--105, 2012. Google Scholar
Digital Library
- S. Doaitse Swierstra and Luc Duponcheel. Deterministic, errorcorrecting combinator parsers. In Advanced Functional Programming, volume 1129 of Lecture Notes in Computer Science, pages 184--207. Springer, 1996. Google Scholar
Digital Library
- Robert Endre Tarjan. Efficiency of a good but not linear set union algorithm. Journal of the ACM, 22(2):215--225, 1975. Google Scholar
Digital Library
- Dimitrios Vytiniotis, Simon L. Peyton Jones, Tom Schrijvers, and Martin Sulzmann. OutsideIn(X): Modular type inference with local assumptions. Journal of Functional Programming, 21(4--5):333--412, 2011. Google Scholar
Digital Library
- Mitchell Wand. A simple algorithm and proof for type inference. Fundamenta Informaticæ, 10:115--122, 1987.Google Scholar
Cross Ref
Index Terms
Hindley-milner elaboration in applicative style: functional pearl
Recommendations
Hindley-milner elaboration in applicative style: functional pearl
ICFP '14: Proceedings of the 19th ACM SIGPLAN international conference on Functional programmingType inference - the problem of determining whether a program is well-typed - is well-understood. In contrast, elaboration - the task of constructing an explicitly-typed representation of the program - seems to have received relatively little attention, ...
Simple, partial type-inference for System F based on type-containment
Proceedings of the tenth ACM SIGPLAN international conference on Functional programmingWe explore partial type-inference for System F based on type-containment. We consider both cases of a purely functional semantics and a call-by-value stateful semantics. To enable type-inference, we require higher-rank polymorphism to be user-specified ...
Elaboration with first-class implicit function types
Implicit functions are dependently typed functions, such that arguments are provided (by default) by inference machinery instead of programmers of the surface language. Implicit functions in Agda are an archetypal example. In the Haskell language as ...







Comments