Chapter 18 Type Classes
- Class and Instance declarations
- Binding classes
- Parameterized Instances
- Building hierarchies
- Summary of the commands
This chapter presents a quick reference of the commands related to type classes. For an actual introduction to type classes, there is a description of the system [126] and the literature on type classes in Haskell which also applies.
18.1 Class and Instance declarations
The syntax for class and instance declarations is the same as record syntax of Coq:
|
|
The αi : τi variables are called the parameters of the class and the fk : typek are called the methods. Each class definition gives rise to a corresponding record declaration and each instance is a regular definition whose name is given by ident and type is an instantiation of the record type.
We’ll use the following example class in the rest of the chapter:
Coq < eqb : A -> A -> bool ;
Coq < eqb_leibniz : forall x y, eqb x y = true -> x = y }.
This class implements a boolean equality test which is compatible with leibniz equality on some type. An example implementation is:
Coq < eqb : A -> A -> bool ;
Coq < eqb_leibniz : forall x y, eqb x y = true -> x = y }.
This class implements a boolean equality test which is compatible with leibniz equality on some type. An example implementation is:
Coq < eqb : A -> A -> bool ;
Coq < eqb_leibniz : forall x y, eqb x y = true -> x = y }.
This class implements a boolean equality test which is compatible with leibniz equality on some type. An example implementation is:
Coq < eqb : A -> A -> bool ;
Coq < eqb_leibniz : forall x y, eqb x y = true -> x = y }.
This class implements a boolean equality test which is compatible with leibniz equality on some type. An example implementation is:
Coq < eqb : A -> A -> bool ;
Coq < eqb_leibniz : forall x y, eqb x y = true -> x = y }.
This class implements a boolean equality test which is compatible with leibniz equality on some type. An example implementation is:
Coq < eqb : A -> A -> bool ;
Coq < eqb_leibniz : forall x y, eqb x y = true -> x = y }.
This class implements a boolean equality test which is compatible with leibniz equality on some type. An example implementation is:
Coq < eqb : A -> A -> bool ;
Coq < eqb_leibniz : forall x y, eqb x y = true -> x = y }.
This class implements a boolean equality test which is compatible with leibniz equality on some type. An example implementation is:
Coq < eqb : A -> A -> bool ;
Coq < eqb_leibniz : forall x y, eqb x y = true -> x = y }.
This class implements a boolean equality test which is compatible with leibniz equality on some type. An example implementation is:
Coq < eqb : A -> A -> bool ;
Coq < eqb_leibniz : forall x y, eqb x y = true -> x = y }.
This class implements a boolean equality test which is compatible with leibniz equality on some type. An example implementation is:
Coq < eqb : A -> A -> bool ;
Coq < eqb_leibniz : forall x y, eqb x y = true -> x = y }.
This class implements a boolean equality test which is compatible with leibniz equality on some type. An example implementation is:
Coq < eqb : A -> A -> bool ;
Coq < eqb_leibniz : forall x y, eqb x y = true -> x = y }.
This class implements a boolean equality test which is compatible with leibniz equality on some type. An example implementation is:
Coq < eqb : A -> A -> bool ;
Coq < eqb_leibniz : forall x y, eqb x y = true -> x = y }.
This class implements a boolean equality test which is compatible with leibniz equality on some type. An example implementation is:
Coq < eqb : A -> A -> bool ;
Coq < eqb_leibniz : forall x y, eqb x y = true -> x = y }.
This class implements a boolean equality test which is compatible with leibniz equality on some type. An example implementation is:
Coq < eqb : A -> A -> bool ;
Coq < eqb_leibniz : forall x y, eqb x y = true -> x = y }.
This class implements a boolean equality test which is compatible with leibniz equality on some type. An example implementation is:
Coq < eqb : A -> A -> bool ;
Coq < eqb_leibniz : forall x y, eqb x y = true -> x = y }.
This class implements a boolean equality test which is compatible with leibniz equality on some type. An example implementation is:
Coq < eqb : A -> A -> bool ;
Coq < eqb_leibniz : forall x y, eqb x y = true -> x = y }.
This class implements a boolean equality test which is compatible with leibniz equality on some type. An example implementation is:
Coq < eqb : A -> A -> bool ;
Coq < eqb_leibniz : forall x y, eqb x y = true -> x = y }.
This class implements a boolean equality test which is compatible with leibniz equality on some type. An example implementation is:
Coq < eqb : A -> A -> bool ;
Coq < eqb_leibniz : forall x y, eqb x y = true -> x = y }.
This class implements a boolean equality test which is compatible with leibniz equality on some type. An example implementation is:
Coq < eqb : A -> A -> bool ;
Coq < eqb_leibniz : forall x y, eqb x y = true -> x = y }.
This class implements a boolean equality test which is compatible with leibniz equality on some type. An example implementation is:
Coq < eqb : A -> A -> bool ;
Coq < eqb_leibniz : forall x y, eqb x y = true -> x = y }.
This class implements a boolean equality test which is compatible with leibniz equality on some type. An example implementation is:
Coq < eqb : A -> A -> bool ;
Coq < eqb_leibniz : forall x y, eqb x y = true -> x = y }.
This class implements a boolean equality test which is compatible with leibniz equality on some type. An example implementation is:
Coq < eqb : A -> A -> bool ;
Coq < eqb_leibniz : forall x y, eqb x y = true -> x = y }.
This class implements a boolean equality test which is compatible with leibniz equality on some type. An example implementation is:
Coq < eqb : A -> A -> bool ;
Coq < eqb_leibniz : forall x y, eqb x y = true -> x = y }.
This class implements a boolean equality test which is compatible with leibniz equality on some type. An example implementation is:
Coq < eqb : A -> A -> bool ;
Coq < eqb_leibniz : forall x y, eqb x y = true -> x = y }.
This class implements a boolean equality test which is compatible with leibniz equality on some type. An example implementation is:
Coq < eqb : A -> A -> bool ;
Coq < eqb_leibniz : forall x y, eqb x y = true -> x = y }.
This class implements a boolean equality test which is compatible with leibniz equality on some type. An example implementation is:
Coq < eqb : A -> A -> bool ;
Coq < eqb_leibniz : forall x y, eqb x y = true -> x = y }.
This class implements a boolean equality test which is compatible with leibniz equality on some type. An example implementation is:
Coq < eqb : A -> A -> bool ;
Coq < eqb_leibniz : forall x y, eqb x y = true -> x = y }.
This class implements a boolean equality test which is compatible with leibniz equality on some type. An example implementation is:
Coq < eqb : A -> A -> bool ;
Coq < eqb_leibniz : forall x y, eqb x y = true -> x = y }.
This class implements a boolean equality test which is compatible with leibniz equality on some type. An example implementation is:
Coq < eqb : A -> A -> bool ;
Coq < eqb_leibniz : forall x y, eqb x y = true -> x = y }.
This class implements a boolean equality test which is compatible with leibniz equality on some type. An example implementation is:
Coq < eqb : A -> A -> bool ;
Coq < eqb_leibniz : forall x y, eqb x y = true -> x = y }.
This class implements a boolean equality test which is compatible with leibniz equality on some type. An example implementation is:
Coq < eqb : A -> A -> bool ;
Coq < eqb_leibniz : forall x y, eqb x y = true -> x = y }.
This class implements a boolean equality test which is compatible with leibniz equality on some type. An example implementation is:
Coq < eqb : A -> A -> bool ;
Coq < eqb_leibniz : forall x y, eqb x y = true -> x = y }.
This class implements a boolean equality test which is compatible with leibniz equality on some type. An example implementation is:
Coq < eqb : A -> A -> bool ;
Coq < eqb_leibniz : forall x y, eqb x y = true -> x = y }.
This class implements a boolean equality test which is compatible with leibniz equality on some type. An example implementation is:
Coq < eqb : A -> A -> bool ;
Coq < eqb_leibniz : forall x y, eqb x y = true -> x = y }.
This class implements a boolean equality test which is compatible with leibniz equality on some type. An example implementation is:
Coq < eqb : A -> A -> bool ;
Coq < eqb_leibniz : forall x y, eqb x y = true -> x = y }.
This class implements a boolean equality test which is compatible with leibniz equality on some type. An example implementation is:
Coq < eqb : A -> A -> bool ;
Coq < eqb_leibniz : forall x y, eqb x y = true -> x = y }.
This class implements a boolean equality test which is compatible with leibniz equality on some type. An example implementation is:
Coq < eqb : A -> A -> bool ;
Coq < eqb_leibniz : forall x y, eqb x y = true -> x = y }.
This class implements a boolean equality test which is compatible with leibniz equality on some type. An example implementation is:
Coq < eqb : A -> A -> bool ;
Coq < eqb_leibniz : forall x y, eqb x y = true -> x = y }.
This class implements a boolean equality test which is compatible with leibniz equality on some type. An example implementation is: