Implementing path-dependent GADT reasoning for Scala 3

Yichen Xu, Aleksander Boruch-Gruszecki, Lionel Parreaux

Research output: Chapter in Book/Conference Proceeding/ReportConference Paper published in a bookpeer-review

Abstract

Generalized Algebraic Data Types (GADT) are a popular programming language feature allowing advanced type-level properties to be encoded in the data types of a program. While Scala does not have direct support for them, GADT definitions can be encoded through Scala class hierarchies. Moreover, the Scala 3 compiler recently augmented its pattern matching capabilities to reason about such class hierarchies, making GADT-based programming practical in Scala. However, the current implementation can only reason about type parameters, but Scala's type system also features singleton types and abstract type members (collectively known as path-dependent types), about which GADT-style reasoning is also useful and important. In this paper, we show how we extended the existing constraint-based GADT reasoning of the Scala 3 compiler to also consider path-dependent types, making Scala's support for GADT programming more complete and bringing Scala closer to its formal foundations.

Original languageEnglish
Title of host publicationSCALA 2021 - Proceedings of the 12th ACM SIGPLAN International Symposium on Scala, co-located with SPLASH 2021
EditorsJulien Richard-Foy, Sebastien Doeraene
PublisherAssociation for Computing Machinery, Inc
Pages22-32
Number of pages11
ISBN (Electronic)9781450391139
DOIs
Publication statusPublished - 17 Oct 2021
Event12th ACM SIGPLAN International Symposium on Scala, SCALA 2021, co-located with SPLASH 2021 - Virtual, Online, United States
Duration: 17 Oct 2021 → …

Publication series

NameSCALA 2021 - Proceedings of the 12th ACM SIGPLAN International Symposium on Scala, co-located with SPLASH 2021

Conference

Conference12th ACM SIGPLAN International Symposium on Scala, SCALA 2021, co-located with SPLASH 2021
Country/TerritoryUnited States
CityVirtual, Online
Period17/10/21 → …

Bibliographical note

Publisher Copyright:
© 2021 ACM.

Keywords

  • Generalized algebraic data types
  • Path-dependent types
  • Scala
  • Singleton types
  • Type members

Fingerprint

Dive into the research topics of 'Implementing path-dependent GADT reasoning for Scala 3'. Together they form a unique fingerprint.

Cite this