skip to main content
10.1145/2976002.2976018acmconferencesArticle/Chapter ViewAbstractPublication PagesicfpConference Proceedingsconference-collections
research-article

Embedding session types in Haskell

Published:08 September 2016Publication History

ABSTRACT

We present a novel embedding of session-typed concurrency in Haskell. We extend an existing HOAS embedding of linear λ-calculus with a set of core session-typed primitives, using indexed type families to express the constraints of the session typing discipline. We give two interpretations of our embedding, one in terms of GHC’s built-in concurrency and another in terms of purely functional continuations. Our safety guarantees, including deadlock freedom, are assured statically and introduce no additional runtime overhead.

References

  1. R. Atkey, S. Lindley, and J. Yallop. Unembedding domain-specific languages. In S. Weirich, editor, Proceedings of the 2nd ACM SIGPLAN Symposium on Haskell, Haskell 2009, Edinburgh, Scotland, UK, 3 September 2009, pages 37–48. ACM, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. L. Caires and F. Pfenning. Session types as intuitionistic linear propositions. In P. Gastin and F. Laroussinie, editors, CONCUR 2010 - Concurrency Theory, 21th International Conference, CONCUR 2010, Paris, France, August 31-September 3, 2010. Proceedings, volume 6269 of Lecture Notes in Computer Science, pages 222–236. Springer, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. J. Carette, O. Kiselyov, and C. Shan. Finally tagless, partially evaluated: Tagless staged interpreters for simpler typed languages. J. Funct. Program., 19(5):509–543, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. O. Dardha, E. Giachino, and D. Sangiorgi. Session types revisited. In D. D. Schreye, G. Janssens, and A. King, editors, Principles and Practice of Declarative Programming, PPDP’12, Leuven, Belgium - September 19 - 21, 2012, pages 139–150. ACM, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. S. J. Gay and V. T. Vasconcelos. Linear type theory for asynchronous session types. J. Funct. Program., 20(1):19–50, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. K. Honda. Types for dyadic interaction. In E. Best, editor, CONCUR ’93, 4th International Conference on Concurrency Theory, Hildesheim, Germany, August 23-26, 1993, Proceedings, volume 715 of Lecture Notes in Computer Science, pages 509–523. Springer, 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. K. Honda, V. T. Vasconcelos, and M. Kubo. Language primitives and type discipline for structured communication-based programming. In C. Hankin, editor, Programming Languages and Systems - ESOP’98, 7th European Symposium on Programming, Held as Part of the European Joint Conferences on the Theory and Practice of Software, ETAPS’98, Lisbon, Portugal, March 28 - April 4, 1998, Proceedings, volume 1381 of Lecture Notes in Computer Science, pages 122–138. Springer, 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. K. Imai, S. Yuen, and K. Agusa. Session type inference in haskell. In K. Honda and A. Mycroft, editors, Proceedings Third Workshop on Programming Language Approaches to Concurrency and communication-cEntric Software, PLACES 2010, Paphos, Cyprus, 21st March 2010.Google ScholarGoogle Scholar
  9. , volume 69 of EPTCS, pages 74–91, 2010.Google ScholarGoogle Scholar
  10. T. B. L. Jespersen, P. Munksgaard, and K. F. Larsen. Session types for rust. In P. Bahr and S. Erdweg, editors, Proceedings of the 11th ACM SIGPLAN Workshop on Generic Programming, WGP@ICFP 2015, Vancouver, BC, Canada, August 30, 2015, pages 13–22. ACM, 2015. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. N. Kobayashi, B. C. Pierce, and D. N. Turner. Linearity and the picalculus. ACM Trans. Program. Lang. Syst., 21(5):914–947, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. S. Lindley and J. G. Morris. A semantics for propositions as sessions. In J. Vitek, editor, Programming Languages and Systems - 24th European Symposium on Programming, ESOP 2015, Held as Part of the European Joint Conferences on Theory and Practice of Software, ETAPS 2015, London, UK, April 11-18, 2015. Proceedings, volume 9032 of Lecture Notes in Computer Science, pages 560–584. Springer, 2015.Google ScholarGoogle Scholar
  13. S. Lindley and J. G. Morris. Talking bananas: Structural recursion for session types. In Proceedings of the 21st ACM SIGPLAN International Conference on Functional Programming, ICFP 2016, Nara, Japan, September 19-21, 2016. ACM, 2016. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. D. A. Orchard and N. Yoshida. Effects as sessions, sessions as effects. In R. Bod´ık and R. Majumdar, editors, Proceedings of the 43rd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2016, St. Petersburg, FL, USA, January 20 - 22, 2016, pages 568–581. ACM, 2016. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. L. Padovani. Fuse - a simple library implementation of binary sessions. http://www.di.unito.it/~padovani/Software/FuSe/ FuSe.html, 2016.Google ScholarGoogle Scholar
  16. J. Paykin and S. Zdancewic. Linear λµ is CP (more or less). In S. Lindley, C. McBride, P. W. Trinder, and D. Sannella, editors, A List of Successes That Can Change the World - Essays Dedicated to Philip Wadler on the Occasion of His 60th Birthday, volume 9600 of Lecture Notes in Computer Science, pages 273–291. Springer, 2016.Google ScholarGoogle Scholar
  17. F. Pfenning and D. Griffith. Polarized substructural session types. In A. M. Pitts, editor, Foundations of Software Science and Computation Structures - 18th International Conference, FoSSaCS 2015, Held as Part of the European Joint Conferences on Theory and Practice of Software, ETAPS 2015, London, UK, April 11-18, 2015. Proceedings, volume 9034 of Lecture Notes in Computer Science, pages 3–22. Springer, 2015.Google ScholarGoogle ScholarCross RefCross Ref
  18. J. Polakow. Embedding a full linear lambda calculus in Haskell. In B. Lippmeier, editor, Proceedings of the 8th ACM SIGPLAN Symposium on Haskell, Haskell 2015, Vancouver, BC, Canada, September 3-4, 2015, pages 177–188. ACM, 2015. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. R. Pucella and J. A. Tov. Haskell session types with (almost) no class. In A. Gill, editor, Proceedings of the 1st ACM SIGPLAN Symposium on Haskell, Haskell 2008, Victoria, BC, Canada, 25 September 2008, pages 25–36. ACM, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. A. Scalas and N. Yoshida. Lightweight session programming in scala. In S. Krishnamurthi and B. S. Lerner, editors, 30th European Conference on Object-Oriented Programming, ECOOP 2016, July 18- 22, 2016, Rome, Italy, volume 56 of LIPIcs, pages 21:1–21:28. Schloss Dagstuhl - Leibniz-Zentrum fuer Informatik, 2016.Google ScholarGoogle Scholar
  21. K. Takeuchi, K. Honda, and M. Kubo. An interaction-based language and its typing system. In C. Halatsis, D. G. Maritsas, G. Philokyprou, and S. Theodoridis, editors, PARLE ’94: Parallel Architectures and Languages Europe, 6th International PARLE Conference, Athens, Greece, July 4-8, 1994, Proceedings, volume 817 of Lecture Notes in Computer Science, pages 398–413. Springer, 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. J. Tov. The synchronous-channels package. https://hackage. haskell.org/package/synchronous-channels, 2015.Google ScholarGoogle Scholar
  23. V. T. Vasconcelos, S. J. Gay, and A. Ravara. Type checking a multithreaded functional language with session types. Theor. Comput. Sci., 368(1-2):64–87, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. P. Wadler. Propositions as sessions. J. Funct. Program., 24(2-3):384– 418, 2014.Google ScholarGoogle ScholarCross RefCross Ref

Index Terms

  1. Embedding session types in Haskell

        Recommendations

        Comments

        Login options

        Check if you have access through your login credentials or your institution to get full access on this article.

        Sign in
        • Published in

          cover image ACM Conferences
          Haskell 2016: Proceedings of the 9th International Symposium on Haskell
          September 2016
          192 pages
          ISBN:9781450344340
          DOI:10.1145/2976002

          Copyright © 2016 ACM

          Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than the author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected].

          Publisher

          Association for Computing Machinery

          New York, NY, United States

          Publication History

          • Published: 8 September 2016

          Permissions

          Request permissions about this article.

          Request Permissions

          Check for updates

          Qualifiers

          • research-article

          Acceptance Rates

          Overall Acceptance Rate57of143submissions,40%

          Upcoming Conference

          ICFP '24

        PDF Format

        View or Download as a PDF file.

        PDF

        eReader

        View online with eReader.

        eReader