Structural Subtyping as Parametric Polymorphism

04/17/2023
by   Wenhao Tang, et al.
0

Structural subtyping and parametric polymorphism provide a similar kind of flexibility and reusability to programmers. For example, both enable the programmer to supply a wider record as an argument to a function that expects a narrower one. However, the means by which they do so differs substantially, and the precise details of the relationship between them exists, at best, as folklore in literature. In this paper, we systematically study the relative expressive power of structural subtyping and parametric polymorphism. We focus our investigation on establishing the extent to which parametric polymorphism, in the form of row and presence polymorphism, can encode structural subtyping for variant and record types. We base our study on various Church-style λ-calculi extended with records and variants, different forms of structural subtyping, and row and presence polymorphism. We characterise expressiveness by exhibiting compositional translations between calculi. For each translation we prove a type preservation and operational correspondence result. We also prove a number of non-existence results. By imposing restrictions on both source and target types, we reveal further subtleties in the expressiveness landscape, the restrictions enabling otherwise impossible translations to be defined.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
07/25/2023

Parametric Subtyping for Structural Parametric Polymorphism

We study the interaction of structural subtyping with parametric polymor...
research
08/13/2021

An ML-style record calculus with extensible records

In this work, we develop a polymorphic record calculus with extensible r...
research
07/17/2023

Generic Programming with Extensible Data Types; Or, Making Ad Hoc Extensible Data Types Less Ad Hoc

We present a novel approach to generic programming over extensible data ...
research
07/25/2017

An Executable Specification of Typing Rules for Extensible Records based on Row Polymorphism

Type inference is an application domain that is a natural fit for logic ...
research
04/27/2020

Parametric unfolding. Method and restrictions

Parametric unfolding of a true distribution distorted due to finite reso...
research
06/14/2022

A new algorithm for structural restrictions in Bayesian vector autoregressions

A comprehensive methodology for inference in vector autoregressions (VAR...
research
01/26/2022

Polarized Subtyping

Polarization of types in call-by-push-value naturally leads to the separ...

Please sign up or login with your details

Forgot password? Click here to reset