Type Constructor Polymorphism for Scala: Theory and Practice (Type constructor polymorfisme voor Scala: theorie en praktijk)
Type Constructor Polymorphism for Scala: Theory and Practice
Moors, Adriaan; M9920455
A static type system is an important tool in efficiently developing correct software. We describe the theoretical underpinnings as well as the practical side of our extension of Scala's type system. More concretely, we generalised Scala's support for parametric polymorphism -- typically called "genericity" in object-oriented languages -- to the higher-order case. We call the result "type constructor polymorphism", as Scala programmers may now safely abstract over type constructors. This generalisation, amplified by the synergy with Scala's existing features such as implicits, represents an important asset in the library designer's abstraction-building tool belt, while the user of these abstractions need not worry about their inner workings. The theoretical side of the story focusses on the lacunae in the existing Scala formalisms, and presents our core calculus that solves these. Finally, we elaborate on our vision for future improvements of the type system, based on our practical experience with type constructor polymorphism.