Skip to main content Accessibility help
×
×
Home

Safe zero-cost coercions for Haskell

  • JOACHIM BREITNER (a1), RICHARD A. EISENBERG (a2), SIMON PEYTON JONES (a3) and STEPHANIE WEIRICH (a4)
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.

Copyright
References
Hide All
Breitner, J., Eisenberg, R. A., Peyton Jones, S. & Weirich, S. (2014a) Safe zero-cost coercions for Haskell. In ICFP. New York, USA: ACM, pp. 189202.
Breitner, J., Eisenberg, R. A., Peyton Jones, S. & Weirich, S. (2014b) Safe Zero-Cost Coercions for Haskell (Extended Version). Technical Report, MS-CIS-14-07. University of Pennsylvania.
Chakravarty, M. M. T., Keller, G. & Peyton Jones, S. (2005a) Associated type synonyms. In ICFP. New York, USA: ACM, pp. 241253.
Chakravarty, M. M. T., Keller, G., Peyton Jones, S. & Marlow, S. (2005b) Associated types with class. In POPL. New York, USA: ACM, pp. 113.
Cheney, J. & Hinze, R. (2003) First-Class Phantom Types. Technical Report, Cornell University.
Crary, K. (2000) Typed compilation of inclusive subtyping. In ICFP. New York: ACM, pp. 6881.
Cretin, J.. & Rémy, D. (2012) On the power of coercion abstraction. In POPL. New York: ACM, pp. 361372.
Eisenberg, R. A., Vytiniotis, D., Peyton Jones, S. & Weirich, S. (2014) Closed type families with overlapping equations. In POPL. New York: ACM, pp. 671683.
Garrigue, J. (2013) On Variance, Injectivity, and Abstraction. Boston: OCaml Meeting.
Hall, C. V., Hammond, K., Peyton Jones, S. L. & Wadler, P. L. (1996) Type classes in Haskell. ACM Trans. Program. Lang. Syst. 18 (2), 109138.
Hinze, R. & Peyton Jones, S. (2000) Derivable type classes. Haskell Workshop. ENTS, 41 (1), 535, doi:10.1016/S1571-0661(05)80542-0.
Marlow, S. (ed) (2010) Haskell 2010 Language Report.
Milner, R., Tofte, M., Harper, R. & MacQueen, D. (1997) The Definition of Standard ML (revised) ISBN 9780262631815, MIT Press, Cambridge, MA, USA.
Peyton Jones, S., Tolmach, A. & Hoare, T. (2001) Playing by the rules: Rewriting as a practical optimisation technique in GHC. Haskell Workshop. New York: ACM, pp. 203233.
Pottier, F. & Rémy, D. (2005) The essence of ML type inference. In Chap. 10 of: Advanced Topics in Types and Programming Languages, Pierce, B. C. (ed), MIT Press, pp. 389489.
Rémy, D. & Yakobowski, B. (2010) A Church-style intermediate language for MLF. In Functional and Logic Programming, Blume, M., Kobayashi, N. & Vidal, G. (eds), LNCS, vol. 6009. Springer, pp. 2439.
Rodriguez, A., Jeuring, J., Jansson, P., Gerdes, A., Kiselyov, O. & Oliveira, B. C. D. S. (2008) Comparing libraries for generic programming in Haskell. In Haskell Symposium. ACM.
Scherer, G. & Rémy, D. (2013) GADTs meet subtyping. In ESOP, LNCS, vol. 7792. Springer.
Sewell, P., Zappa Nardelli, F., Owens, S., Peskine, G., Ridge, T., Sarkar, S. & Strniša, R. (2010) Ott: Effective tool support for the working semanticist. J. Funct. Program. 20 (1), 71122.
Sheard, T. & Peyton Jones, S. (2002) Template meta-programming for Haskell. In Haskell Workshop. New York: ACM, pp. 6075.
Sulzmann, M., Chakravarty, M. M. T., Peyton Jones, S. & Donnelly, K. (2007) System F with type equality coercions. In TLDI. New York: ACM, pp. 5366.
Terei, D., Marlow, S., Peyton Jones, S. & Mazières, D. (2012) Safe Haskell. Haskell Symposium. ACM.
Vytiniotis, D., Peyton Jones, S., Schrijvers, T. & Sulzmann, M. (2011) OutsideIn(X) modular type inference with local assumptions. J. Funct. Program. 21 (4–5), 333412.
Weirich, S., Vytiniotis, D., Peyton Jones, S. & Zdancewic, S. (2011) Generative type abstraction and type-level computation. In POPL. New York: ACM, pp. 227240.
Yorgey, B. A., Weirich, S., Cretin, J., Peyton Jones, S., Vytiniotis, D. & Magalhães, J. P. (2012) Giving Haskell a promotion. In TLDI. New York: ACM, pp. 5366.
Recommend this journal

Email your librarian or administrator to recommend adding this journal to your organisation's collection.

Journal of Functional Programming
  • ISSN: 0956-7968
  • EISSN: 1469-7653
  • URL: /core/journals/journal-of-functional-programming
Please enter your name
Please enter a valid email address
Who would you like to send this to? *
×

Metrics

Full text views

Total number of HTML views: 0
Total number of PDF views: 0 *
Loading metrics...

Abstract views

Total abstract views: 0 *
Loading metrics...

* Views captured on Cambridge Core between <date>. This data will be updated every 24 hours.

Usage data cannot currently be displayed

Safe zero-cost coercions for Haskell

  • JOACHIM BREITNER (a1), RICHARD A. EISENBERG (a2), SIMON PEYTON JONES (a3) and STEPHANIE WEIRICH (a4)
Submit a response

Discussions

No Discussions have been published for this article.

×

Reply to: Submit a response


Your details


Conflicting interests

Do you have any conflicting interests? *