Coherent Explicit Dictionary Application for Haskell: Formalisation and Coherence Proof

07/30/2018
by   Thomas Winant, et al.
0

Type classes are one of Haskell's most popular features and extend its type system with ad-hoc polymorphism. Since their conception, there were useful features that could not be offered because of the desire to offer two correctness properties: coherence and global uniqueness of instances. Coherence essentially guarantees that program semantics are independent from type-checker internals. Global uniqueness of instances is relied upon by libraries for enforcing, for example, that a single order relation is used for all manipulations of an ordered binary tree. The features that could not be offered include explicit dictionary application and local instances, which would be highly useful in practice. We propose a new design for offering explicit dictionary application, without compromising coherence and global uniqueness. We introduce a novel criterion based on GHC's type argument roles to decide when a dictionary application is safe with respect to global uniqueness of instances. We preserve coherence by detecting potential sources of incoherence, and prove it formally. Moreover, our solution makes it possible to use local dictionaries. In addition to developing our ideas formally, we have implemented a working prototype in GHC. This report contains the full formalisation and coherence proof.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
05/28/2012

Learning Dictionaries with Bounded Self-Coherence

Sparse coding in learned dictionaries has been established as a successf...
research
07/01/2019

Coherence of Type Class Resolution

Elaboration-based type class resolution, as found in languages like Hask...
research
03/11/2021

Improved Coherence Index-Based Bound in Compressive Sensing

Within the Compressive Sensing (CS) paradigm, sparse signals can be reco...
research
08/18/2022

On the Assmus–Mattson type theorem for Type I and even formally self-dual codes

In the present paper, we give the Assmus–Mattson type theorem for near-e...
research
10/03/2022

Uniqueness of logical connectives in a bilateralist setting

In this paper I will show the problems that are encountered when dealing...
research
09/18/2022

A Type-Directed, Dictionary-Passing Translation of Featherweight Generic Go

Featherweight Generic Go (FGG) is a minimal core calculus modeling the e...
research
04/15/2019

Coherent Interaction Graphs

We introduce the notion of coherent graphs, and show how those can be us...

Please sign up or login with your details

Forgot password? Click here to reset