DeepAI AI Chat
Log In Sign Up

Proving Type Class Laws for Haskell

by   Andreas Arvidsson, et al.
Chalmers University of Technology

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.


page 1

page 2

page 3

page 4


Equational Reasoning for MTL Type Classes

Ability to use definitions occurring in the code directly in equational ...

Full Abstraction for Free

Structured recursion schemes such as folds and unfolds have been widely ...

Learning abstract perceptual notions: the example of space

Humans are extremely swift learners. We are able to grasp highly abstrac...

Asymptotic laws for upper and strong record values in the extreme domain of attraction and beyond

Asymptotic laws of records values have usually been investigated as limi...

Bidirectional Type Class Instances (Extended Version)

GADTs were introduced in Haskell's eco-system more than a decade ago, bu...

Optimizing Polymatroid Functions

We consider a class of optimization problems that involve determining th...

A categorical approach to secure compilation

We introduce a novel approach to secure compilation based on maps of dis...