The Limitations of Type Classes as Subtyped Implicits (Short Paper)
Type classes enable a powerful form of ad-hoc polymorphism which provide solutions to many programming design problems. Inspired by this, Scala programmers have striven to emulate them in the design of libraries like Scalaz and Cats.
The natural encoding of type classes combines subtyping and implicits, both central features of Scala. However, this encoding has limitations. If the type class hierarchy branches, seemingly valid programs can hit implicit resolution failures. These failures must then be solved by explicitly passing the implicit arguments which is cumbersome and negates the advantages of type classes.
In this paper we describe instances of this problem and show that they are not merely theoretical but often arise in practice. We also discuss and compare the space of solutions to this problem in Scala today and in the future.
Sun 22 OctDisplayed time zone: Tijuana, Baja California change
10:30 - 12:00 | |||
10:30 30mTalk | Towards Algorithmic Typing for DOT (Short Paper) Scala 2017 Abel Nieto University of Waterloo DOI Pre-print File Attached | ||
11:00 30mTalk | The Limitations of Type Classes as Subtyped Implicits (Short Paper) Scala 2017 Adelbert Chang Unaffiliated DOI Pre-print | ||
11:30 30mTalk | Rust-Like Borrowing with 2nd-Class Values (Short Paper) Scala 2017 DOI Media Attached |