A new Type-Class solver for Coq in Elpi
Abstract
Type classes [6] were first introduced in the Haskell language as a way to implement ad-hoc polymorphism, i.e. symbol overloading. The Haskell compiler synthesizes the appropriate implementation for the overloaded symbol by looking at the types of its arguments and by composing user-provided implementations for atomic types and type formers. We call the software component in charge of this synthesis the type class solver. Type classes soon were introduced in Coq version 8.2, 15 years ago, by Sozeau and Oury [5]. Given the expressiveness of the language, Coq type classes not only relate a type to some operations, but also give them a specification. For example the Eq type class below links a type T to a boolean function eqb which is proved to be correct.
Domains
Computer Science [cs]Origin | Files produced by the author(s) |
---|