Abstract. Generic programming enables the programmer to define functions by induction on the structure of types. Defined once, such a generic function can be used to generate a specialized function for any user defined data type. Several ways to support generic programming in functional languages have been proposed. The approach with kind-indexed types makes it possible to define generic functions indexed by types of different kinds. Another approach allows to define default implementation for instances of type classes in a generic way. In this paper we describe a combination of these two approaches, which has advantages of both of them. The key idea of our approach is that a generic function generates a kind-indexed system of type classes, one class per kind. The class variable of such a class ranges over types of the corresponding kind. For instance, an overloaded equality operator can be defined as a specific case of a generic equality function for kind . Additionally, we pr...
Artem Alimarine, Marinus J. Plasmeijer