Skip to main content Accessibility help
×
Home
Hostname: page-component-768ffcd9cc-727vs Total loading time: 0.228 Render date: 2022-12-05T17:33:32.637Z Has data issue: true Feature Flags: { "useRatesEcommerce": false } hasContentIssue true

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

HTML view is 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.Google 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.
You have Access
8
Cited by

Save article to Kindle

To save this article to your Kindle, first ensure coreplatform@cambridge.org is added to your Approved Personal Document E-mail List under your Personal Document Settings on the Manage Your Content and Devices page of your Amazon account. Then enter the ‘name’ part of your Kindle email address below. Find out more about saving to your Kindle.

Note you can select to save to either the @free.kindle.com or @kindle.com variations. ‘@free.kindle.com’ emails are free but can only be saved to your device when it is connected to wi-fi. ‘@kindle.com’ emails can be delivered even when you are not connected to wi-fi, but note that service fees apply.

Find out more about the Kindle Personal Document Service.

Safe zero-cost coercions for Haskell
Available formats
×

Save article to Dropbox

To save this article to your Dropbox account, please select one or more formats and confirm that you agree to abide by our usage policies. If this is the first time you used this feature, you will be asked to authorise Cambridge Core to connect with your Dropbox account. Find out more about saving content to Dropbox.

Safe zero-cost coercions for Haskell
Available formats
×

Save article to Google Drive

To save this article to your Google Drive account, please select one or more formats and confirm that you agree to abide by our usage policies. If this is the first time you used this feature, you will be asked to authorise Cambridge Core to connect with your Google Drive account. Find out more about saving content to Google Drive.

Safe zero-cost coercions for Haskell
Available formats
×
×

Reply to: Submit a response

Please enter your response.

Your details

Please enter a valid email address.

Conflicting interests

Do you have any conflicting interests? *