ABSTRACT
Generative type abstractions -- present in Haskell, OCaml, and other languages -- are useful concepts to help prevent programmer errors. They serve to create new types that are distinct at compile time but share a run-time representation with some base type. We present a new mechanism that allows for zero-cost conversions between generative type abstractions and their representations, even when such types are deeply nested. We prove type safety in the presence of these conversions and have implemented our work in GHC.
References
- Joachim Breitner, Richard A. Eisenberg, Simon Peyton Jones, and Stephanie Weirich. Safe zero-cost coercions for Haskell (extended version), Tech. Report MS-CIS-14-07, University of Pennsylvania, 2014.Google Scholar
- James Cheney and Ralf Hinze. First-class phantom types, Tech. report, Cornell University, 2003.Google Scholar
- Manuel M. T. Chakravarty, Gabriele Keller, and Simon Peyton Jones. Associated type synonyms, ICFP, ACM, 2005, pp. 241--253. Google Scholar
Digital Library
- Manuel M. T. Chakravarty, Gabriele Keller, Simon Peyton Jones, and Simon Marlow. Associated types with class, POPL, ACM, 2005, pp. 1--13. Google Scholar
Digital Library
- Richard A. Eisenberg, Dimitrios Vytiniotis, Simon Peyton Jones, and Stephanie Weirich. Closed type families with overlapping equations, POPL, ACM, 2014, pp. 671--683. Google Scholar
Digital Library
- Jacques Garrigue. On variance, injectivity, and abstraction, OCaml Meeting, Boston., September 2013.Google Scholar
- Ralf Lämmel and Simon Peyton Jones. Scrap your boilerplate with class: Extensible generic functions, ICFP, 2005.Google Scholar
Digital Library
- Simon Marlow (editor). Haskell 2010 language report, 2010.Google Scholar
- Robin Milner, Mads Tofte, Robert Harper, and David MacQueen. The definition of Standard ML (revised), 1997. Google Scholar
Digital Library
- Simon Peyton Jones and J Launchbury. Unboxed values as first class citizens, FPCA, LNCS, vol. 523, 1991, pp. 636--666. Google Scholar
Digital Library
- Simon Peyton Jones, Andrew Tolmach, and Tony Hoare. Playing by the rules: rewriting as a practical optimisation technique in GHC, Haskell Workshop, 2001, pp. 203--233.Google Scholar
- Gabriel Scherer and Didier Rémy. GADTs meet subtyping, ESOP, 2013, pp. 554--573. Google Scholar
Digital Library
- Dimitrios Vytiniotis, Simon Peyton Jones, and José Pedro Magalhães. Equality proofs and deferred type errors: A compiler pearl, ICFP, ACM, 2012, pp. 341--352. Google Scholar
Digital Library
- Philip Wadler and Stephen Blott. How to make ad-hoc polymorphism less ad-hoc, POPL, ACM, 1989, pp. 60--76. Google Scholar
Digital Library
- Stephanie Weirich, Dimitrios Vytiniotis, Simon Peyton Jones, and Steve Zdancewic. Generative type abstraction and type-level computation, POPL, ACM, 2011, pp. 227--240. Google Scholar
Digital Library
- Brent A. Yorgey, Stephanie Weirich, Julien Cretin, Simon Peyton Jones, Dimitrios Vytiniotis, and José Pedro Magalhães. Giving Haskell a promotion, TLDI, ACM, 2012, pp. 53--66. Google Scholar
Digital Library
Index Terms
Safe zero-cost coercions for Haskell






Comments