Adding kind-polymorphism to the Scala programming language von Miles Sabin · · 558 Besichtigungen · Scala Days











Embed <div id="presentation-embed-38907884"></div> <script src='https://slideslive.com/embed_presentation.js'></script> <script> embed = new SlidesLiveEmbed('presentation-embed-38907884', { presentationId: '38907884', autoPlay: false, // change to true to autoplay the embedded presentation verticalEnabled: true }); </script>

Shapeless is the tool that people reach for when they have problems involving abstraction over data types of different shapes and sizes. But suppose we wanted to support this sort of data type generic programming directly in Scala? What sort of primitive mechanisms would we choose? In this talk I will argue that kind-polymorphism, the ability to abstract over type constructors of any arity, is one we should give serious consideration to. I will demonstrate a prototype implementation in the Typelevel compiler and show how it can be used to dramatically simplify generic programming in Scala. Required knowledge An understanding of parametric polymorphism and higher kinded types is required. Some familiarity with generic programming would be helpful. Learning objectives I want to convey that supposedly "advanced" programming language features can be crucial to allowing ordinary everyday programming problems to be solved in a simple and natural way. Miles has been doing stuff with Scala for more than a decade, currently with Underscore Consulting. He is a cofounder of Typelevel and his best known project, the Scala generic programming library shapeless, is the weapon of choice wherever boilerplate needs to be scrapped or arities abstracted over.