vix.ing · top · new · best · stats · spec

Proving Type Class Laws for Haskell

2018/08/17 by Andreas Arvidsson, Arvidsson, Andreas, Moa Johansson +3
Computer Science · #FOS: Computer and information sciences #Formal Methods in Verification #Logic, programming, and type systems #Programming Languages (cs.PL) #Security and Verification in Computing

paper · pdf · doi:10.48550/arxiv.1808.05789

openalex publication_date 2018/08/17 · openalex created_date 2025/10/10 · openalex updated_date 2026/07/28

Abstract

Type classes in Haskell are used to implement ad-hoc polymorphism, i.e. a way to ensure both to the programmer and the compiler that a set of functions are defined for a specific data type. All instances of such type classes are expected to behave in a certain way and satisfy laws associated with the respective class. These are however typically just stated in comments and as such, there is no real way to enforce that they hold. In this paper we describe a system which allows the user to write down type class laws which are then automatically instantiated and sent to an inductive theorem prover when declaring a new instance of a type class.

Related