Join Newsletter

Typeclass-driven Polymorphism in Scala

YOW! Lambda Jam 2013

A completely re-designed collections API was released for Scala 2.8 in 2010. Among it’s innovative features were highly polymorphic methods (e.g. map) whose static types varied in a rich, context-dependent fashion. The technique employed was based upon multi-parameter typeclasses, which interact with the type-inference process. The initial reception was uncertain: what Odersky described as “a new kind of polymorphism”, some Scala users – disturbed by the increased API complexity – described instead as “the longest suicide note in history”. It took another year for Miles Sabin to note the technique had precedent in Haskell, where it was called Functional Dependencies. This talk will explain the technique, and show how it can be useful in applications beyond the Collections API.

Slides and code are available here: https://github.com/benhutchison/TypeclassDrivenPolymorphism

Ben Hutchison

Software Architect

Seek

Australia

Ben Hutchison is a Software Architect at SEEK in Melbourne, where his current focus is on data security.

He has also coordinated the Melbourne Scala user group the past 10 years. Ben maintains and/or contributes to a number of open source Scala projects and is a Typelevel and Scala community committer. His particular engineering interests include strong static typing, Scala in the browser client, and applying functional programming & type-classes in industry.