Please log in to watch this conference skillscast.
Newtypes are the key to data abstraction in Haskell, and come with an crucial performance guarantee: it doesn’t cost anything to use a newtype.
Embarrassingly, this guarantee is weak: it fails as soon as you embed a newtype’d value in a data structure. At the same time, the hugely-popular language feature “generalised newtype deriving” turns out to rely internally on a strong version of the guarantee. And, in the presence of type-level functions, the strong version of the guarantee turns out to be unsound, leading to a notorious type-soundness bug in GHC that has persisted for several years.
As is often the case in Haskell, finding a solid, principled solution to the problem turned out to be far more interesting than we expected, requiring us to distinguish two flavours of type equality (representational and nominal), with a “role system” to allow type-safe abstraction. I think the result is pretty cool. In this talk I’ll explain what all the fuss is about.
YOU MAY ALSO LIKE:
Safe, Zero-Cost Coercions in Haskell
Simon Peyton Jones, MA, MBCS, CEng, graduated from Trinity College Cambridge in 1980. Simon 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.
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.
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.
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.