Hostname: page-component-8448b6f56d-mp689 Total loading time: 0 Render date: 2024-04-15T17:07:31.503Z Has data issue: false hasContentIssue false

Safe zero-cost coercions for Haskell

Published online by Cambridge University Press:  28 July 2016

JOACHIM BREITNER
Affiliation:
Karlsruhe Institute of Technology, Karlsruhe, Germany (e-mail: breitner@kit.edu)
RICHARD A. EISENBERG
Affiliation:
University of Pennsylvania, Philadelphia, Pennsylvania, USA (e-mail: eir@cis.upenn.edu)
SIMON PEYTON JONES
Affiliation:
Microsoft Research, Cambridge, United Kingdom (e-mail: simonpj@microsoft.com)
STEPHANIE WEIRICH
Affiliation:
University of Pennsylvania, Philadelphia, Pennsylvania, USA (e-mail: sweirich@cis.upenn.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.

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.

Type
Articles
Copyright
Copyright © Cambridge University Press 2016 

References

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.Google Scholar
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.Google Scholar
Chakravarty, M. M. T., Keller, G. & Peyton Jones, S. (2005a) Associated type synonyms. In ICFP. New York, USA: ACM, pp. 241253.Google Scholar
Chakravarty, M. M. T., Keller, G., Peyton Jones, S. & Marlow, S. (2005b) Associated types with class. In POPL. New York, USA: ACM, pp. 113.Google Scholar
Cheney, J. & Hinze, R. (2003) First-Class Phantom Types. Technical Report, Cornell University.Google Scholar
Crary, K. (2000) Typed compilation of inclusive subtyping. In ICFP. New York: ACM, pp. 6881.CrossRefGoogle Scholar
Cretin, J.. & Rémy, D. (2012) On the power of coercion abstraction. In POPL. New York: ACM, pp. 361372.Google Scholar
Eisenberg, R. A., Vytiniotis, D., Peyton Jones, S. & Weirich, S. (2014) Closed type families with overlapping equations. In POPL. New York: ACM, pp. 671683.Google Scholar
Garrigue, J. (2013) On Variance, Injectivity, and Abstraction. Boston: OCaml Meeting.Google Scholar
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.CrossRefGoogle Scholar
Hinze, R. & Peyton Jones, S. (2000) Derivable type classes. Haskell Workshop. ENTS, 41 (1), 535, doi:10.1016/S1571-0661(05)80542-0.Google Scholar
Marlow, S. (ed) (2010) Haskell 2010 Language Report.Google Scholar
Milner, R., Tofte, M., Harper, R. & MacQueen, D. (1997) The Definition of Standard ML (revised) ISBN 9780262631815, MIT Press, Cambridge, MA, USA.CrossRefGoogle Scholar
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.Google Scholar
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.Google Scholar
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.CrossRefGoogle Scholar
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.Google Scholar
Scherer, G. & Rémy, D. (2013) GADTs meet subtyping. In ESOP, LNCS, vol. 7792. Springer.Google Scholar
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.CrossRefGoogle Scholar
Sheard, T. & Peyton Jones, S. (2002) Template meta-programming for Haskell. In Haskell Workshop. New York: ACM, pp. 6075.Google Scholar
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.CrossRefGoogle Scholar
Terei, D., Marlow, S., Peyton Jones, S. & Mazières, D. (2012) Safe Haskell. Haskell Symposium. ACM.Google Scholar
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.CrossRefGoogle Scholar
Weirich, S., Vytiniotis, D., Peyton Jones, S. & Zdancewic, S. (2011) Generative type abstraction and type-level computation. In POPL. New York: ACM, pp. 227240.Google Scholar
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.CrossRefGoogle Scholar
Submit a response

Discussions

No Discussions have been published for this article.