Refinement Kinds: Type-safe Programming with Practical Type-level Computation (Extended Version)

08/01/2019
by   Luís Caires, et al.
0

This work introduces the novel concept of kind refinement, which we develop in the context of an explicitly polymorphic ML-like language with type-level computation. Just as type refinements embed rich specifications by means of comprehension principles expressed by predicates over values in the type domain, kind refinements provide rich kind specifications by means of predicates over types in the kind domain. By leveraging our powerful refinement kind discipline, types in our language are not just used to statically classify program expressions and values, but also conveniently manipulated as tree-like data structures, with their kinds refined by logical constraints on such structures. Remarkably, the resulting typing and kinding disciplines allow for powerful forms of type reflection, ad-hoc polymorphism and type meta-programming, which are often found in modern software development, but not typically expressible in a type-safe manner in general purpose languages. We validate our approach both formally and pragmatically by establishing the standard meta-theoretical results of type safety and via a prototype implementation of a kind checker, type checker and interpreter for our language.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
10/15/2020

Refinement Types: A Tutorial

Refinement types enrich a language's type system with logical predicates...
research
04/13/2023

Kind Inference for the FreeST Programming Language

We present a kind inference algorithm for the FREEST programming languag...
research
11/12/2019

Kind Inference for Datatypes: Technical Supplement

In recent years, languages like Haskell have seen a dramatic surge of ne...
research
07/05/2021

A Theory of Higher-Order Subtyping with Type Intervals (Extended Version)

The calculus of Dependent Object Types (DOT) has enabled a more principl...
research
07/12/2022

Mechanizing Refinement Types (extended)

Practical checkers based on refinement types use the combination of impl...
research
08/30/2017

Type Safe Redis Queries: A Case Study of Type-Level Programming in Haskell

Redis is an in-memory data structure store, often used as a database, wi...
research
08/04/2020

Intensional Datatype Refinement

The pattern-match safety problem is to verify that a given functional pr...

Please sign up or login with your details

Forgot password? Click here to reset