Back To Schedule
Hall 1 - Foundations

Wednesday May 16th, 17:45-18:30

Type Parameter Power-Up! Variance, Bounds, and Inference

About this Session

Adding type parameters to classes is a powerful way to reuse code in Scala. By leveraging variance, type bounds, and higher-kinded

types we can add further control and power to this reuse. We will learn how to use variance and type bounds to refine a type, how these types are inferred, and how higher-kinded types and type bounds combine with implicit resolution to give rise to the typeclass pattern, which helps bridge the gap between Scala's object-oriented and functional programming sides. We will also see how these features are evolving in future versions of Scala and Dotty.

Required knowledge

This talk assumes attendees have some exposure to type parameters and parameter inference, but will provide a brief review of this material.

Learning objectives

Attendees will learn how and when to apply variance and type bounds to their data structures to achieve better reuse. They will learn how to interpret and address compiler errors related to variance and type parameter inference.


Chris Phelps

I've been coding in Java since the early days of the language, and in Scala for the last 5 years. My main areas of focus are in microservices and reactive approaches. I am always looking for Scala and general functional programming techniques help to achieve expressive, reusable code that is easy to understand and pleasant to work on. As our organization is a polyglot development environment, I'd also love to talk to you about adopting and evangelizing Scala within a receptive organization.