In a higher order, curried language like Haskell, it seems simple and uniform for type inference and checking to treat binary function applications, f e
. A hard-won lesson of GHC is that it is much, much better to typecheck application spines all at once, thus f e1 e2 .. en
.
I will describe a number of separate advantages that spring from treating applications as a whole in this way, including:
• User experience. We can get better error messages (e.g. “In the third argument of the call of f
”).
• Impredicative polymorphism. Treating applications as a whole was The Key to making impredicative polymorphism fully part of GHC.
• Visible type application. We can neatly handle so-called visible type application, such as reverse @Int xs
.
• Required type arguments. Similarly we can handle required type arguments. If f :: forall a -> blah
then in the application f Int 77
we can account for the fact that Int
is a type argument (whose syntax is that of types) while 77
is a term argument.
Of course, type arguments (both required and optional) and term arguments can be arbitarily mixed: f :: forall a. Int -> forall b -> forall c. (b,c) -> a
Simon Peyton Jones, MA, MBCS, CEng, graduated from Trinity College Cambridge in 1980. After two years in industry, he spent seven years as a lecturer at University College London, and nine years as a professor at Glasgow University, before moving to Microsoft Research (Cambridge) in 1998. He became an Engineering Fellow at Epic Games in 2021.
His main research interest is in functional programming languages, their implementation, and their application. He has led a succession of research projects focused around the design and implementation of production-quality functional-language systems for both uniprocessors and parallel machines. He was a key contributor to the design of the now-standard functional language Haskell, and is the lead designer of the widely-used Glasgow Haskell Compiler (GHC). He has written two textbooks about the implementation of functional languages.
More generally, he is interested in language design, rich type systems, software component architectures, compiler technology, code generation, runtime systems, virtual machines, and garbage collection. He is particularly motivated by direct use of principled theory to practical language design and implementation – that’s one reason he loves functional programming so much.
Sat 20 JanDisplayed time zone: London change
11:00 - 12:30 | |||
11:00 30mTalk | Retrofitting Null-Safety into Java WITS Artem Pianykh Facebook London | ||
12:00 30mTalk | Type inference for application spines WITS Simon Peyton Jones Epic Games |