Classes of arbitrary kind

Publication date

2019-01-01

Authors

Serrano Mena, A.ISNI 0000000434518529
Cacciari Miraldo, V.ISNI 0000000506342834

Editors

Alferes, José Júlio
Johansson, Moa

Advisors

Supervisors

Document Type

Part of book
Open Access logo

License

taverne

Abstract

The type class system in the Haskell Programming language provides a useful abstraction for a wide range of types, such as those that support comparison, serialization, ordering, between others. This system can be extended by the programmer by providing custom instances to one’s custom types. Yet, this is often a monotonous task. Some notions, such as equality, are very regular regardless if it is being encoded for a ground type or a type constructor. In this paper we present a technique that unifies the treatment of ground types and type constructors whenever possible. This reduces code duplication and improves consistency. We discuss the encoding of several classes in this form, including the generic programming facility in GHC.

Keywords

Generic programming, Haskell, Type classes, Taverne, Theoretical Computer Science, General Computer Science

Citation

Serrano, A & Miraldo, V C 2019, Classes of arbitrary kind. in J J Alferes & M Johansson (eds), Practical Aspects of Declarative Languages : 21st International Symposium, PADL 2019, Proceedings. Lecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics), vol. 11372 LNCS, Springer, pp. 150-168, 21st International Symposium on Practical Aspects of Declarative Languages, PADL 2019, Lisbon, Portugal, 14/01/19. https://doi.org/10.1007/978-3-030-05998-9_10, conference