Quantified Class Constraints


Gert-Jan Bottu, Georgios Karachalias, Tom Schrijvers, Bruno Oliveira and Philip Wadler.
ACM SIGPLAN Haskell Symposium.
2017.

Abstract

Quantified class constraints have been proposed many years ago to raise the expressive power of type classes from Horn clauses to first-order logic. Yet, while it has been much asked for over the years, the feature was never implemented or studied in depth. Instead, several workarounds have been proposed, all of which are ultimately stopgap measures. This paper revisits the idea of quantified class constraints and elaborates it into a practical language design. We show the merit of quantified class constraints in terms of more expressive modeling and in terms of terminating type class resolution. In addition, we provide a declarative specification of the type system as well as a type inference algorithm that elaborates into System F. Moreover, we discuss termination conditions of our system and also provide a prototype implementation.

BibTeX

@inproceedings{haskell2017b,
  title = {Quantified Class Constraints},
  author = {Gert-Jan Bottu, Georgios Karachalias, Tom Schrijvers, Bruno Oliveira and Philip Wadler},
  year = {2017},
  booktitle = {ACM SIGPLAN Haskell Symposium},
  url = {/Research/papers/haskell2017b.pdf},
  abstract = {Quantified class constraints have been proposed many years ago
  to raise the expressive power of type classes from Horn clauses
  to first-order logic. Yet, while it has been much asked for over
  the years, the feature was never implemented or studied in depth.
  Instead, several workarounds have been proposed, all of which are
  ultimately stopgap measures.

  This paper revisits the idea of quantified class constraints and
  elaborates it into a practical language design. We show the merit
  of quantified class constraints in terms of more expressive modeling
  and in terms of terminating type class resolution. In addition, we
  provide a declarative specification of the type system as well as a
  type inference algorithm that elaborates into System F. Moreover,
  we discuss termination conditions of our system and also provide a
  prototype implementation.
  },
}