Late in the Scala 3 development process, a new type scala.Matchable was introduced to fix a loophole in pattern matching. This post discusses that loophole, how Matchable fixes it, and implications of this change.

Lincoln Park Education Pavilion Detail, © 2021, Dean Wampler

For an even more concise summary of most of the notable changes in Scala 3, see my new Scala 3 Highlights page.

Like Scala 3 itself, Programming Scala, Third Edition is almost finished! You can read a draft of it on the O’Reilly Learning Platform.

Arrays in Scala have always been Java arrays, which are mutable. Scala 3 introduces a new immutable wrapper around arrays call…


For a long time, Scala has supported a useful “trick” called infix operator notation. If a method takes a single argument, you can call it without the period after the instance and without parentheses around the argument. This post describes changes in Scala 3.

Spring Equinox Sunset, Ohio St. Chicago, ©2021, Dean Wampler, All Rights Reserved

For example, if I have a Matrix class and a + method to add matrices, element by element, I can write matrix1.+(matrix2) or use the less cluttered and more intuitive syntax, matrix1 + matrix2. The intention was to support true operators, like + in intuitive contexts like this. …


Type lambdas are the type analog of “value lambdas”, also known as functions 🤓. This post explores them. The discussion naturally leads to the new ability to parameterize the types of functions, which was previously only supported for methods. While I’m at it, I’ll mention another method feature that’s now supported for functions, dependent function types.

March 8, 2021: Updated the Functor example after helpful feedback from Sergei Winitzki.

Sofitel in the Snow, ©2021, Dean Wampler, All Rights Reserved

You can start reading the rough draft of Programming Scala, Third Edition on the O’Reilly Learning Platform. Most of the chapters are available. Feedback is welcome!

Type Lambdas

Let’s suppose we wanted to…


(With apologies to Bob Dylan.)

This post covers how some uses in Scala 2 of the underscore, _, are being replaced with alternatives. The contexts include import and the new export statements and type parameter wild cards. Along the way, I’ll discuss other changes for import statements, the new export statement, and a syntax change for repeated parameter lists (a.k.a., variable argument lists).

Cork Trivet from Queork, ©2021, Dean Wampler, All Rights Reserved

Scala 3.0.0-RC1 is out! This means the language changes should be done. The discussion of import syntax changes below was the last major change. …


This post discusses a few changes and additions in Scala 3 that make designing robust, object-oriented type hierarchies a little easier.

Icicles © 2021, Dean Wampler

Join me for Scala Love in the City, February 13th. I’m doing a talk about Scala 3’s contextual abstractions.

For an even more concise summary of most of the notable changes in Scala 3, see my new Scala 3 Highlights page.

You can start reading the rough draft of Programming Scala, Third Editionon the O’Reilly Learning Platform. The first half or so of the chapters are available. I am refining them still, but any feedback is welcome!

While object-oriented…


Let’s take a break from the type system changes and discuss other new features in Scala 3. This post is about universal apply methods, which eliminate the need for using new when creating instances, most of the time.

After a Chicago Snow, © 2021, Dean Wampler

For an even more concise summary of most of the notable changes in Scala 3, see my new Scala 3 Highlights page.

You can start reading the rough draft of Programming Scala, Third Edition on the O’Reilly Learning Platform. The first half or so of the chapters are available. I am refining them still, but any feedback is welcome!

One of the…


In the last post (which proved popular), I introduced dependent types and discussed interesting things you can with values as types, like val onePlusOne: 1+1 = 2. In this post, I’ll visit some more sophisticated capabilities provided by dependent typing.

January 17, 2021 update: Chris Birchall pointed out to me that it’s not necessary to use NSize[N] in the DTList example. N will do. I added another recursive type on N example instead.

Typical office politics. © 2019, Dean Wampler

For an even more concise summary of most of the notable changes in Scala 3, see my new Scala 3 Highlights page.

You can start reading the…


Scala 3 expands on the type-level computing you can do at compile time. This post starts a discussion of dependent types.

Pelicans at Point Reyes Beach South, © Dean Wampler, 2019

Happy New Year! I hope 2021 is better than 2020 for all of us.

For an even more concise summary of most of the notable changes in Scala 3, see my new Scala 3 Highlights page.

You can start reading the rough draft of Programming Scala, Third Edition on the O’Reilly Learning Platform. The first half or so of the chapters are available. I am refining them still, but any feedback is welcome!

Dependent types are types that depend…


Two new features in Scala 3’s type system are intersection and union types. They embrace set theory more explicitly to improve the soundness of the type system, where a type can be considered a set and the instances of it are the members of the set.

December 29, 2020 and January 7, 2021. Fixed mistakes in the discussion of subtyping for intersection types and the distribution laws. Thanks to James Warren , Sean Kim, and Pascal Mengelt for catching my mistakes.

Fence Rail, Radford, Va., Dec 29, 2015. © 2015, Dean Wampler. All Rights Reserved.

For an even more concise summary of most of the changes in Scala 3, see my new Scala 3…


In this post, I begin a tour of many of the changes to Scala’s type system in Scala 3. Let’s start with two relatively small changes, opaque type aliases and open classes, which have nice properties for better performance and better code quality.

December 4, 2020: Clarified the tradeoffs between value classes and opaque type aliases, following comments by Martin Odersky in a contributors mailing list thread.

Christmas Lights on Erie Street. © 2020, Dean Wampler. All Rights Reserved.

Opaque Type Aliases

It’s common to have small classes that represent domain concepts and operations, but are backed by a single AnyVal, like a Double. In some cases, you really want the performance of having just…

Dean Wampler

The person who’s wrong on the Internet. ML, AI, & FP supplicant at Domino Data Lab. Formerly at Anyscale and Lightbend. Speaker, Lover, O’Reilly author.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store