DeepAI AI Chat
Log In Sign Up

How Functorial Are (Deep) GADTs?

03/28/2022
by   Patricia Johann, et al.
0

It is well-known that GADTs do not admit standard map functions of the kind supported by ADTs and nested types. In addition, standard map functions are insufficient to distribute their data-changing argument functions over all of the structure present in elements of deep GADTs, even just deep ADTs or nested types. This paper develops an algorithm for detecting exactly which functions are mappable over data whose types are (deep) GADTs. The algorithm takes as input a term t whose type is an instance of a deep GADT D and a function f to be mapped over t. It detects a minimal possible shape of t as an element of D, and returns a minimal set of constraints f must satisfy to be mappable over t. The crux of the algorithm is its ability to separate t's essential structure as an element of D – i.e., the part of t that is essential for it to have the shape of an element of D – from its incidental structure as an element of D – i.e., the part of t that is simply data in the positions of this shape. The algorithm ensures that the constraints on f come only from t's essential structure. This work is part of an ongoing effort to define initial algebra semantics for GADTs that properly generalizes the usual semantics for ADTs and nested types as least fixpoints of higher-order endofunctors.

READ FULL TEXT

page 1

page 2

page 3

page 4

06/13/2018

Dependently Typed Folds for Nested Data Types

We present an approach to develop folds for nested data types using depe...
05/17/2021

(Deep) Induction Rules for GADTs

Deep data types are those that are defined in terms of other such data t...
07/02/2022

LibNDT: Towards a Formal Library on Spreadable Properties over Linked Nested Datatypes

Nested datatypes have been widely studied in the past 25 years, both the...
08/15/2018

An infinitary rewriting interpretation of coinductive types

We introduce an infinitary rewriting semantics for strictly positive nes...
02/15/2018

Models of Type Theory Based on Moore Paths

This paper introduces a new family of models of intensional Martin-Löf t...
03/28/2021

Subtyping on Nested Polymorphic Session Types

The importance of subtyping to enable a wider range of well-typed progra...
02/07/2018

Additive Decompositions in Primitive Extensions

This paper extends the classical Ostrogradsky-Hermite reduction for rati...