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.
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- S. J. Gay and V. T. Vasconcelos. Linear type theory for asynchronous session types. J. Funct. Program., 20(1):19–50, 2010. Google ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 Scholar
- , volume 69 of EPTCS, pages 74–91, 2010.Google Scholar
- 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 ScholarDigital Library
- N. Kobayashi, B. C. Pierce, and D. N. Turner. Linearity and the picalculus. ACM Trans. Program. Lang. Syst., 21(5):914–947, 1999. Google ScholarDigital Library
- 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 Scholar
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- L. Padovani. Fuse - a simple library implementation of binary sessions. http://www.di.unito.it/~padovani/Software/FuSe/ FuSe.html, 2016.Google Scholar
- 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 Scholar
- 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 ScholarCross Ref
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 Scholar
- 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 ScholarDigital Library
- J. Tov. The synchronous-channels package. https://hackage. haskell.org/package/synchronous-channels, 2015.Google Scholar
- 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 ScholarDigital Library
- P. Wadler. Propositions as sessions. J. Funct. Program., 24(2-3):384– 418, 2014.Google ScholarCross Ref
Index Terms
- Embedding session types in Haskell
Recommendations
Label-dependent session types
Session types have emerged as a typing discipline for communication protocols. Existing calculi with session types come equipped with many different primitives that combine communication with the introduction or elimination of the transmitted value.
...
Haskell session types with (almost) no class
Haskell '08: Proceedings of the first ACM SIGPLAN symposium on HaskellWe describe an implementation of session types in Haskell. Session types statically enforce that client-server communication proceeds according to protocols. They have been added to several concurrent calculi, but few implementations of session types ...
Embedding session types in Haskell
Haskell '16We 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 ...
Comments