First-Class Type Classes

Type Classes have met a large success in Haskell and Isabelle , as a solution for sharing notations by overloading and for specifying with abstract structures by quantification on contexts. However, both systems are limited by second-class implementations of these constructs, and these limitations are only overcomed by ad-hoc extensions to the respective systems. We propose an embedding of type classes into a dependent type theory that is first-class and supports some of the most popular extensions right away. The implementation is correspondingly cheap, general and integrates well inside the system, as we have experimented in Coq. We show how it can be used to help structured programming and proving by way of examples.

[1]  Freek Wiedijk,et al.  The Seventeen Provers of the World, Foreword by Dana S. Scott , 2006, The Seventeen Provers of the World.

[2]  Hugo Herbelin,et al.  The Coq proof assistant : reference manual, version 6.1 , 1997 .

[3]  Florian Kammüller,et al.  Locales - A Sectioning Concept for Isabelle , 1999, TPHOLs.

[4]  Markus Wenzel,et al.  Isabelle/Isar , 2006, The Seventeen Provers of the World.

[5]  O. J. Dahl,et al.  Simula Begin , 1979 .

[6]  David Aspinall,et al.  Formalising Java's Data Race Free Guarantee , 2007, TPHOLs.

[7]  Pierre Letouzey,et al.  Programmation fonctionnelle certifiée : L'extraction de programmes dans l'assistant Coq. (Certified functional programming : Program extraction within Coq proof assistant) , 2004 .

[8]  Brian Campbell,et al.  Amortised Memory Analysis Using the Depth of Data Structures , 2009, ESOP.

[9]  Maribel Fernández,et al.  Curry-Style Types for Nominal Terms , 2006, TYPES.

[10]  Markus Wenzel,et al.  Type Classes and Overloading in Higher-Order Logic , 1997, TPHOLs.

[11]  Edward Hill A Comparative Study of Very Large Data Bases , 1978, Lecture Notes in Computer Science.

[12]  Simon L. Peyton Jones,et al.  Associated types with class , 2005, POPL '05.

[13]  Sam Lindley,et al.  Extensional Rewriting with Sums , 2007, TLCA.

[14]  Robert F. Stärk,et al.  Proof Theory in Computer Science , 2001, Lecture Notes in Computer Science.

[15]  Brian Huffman,et al.  Axiomatic Constructor Classes in Isabelle/HOLCF , 2005, TPHOLs.

[16]  Robert Pollack,et al.  Dependently Typed Records for Representing Mathematical Structure , 2000, TPHOLs.

[17]  Robin Milner,et al.  Principal type-schemes for functional programs , 1982, POPL '82.

[18]  Martin Odersky,et al.  Generics of a higher kind , 2008, OOPSLA.

[19]  Wolfram Kahl,et al.  Named Instances for Haskell Type Classes , 2001 .

[20]  Thierry Coquand,et al.  A Logical Framework with Dependently Typed Records , 2003, Fundam. Informaticae.

[21]  Markus Wenzel,et al.  Constructive Type Classes in Isabelle , 2006, TYPES.

[22]  Matthieu Sozeau,et al.  Subset Coercions in Coq , 2006, TYPES.

[23]  Mark P. Jones,et al.  Type Classes with Functional Dependencies , 2000, ESOP.

[24]  Amokrane Saïbi Typing algorithm in type theory with inheritance , 1997, POPL '97.

[25]  Freek Wiedijk,et al.  The Seventeen Provers of the World , 2006 .

[26]  Benjamin Grégoire,et al.  A compiled implementation of strong reduction , 2002, ICFP '02.

[27]  Philip Wadler,et al.  How to make ad-hoc polymorphism less ad hoc , 1989, POPL '89.