DeepAI AI Chat
Log In Sign Up

Proving Type Class Laws for Haskell

08/17/2018
by   Andreas Arvidsson, et al.
Chalmers University of Technology
0

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.

READ FULL TEXT

page 1

page 2

page 3

page 4

07/01/2020

Equational Reasoning for MTL Type Classes

Ability to use definitions occurring in the code directly in equational ...
03/16/2023

Full Abstraction for Free

Structured recursion schemes such as folds and unfolds have been widely ...
07/24/2019

Learning abstract perceptual notions: the example of space

Humans are extremely swift learners. We are able to grasp highly abstrac...
05/08/2019

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...
06/28/2019

Bidirectional Type Class Instances (Extended Version)

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

Optimizing Polymatroid Functions

We consider a class of optimization problems that involve determining th...
04/07/2020

A categorical approach to secure compilation

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