# GADTs meet subtyping

@inproceedings{Scherer2013GADTsMS, title={GADTs meet subtyping}, author={Gabriel Scherer and Didier R{\'e}my}, booktitle={ESOP}, year={2013} }

While generalized algebraic datatypes (GADTs) are now considered well-understood, adding them to a language with a notion of subtyping comes with a few surprises. [...] Key Method We allow variance annotations in GADT definitions, study their soundness, and present a sound and complete algorithm to check them. Our work may be applied to real-world ML-like languages with explicit subtyping such as OCaml, or to languages with general subtyping constraints. Expand

## 9 Citations

Towards improved GADT reasoning in Scala

- Computer ScienceSCALA@ECOOP
- 2019

This work informally explore foundations for GADTs within Scala's core type system, to guide a principled understanding and implementation of GadTs in Scala.

Formal foundations for GADTs in Scala

- 2020

GADTs are a very useful language feature that allow encoding some invariants in types. GADT reasoning is currently implemented in Scala and Dotty, but it’s plagued with soundness issues. To get a…

Unboxing Mutually Recursive Type Definitions in OCaml

- Computer ScienceArXiv
- 2018

The notion of separability as a semantic for the unboxing criterion is explained, and a set of inference rules to check separability is proposed, from which a new implementation of the unboxes check that properly supports mutually-recursive definitions is derived.

Safe zero-cost coercions for Haskell

- Computer ScienceICFP 2014
- 2014

A new mechanism is presented that allows for zero-cost conversions between generative type abstractions and their representations, even when such types are deeply nested and type safety in the presence of these conversions is proved.

Safe zero-cost coercions for Haskell

- Computer ScienceJournal of Functional Programming
- 2016

This work presents a new mechanism that allows for zero-cost conversions between generative type abstractions and their representations, even when such types are deeply nested, and proves type safety in the presence of these conversions.

First-Class Subtypes

- Computer Science, BiologyML/OCaml
- 2017

This work presents several encodings of first-class subtypes using existing features of the OCaml language, and shows that any such encodations are interconvertible, and illustrates the utility of the encodments with several examples.

Terms of use : Click here Safe zero-cost coercions for Haskell

- 2016

Generative type abstractions – present in Haskell, OCaml, and other languages – are useful concepts to help prevent programmer errors. They serve to create new types that are distinct at compile time…

Safe Zero-cost Coercions for Haskell (extended version)

- Computer Science
- 2014

A new mechanism is presented that allows for zero-cost conversions between generative type abstractions and a run-time representation of that type.

Implementing path-dependent GADT reasoning for Scala 3

- Computer ScienceSCALA@SPLASH
- 2021

This paper shows how the existing constraint-based GADT reasoning of the Scala 3 compiler is extended to also consider path-dependent types, making Scala’s support for G ADT programming more complete and bringing Scala closer to its formal foundations.

## References

SHOWING 1-10 OF 30 REFERENCES

Polarized Subtyping for Sized Types

- Mathematics, Computer ScienceCSR
- 2006

An algorithm for deciding polarized higher-order subtyping without bounded quantification is presented and a direct proof of completeness is given, without constructing a model or establishing a strong normalization theorem.

Variance and Generalized Constraints for C# Generics

- Mathematics, Computer ScienceECOOP
- 2006

A system of type-safe variance for C that supports the declaration of covariant and contravariant type parameters on generic types and formalizes the subtype relation in both declarative and syntax-directed style.

A constraint-based approach to guarded algebraic data types

- Computer ScienceTOPL
- 2007

It is proved that HMG(X) is sound and that, provided recursive definitions carry a type annotation, type inference can be reduced to constraint solving.

Relaxing the Value Restriction

- Computer ScienceAPLAS
- 2002

This work uses a subtyping based approach to recover part of this lost polymorphism, without changing the type algebra itself, and this has significant applications.

Generalized algebraic data types and object-oriented programming

- Computer ScienceOOPSLA '05
- 2005

This work proposes a generalization of the type constraint mechanisms of C# and Java to both avoid the need for casts in GADT programs and higher-order contortions in PADTs programs, and presents a Visitor pattern for GADTs, and describes a refined switch construct as an alternative to virtual dispatch on datatypes.

Intensionality, extensionality, and proof irrelevance in modal type theory

- Mathematics, Computer ScienceProceedings 16th Annual IEEE Symposium on Logic in Computer Science
- 2001

A uniform type theory that integrates intensionality, extensionality and proof irrelevance as judgmental concepts is developed that contrasts with previous approaches that, a priori, distinguished propositions from specifications.

Mathematical Structures in Computer Science

- Computer Science
- 2012

Computability, despite having exact access to its own discrete data type, provides a unique tool for the investigation of ‘unpredictability’ in both Physics and Biology through its fine-grained analysis of undecidability.

Gallium – INRIA) GADTs meet Subtyping

- Gallium – INRIA) GADTs meet Subtyping
- 2014

GADTs meet subtyping. Long version, available electronically. URL: http://gallium.inria.fr/ ~ remy/gadts

- GADTs meet subtyping. Long version, available electronically. URL: http://gallium.inria.fr/ ~ remy/gadts
- 2013

Gallium) GADTs meet Subtyping

- Gallium) GADTs meet Subtyping
- 2013