24 research outputs found
System FC with Explicit Kind Equality
System FC, the core language of the Glasgow Haskell Compiler, is an explicitly-typed variant of System F with first-class type equality proofs called coercions. This extensible proof system forms the foundation for type system extensions such as type families (type- level functions) and Generalized Algebraic Datatypes (GADTs). Such features, in conjunction with kind polymorphism and datatype promotion, support expressive compile-time reasoning.
However, the core language lacks explicit kind equality proofs. As a result, type-level computation does not have access to kind- level functions or promoted GADTs, the type-level analogues to expression-level features that have been so useful. In this paper, we eliminate such discrepancies by introducing kind equalities to System FC. Our approach is based on dependent type systems with heterogeneous equality and the “Type-in-Type” axiom, yet it preserves the metatheoretic properties of FC. In particular, type checking is simple, decidable and syntax directed. We prove the preservation and progress theorems for the extended language
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
types. Row types capture the structure of records and variants, and can be used
to express record and variant subtyping, record extension, and modular
composition of case branches. We extend row typing to capture generic
programming over rows themselves, capturing patterns including lifting
operations to records and variations from their component types, and the
duality between cases blocks over variants and records of labeled functions,
without placing specific requirements on the fields or constructors present in
the records and variants. We formalize our approach in System R{\omega}, an
extension of F{\omega} with row types, and give a denotational semantics for
(stratified) R{\omega} in Agda.Comment: To appear at: International Conference on Functional Programming 2023
Corrected citations from previous versio
Recommended from our members
Lambda: The Ultimate Sublanguage (experience report)
We describe our experience teaching an advanced typed functional programming course based around the use of System Fω as a programming language.</jats:p
A completely unique account of enumeration
How can we enumerate the inhabitants of an algebraic datatype? This paper explores a datatype generic solution that works for all regular types and indexed families. The enumerators presented here are provably both complete and unique—they will eventually produce every value exactly once—and fair—they avoid bias when composing enumerators. Finally, these enumerators memoise previously enumerated values whenever possible, thereby avoiding repeatedly recomputing recursive results
System FC with Explicit Kind Equality (extended version)
System FC, the core language of the Glasgow Haskell Compiler, is an explicitly-typed variant of System F with first-class type equality proofs called coercions. This extensible proof system forms the foundation for type system extensions such as type families (type- level functions) and Generalized Algebraic Datatypes (GADTs). Such features, in conjunction with kind polymorphism and datatype promotion, support expressive compile-time reasoning.
However, the core language lacks explicit kind equality proofs. As a result, type-level computation does not have access to kind- level functions or promoted GADTs, the type-level analogues to expression-level features that have been so useful. In this paper, we eliminate such discrepancies by introducing kind equalities to System FC. Our approach is based on dependent type systems with heterogeneous equality and the “Type-in-Type” axiom, yet it preserves the metatheoretic properties of FC. In particular, type checking is simple, decidable and syntax directed. We prove the preservation and progress theorems for the extended language
A type- and scope-safe universe of syntaxes with binding: their semantics and proofs
Almost every programming language's syntax includes a notion of binder and corresponding bound occurrences, along with the accompanying notions of alpha-equivalence, capture-avoiding substitution, typing contexts, runtime environments, and so on. In the past, implementing and reasoning about programming languages required careful handling to maintain the correct behaviour of bound variables. Modern programming languages include features that enable constraints like scope safety to be expressed in types. Nevertheless, the programmer is still forced to write the same boilerplate over again for each new implementation of a scope safe operation (e.g., renaming, substitution, desugaring, printing, etc.), and then again for correctness proofs. We present an expressive universe of syntaxes with binding and demonstrate how to (1) implement scope safe traversals once and for all by generic programming; and (2) how to derive properties of these traversals by generic proving. Our universe description, generic traversals and proofs, and our examples have all been formalised in Agda and are available in the accompanying material available online at https://github.com/gallais/generic-syntax
Rast: A Language for Resource-Aware Session Types
Traditional session types prescribe bidirectional communication protocols for
concurrent computations, where well-typed programs are guaranteed to adhere to
the protocols. However, simple session types cannot capture properties beyond
the basic type of the exchanged messages. In response, recent work has extended
session types with refinements from linear arithmetic, capturing intrinsic
attributes of processes and data. These refinements then play a central role in
describing sequential and parallel complexity bounds on session-typed programs.
The Rast language provides an open-source implementation of session-typed
concurrent programs extended with arithmetic refinements as well as ergometric
and temporal types to capture work and span of program execution. To further
support generic programming, Rast also enhances arithmetically refined session
types with recently developed nested parametric polymorphism. Type checking
relies on Cooper's algorithm for quantifier elimination in Presburger
arithmetic with a few significant optimizations, and a heuristic extension to
nonlinear constraints. Rast furthermore includes a reconstruction engine so
that most program constructs pertaining the layers of refinements and resources
are inserted automatically. We provide a variety of examples to demonstrate the
expressivity of the language
Seamless, correct, and generic programming over serialised data
In typed functional languages, one can typically only manipulate data in a type-safe manner if it first has been deserialised into an in-memory tree represented as a graph of nodes-as-structs and subterms-as-pointers. We demonstrate how we can use QTT as implemented in \idris{} to define a small universe of serialised datatypes, and provide generic programs allowing users to process values stored contiguously in buffers. Our approach allows implementors to prove the full functional correctness by construction of the IO functions processing the data stored in the buffer