Document Type
Article
Publication Title
ACM SIGPLAN Notices
Version
Author's Final Manuscript
Volume
49
Publication Date
12-2014
Abstract
Haskell, as implemented in the Glasgow Haskell Compiler (GHC), is enriched with many extensions that support type-level programming, such as promoted datatypes, kind polymorphism, and type families. Yet, the expressiveness of the type-level language remains limited. It is missing many features present at the term level, including case expressions, anonymous functions, partially-applied functions, and letexpressions. In this paper, we present an algorithm - with a proof of correctness - to encode these term-level constructs at the type level. Our approach is automated and capable of promoting a wide array of functions to type families. We also highlight and discuss those term-level features that are not promotable. In so doing, we offer a critique on GHC's existing type system, showing what it is already capable of and where it may want improvement.
We believe that delineating the mismatch between GHC's term level and its type level is a key step toward supporting dependently typed programming.
Publisher's Statement
© ACM, 2014. This is the author's version of the work. It is posted here by permission of ACM for your personal use. Not for redistribution. The definitive version was published in ACM SIGPLAN Notices, 49, 12, (2014) http://doi.acm.org/10.1145/2775050.2633361
DOI
http://doi.acm.org/10.1145/2775050.2633361
Citation
Richard A. Eisenberg "Promoting Functions to Type Families," ACM SIGPLAN Notices - Haskell '14 49.12 (December 2014): 95-106.