Miles has been doing stuff with Scala for more than a decade, currently with Underscore Consulting. He is a cofounder of Typelevel and his best known project, the Scala generic programming library shapeless, is the weapon of choice wherever boilerplate needs to be scrapped or arities abstracted over. Lately he has been spending most of his time hacking on scalac and Dotty, trying to make shapeless redundant.
Miles, you are one of the most well-known technical leaders in the Scala community and co-founder of Typelevel. What prompted you to start Typelevel?
Typelevel’s co-founders (Lars Hupel, Erik Osheim and I) had one main goal when we started out: to remove as many barriers as possible to people taking a functional approach to programming in Scala.
That meant a focus on addressing long standing technical issues in Scala which particularly affected functional programmers. And it also meant a focus on non-technical issues: creating a welcoming environment for people new to functional programming; improving the release processes and standard of documentation around functional libraries; and generally fostering cooperation between projects and organisations both under the Typelevel umbrella and beyond.
How have you progressed on those goals in the 7 years since it all started?
I think we’ve been very successful.
It’s been exciting to see Cats and its ecosystem grow and evolve. The Typelevel fork of the Scala compiler has been a valuable proving ground for new language features which have since landed in both Scala 2 and Dotty. Perhaps more importantly it helped generate a sense in the community that participation in the evolution of the core of the language is accessible to many more people than had been assumed.
It’s also been wonderful to be able to work with the Scala Center and ScalaBridge on getting more people involved in contributing to the Scala free and open source ecosystem and bring new people into the Scala community. And it’s been lovely to see Typelevel grow from a handful of projects with just an online presence into something much larger, now with regular conferences and meetups.
You recently announced the Typelevel Sustainability Program. One question we often hear is why would a company pay for open-source software? Shouldn’t it all be “free”?
All Scala free and open-source software is free in the sense of “free of charge”. I think the sense of “free” which matters most to most users of and contributors to Scala FOSS is the sense of freedom to examine, study, modify and redistribute.
But contributors need to pay the bills, which means that without some form of support their time and willingness to work on open source projects is often limited by their employment and other obligations (unless they’re lucky enough to be employed to work on open source projects).
The result is that on the one hand we have project maintainers essentially keeping critical components of the open source ecosystem going in their spare time, and on the other we have companies relying on that ecosystem without obvious mechanisms to support the work that they rely on.
The Typelevel Sustainability Program is an attempt to address that by providing companies and individuals a clear route to give that support. Our initial goal is to raise sufficient funds to employ a dedicated maintainer for Typelevel projects, half time, for a year, with a focus on supporting the community contributors. To put it another way, a paid maintainer’s primary task will be to maintain community-driven development.
We also want to help companies support the ecosystem in indirect ways, for instance by providing computing resources/tools such as CI systems, communication platforms, development tools, etc. Triplequote’s offer to share Hydra revenues through June is a great example. Companies can also help by giving their employees paid time to make contributions to open source projects. They can also help by sponsoring events such as free training, conferences, or by providing venues, food and so on.
Individual contributors are always welcome, and we recognise that not everyone is able to dedicate the time or resources. They can also help by spreading the word about our fundraising campaign, especially to their employers, mentioning and linking to our donation page when they write blog posts or give talks about these libraries and tools. Or by generally advocating for sustainable FOSS development.
How do you see the relationship between the Scala open-source ecosystem and commercial tools?
The fact that FOSS needs initiatives like the Typelevel Sustainability Program makes it pretty clear that funding for important open source software and surrounding infrastructure isn’t a solved problem.
Until it is a solved problem, commercial tools will remain an important part of the picture. Open source can benefit from commercial tools, in much the same way that companies benefit from open source. For instance, tools like YourKit and Hydra can help OSS developers produce better software, be more productive, etc. Similarly Travis CI or Azure Pipelines are commercial tools that support open-source with free access to their platforms. This is a pragmatic approach that works for everyone.
The upcoming Scala 3.0 is getting closer and closer to feature freeze. As one of the people closely involved in this effort, what do you think is going to be its biggest selling point?
As an advocate for functional programming, the biggest selling point for me has to be … functions!
Up until now Scala has had an uncomfortable mismatch between methods, which can polymorphic, dependent and implicit but not first-class (ie. they are not ordinary values), and functions which are first-class, but can’t be polymorphic, dependent or implicit. A lot of the time that mismatch goes unnoticed, but often it matters and when it does the workarounds can be quite laborious.
Dotty goes a long way towards eliminating that mismatch. I believe that polymorphic functions, which landed in Dotty just recently, in particular will have a hugely beneficial impact on the future evolution of libraries like Cats and shapeless.
shapeless is all about computing at the type level and Dotty has some new features which will change that landscape significantly for the better. Match types, specializing inline methods, inline and implicit matches will simplify a lot of code which currently has to be written logic-programming-style via implicits. Because they allow computations to be expressed more directly without needing to exploit implicit search, compile times should improve too.
And of course the type class derivation primitives that I’ve been working on with Martin over the last year and which are now baked into Dotty. Libraries like shapeless will still have an important role to play, but all of the grubby compiler-internals-dependent stuff that was previously needed to make them work will go away.
Miles, thank you very much for your time!
Throughout the month of June, use the code TYPELEVEL25 when purchasing Hydra to get 25% off, and we’ll donate 25% to Typelevel. To learn more about this offer and the Typelevel Sustainability Program click here.