Hostname: page-component-6766d58669-kn6lq Total loading time: 0 Render date: 2026-05-20T20:43:22.680Z Has data issue: false hasContentIssue false

Ghostbuster: A tool for simplifying and converting GADTs

Published online by Cambridge University Press:  22 June 2018

TIMOTHY A. K. ZAKIAN
Affiliation:
University of Oxford, Department of Computer Science, Oxford, UK (e-mail: timothy.zakian@cs.ox.ac.uk)
TREVOR L. MCDONELL
Affiliation:
University of New South Wales, School of Computer Science and Engineering, Sydney, AUS (e-mail: tmcdonell@cse.unsw.edu.au)
MATTEO CIMINI
Affiliation:
University of Massachusetts Lowell, Department of Computer Science, Lowell, MA, USA (e-mail: matteo_cimini@uml.edu)
RYAN R. NEWTON
Affiliation:
Indiana University, School of Informatics, Computing, and Engineering, Bloomington, IN, USA (e-mail: rrnewton@indiana.edu)
Rights & Permissions [Opens in a new window]

Abstract

Core share and HTML view are not available for this content. However, as you have access to this content, a full PDF is available via the 'Save PDF' action button.

Generalized Algebraic Data Types, or simply GADTs, can encode non-trivial properties in the types of the constructors. Once such properties are encoded in a datatype, however, all code manipulating that datatype must provide proof that it maintains these properties in order to typecheck. In this paper, we take a step toward gradualizing these obligations. We introduce a tool, Ghostbuster, that produces simplified versions of GADTs which elide selected type parameters, thereby weakening the guarantees of the simplified datatype in exchange for reducing the obligations necessary to manipulate it. Like ornaments, these simplified datatypes preserve the recursive structure of the original, but unlike ornaments, we focus on information-preserving bidirectional transformations. Ghostbuster generates type-safe conversion functions between the original and simplified datatypes, which we prove are the identity function when composed. We evaluate a prototype tool for Haskell against thousands of GADTs found on the Hackage package database, generating simpler Haskell'98 datatypes and round-trip conversion functions between the two.

Information

Type
Research Article
Copyright
Copyright © Cambridge University Press 2018 
Submit a response

Discussions

No Discussions have been published for this article.