Slides and examples for the Scala Days 2026 talk by Matt Bovel (EPFL).
- Slides: presentation/presentation.html (PDF)
- Paper: First-Class Refinement Types for Scala (OOPSLA 2026)
- Playground: matt.bovel.net/scala-refinement-types/playground
dotty-examples/ contains every example from the slides, plus a few more. Each file runs on its own with Scala CLI:
scala --cli-version 1.18.0 run dotty-examples/02_fansi.scalaLines marked // error are commented out because they are expected not to
compile; uncomment one to see the error message. dotty-examples/check.sh compiles
every file and checks that each // error line indeed fails; CI runs it on
every push.
To use refinement types in your own project, add these directives to your file:
//> using scalaOrganization ch.epfl.lara
//> using scala 3.10.1-RC1-bin-20260903-e1f9361-NIGHTLY
//> using options -language:experimental.qualifiedTypesor, with sbt, in build.sbt:
scalaOrganization := "ch.epfl.lara"
scalaVersion := "3.10.1-RC1-bin-20260903-e1f9361-NIGHTLY"
scalacOptions += "-language:experimental.qualifiedTypes"stainless-examples/ contains examples verified by
Stainless, which
checks refinement types with SMT solvers. install.sh installs a pinned
Stainless release (with z3 and cvc5) into .stainless/:
./install.sh
.stainless/stainless stainless-examples/sum.scala stainless-examples/merge_sort.scalaThe files also compile with Scala CLI, in silent mode, once Stainless is
installed (merge_sort.scala uses the Stainless library from .stainless/).
The slides are written in presentation/presentation.md.
presentation.html and presentation.pdf are committed; to rebuild them
(requires Docker):
cd presentation && make