Generalized Algebraic Dataypes, 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 towards 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.
CITATION STYLE
McDonell, T. L., Zakian, T. A. K., Cimini, M., & Newton, R. R. (2016). Ghostbuster: A tool for simplifying and converting GADTs. ACM SIGPLAN Notices, 51(9), 338–350. https://doi.org/10.1145/2951913.2951914
Mendeley helps you to discover research relevant for your work.