skip to main content
article

Effects as sessions, sessions as effects

Published:11 January 2016Publication History
Skip Abstract Section

Abstract

Effect and session type systems are two expressive behavioural type systems. The former is usually developed in the context of the lambda-calculus and its variants, the latter for the pi-calculus. In this paper we explore their relative expressive power. Firstly, we give an embedding from PCF, augmented with a parameterised effect system, into a session-typed pi-calculus (session calculus), showing that session types are powerful enough to express effects. Secondly, we give a reverse embedding, from the session calculus back into PCF, by instantiating PCF with concurrency primitives and its effect system with a session-like effect algebra; effect systems are powerful enough to express sessions. The embedding of session types into an effect system is leveraged to give a new implementation of session types in Haskell, via an effect system encoding. The correctness of this implementation follows from the second embedding result. We also discuss various extensions to our embeddings.

References

  1. Samson Abramsky, Radha Jagadeesan, and Pasquale Malacaria. Full abstraction for PCF. TCS, 163:409–470, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Robert Atkey. Parameterised notions of computation. Journal of Functional Programming, 19(3-4):335–376, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Andrej Bauer and Matija Pretnar. Programming with algebraic effects and handlers. JLAMP, 84(1):108–123, 2015.Google ScholarGoogle Scholar
  4. Martin Berger, Kohei Honda, and Nobuko Yoshida. Sequentiality and the π-calculus. In Proc. TLCA’01, volume 2044 of LNCS, pages 29– 45, 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Martin Berger, Kohei Honda, and Nobuko Yoshida. Genericity and the pi-calculus. Acta Inf., 42(2-3):83–141, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Lu´ıs Caires, Jorge A. Pérez, Frank Pfenning, and Bernardo Toninho. Behavioral polymorphism and parametricity in session-based communication. In ESOP, volume 7792 of LNCS, pages 330–349. Springer, 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Lu´ıs Caires and Frank Pfenning. Session types as intuitionistic linear propositions. In CONCUR, volume 6269 of LNCS, pages 222–236. Springer, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Sara Capecchi, Elena Giachino, and Nobuko Yoshida. Global escape in multiparty sessions. MSCS, 29:1–50, 2015.Google ScholarGoogle Scholar
  9. Marco Carbone, Kohei Honda, and Nobuko Yoshida. Structured interactional exceptions in session types. In CONCUR, volume 5201 of LNCS, pages 402–417. Springer, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Marco Carbone, Kohei Honda, and Nobuko Yoshida. Structured communication-centered programming for web services. TOPLAS, 34:8:1–8:78, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Tzu-Chun Chen, Mariangiola Dezani-Ciancaglini, and Nobuko Yoshida. On the preciseness of subtyping in session types. In PPDP’14, pages 146–135. ACM Press, 2014. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Ezgi C ¸ ic¸ek, Deepak Garg, and Umut Acar. Refinement types for incremental computational complexity. In ESOP, pages 406–431. Springer, 2015.Google ScholarGoogle Scholar
  13. Nils Anders Danielsson. Lightweight semiformal time complexity analysis for purely functional data structures. In ACM SIGPLAN Notices, volume 43, pages 133–144. ACM, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Ornela Dardha, Elena Giachino, and Davide Sangiorgi. Session types revisited. In PPDP’12, pages 139–150. ACM, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Romain Demangeon and Kohei Honda. Full abstraction in a subtyped pi-calculus with linear types. In CONCUR, volume 6901 of LNCS, pages 280–296. Springer, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Romain Demangeon, Kohei Honda, Raymond Hu, Rumyana Neykova, and Nobuko Yoshida. Practical interruptible conversations: Distributed dynamic verification with multiparty session types and Python. Formal Methods in System Design, 46(3):197–225, 2015. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Richard A Eisenberg, Dimitrios Vytiniotis, Simon Peyton Jones, and Stephanie Weirich. Closed type families with overlapping equations. In Proceedings of POPL 2014, pages 671–684, 2014. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Andrezej Filinski. Controlling effects. Technical report, DTIC Document, 1996.Google ScholarGoogle Scholar
  19. Simon Gay and Malcolm Hole. Subtyping for Session Types in the Pi-Calculus. Acta Informatica, 42(2/3):191–225, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. David K. Gifford and John M. Lucassen. Integrating functional and imperative programming. In LFP’86, pages 28–38. ACM, 1986. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. Jean-Yves Girard, Yves Lafont, and Paul Taylor. Proofs and Types, volume 7 of Cambridge Tracts in Theoretical Computer Science. CUP, 1989. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. Kohei Honda, Vasco T. Vasconcelos, and Makoto Kubo. Language primitives and type disciplines for structured communication-based programming. In ESOP’98, volume 1381 of LNCS, pages 22–138. Springer, 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. Kohei Honda and Nobuko Yoshida. On reduction-based process semantics. TCS, 151(2):437–486, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Kohei Honda and Nobuko Yoshida. A uniform type structure for secure information flow. TOPLAS, 29(6), 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. Kohei Honda, Nobuko Yoshida, and Marco Carbone. Multiparty Asynchronous Session Types. In POPL, pages 273–284. ACM, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. a full version will appear in JACM.Google ScholarGoogle Scholar
  27. Martin Hyland and Luke Ong. On full abstraction for PCF. Inf. & Comp., 163:285––408, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. Keigo Imai, Shoji Yuen, and Kiyoshi Agusa. Session Type Inference in Haskell. In Proc. of PLACES, volume 69 of EPTCS, pages 74–91, 2010.Google ScholarGoogle Scholar
  29. Pierre Jouvelot and David K. Gifford. Communication Effects for Message-Based Concurrency. Technical report, MIT, 1989.Google ScholarGoogle Scholar
  30. Ohad Kammar and Gordon D Plotkin. Algebraic foundations for effect-dependent optimisations. In ACM SIGPLAN Notices, volume 47, pages 349–360. ACM, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. Shin-ya Katsumata. Parametric effect monads and semantics of effect systems. In POPL, pages 633–646. ACM, 2014. Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. Naoki Kobayashi, Benjamin C. Pierce, and David N. Turner. Linearity and the Pi-Calculus. TOPLAS, 21(5):914–947, September 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. Sam Lindley and Garrett Morris. A semantics for propositions as sessions. In ESOP, pages 560–584. Springer, 2015.Google ScholarGoogle Scholar
  34. Robin Milner. Functions as processes. MSCS, 2(2):119–141, 1992.Google ScholarGoogle Scholar
  35. Eugenio Moggi. Notions of computation and monads. Inf. Comput., 93(1):55–92, 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. Dimitris Mostrous and Nobuko Yoshida. Session typing and asynchronous subtyping for the higher-order π-calculus. Inf. Comput., 241:227–263, 2015. Google ScholarGoogle ScholarDigital LibraryDigital Library
  37. Alan Mycroft, Dominic Orchard, and Tomas Petricek. Effect systems revisited– control-flow algebra and semantics. volume 9560 of LNCS. Springer, 2016.Google ScholarGoogle Scholar
  38. Matthias Neubauer and Peter Thiemann. An Implementation of Session Types. In PADL, volume 3057 of LNCS, pages 56–70. Springer, 2004.Google ScholarGoogle Scholar
  39. Flemming Nielson and Hanne Riis Nielson. Type and effect systems. In Correct System Design, pages 114–136. Springer, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  40. Dominic Orchard and Tomas Petricek. Embedding effect systems in Haskell. In Haskell Symposium, pages 13–24, 2014. Google ScholarGoogle ScholarDigital LibraryDigital Library
  41. Dominic Orchard, Tomas Petricek, and Alan Mycroft. The semantic marriage of monads and effects. arXiv:1401.5391, 2014.Google ScholarGoogle Scholar
  42. Dominic Orchard and Nobuko Yoshida. Effects as Sessions, Sessions as Effects (with appendices). Technical Report 2015/5, Department of Computing, Imperial College London, UK, 2015. http://www.doc. ic.ac.uk/research/technicalreports/2015/DTR15-5.pdf.Google ScholarGoogle Scholar
  43. Dominic Orchard and Nobuko Yoshida. Using session types as an effect system. In Post-proceedings of PLACES, EPTCS, 2015.Google ScholarGoogle Scholar
  44. Jorge A. Pérez, Lu´ıs Caires, Frank Pfenning, and Bernardo Toninho. Linear logical relations and observational equivalences for sessionbased concurrency. Inf. Comput., 239:254–302, 2014.Google ScholarGoogle ScholarDigital LibraryDigital Library
  45. Benjamin Pierce and Davide Sangiorgi. Typing and subtyping for mobile processes. MSCS, 6(5):409–454, 1996.Google ScholarGoogle Scholar
  46. Benjamin Pierce and Davide Sangiorgi. Behavioral equivalence in the polymorphic pi-calculus. Journal of ACM, 47(3):531–584, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  47. Gordon Plotkin and John Power. Algebraic operations and generic effects. Applied Categorical Structures, 11(1):69–94, 2003.Google ScholarGoogle ScholarCross RefCross Ref
  48. Riccardo Pucella and Jesse A. Tov. Haskell session types with (almost) no class. In Proc. of Haskell symposium ’08, pages 25–36. ACM, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  49. Matthew Sackman and Susan Eisenbach. Session Types in Haskell (Updating Message Passing for the 21st Century), 2008. Technical report, Imperial College London.Google ScholarGoogle Scholar
  50. Davide Sangiorgi and David Walker. The π-Calculus: a Theory of Mobile Processes. Cambridge University Press, 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  51. Jean-Pierre Talpin and Pierre Jouvelot. The type and effect discipline. In Proc. LICS’92, pages 162–173, 1992.Google ScholarGoogle ScholarCross RefCross Ref
  52. Bernardo Toninho, Lu´ıs Caires, and Frank Pfenning. Functions as Session-Typed Processes. In FoSSaCs, LNCS, pages 346–360. Springer, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  53. Bernardo Toninho, Lu´ıs Caires, and Frank Pfenning. Higher-order processes, functions, and sessions: A monadic integration. In ESOP, volume 7792 of LNCS, pages 350–369. Springer, 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  54. Philip Wadler. Propositions as sessions. J. Funct. Program., 24(2- 3):384–418, 2014.Google ScholarGoogle ScholarCross RefCross Ref
  55. Philip Wadler and Peter Thiemann. The marriage of effects and monads. ACM Trans. Comput. Logic, 4:1–32, January 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  56. Brent A Yorgey, Stephanie Weirich, Julien Cretin, Simon Peyton Jones, Dimitrios Vytiniotis, and José Pedro Magalh˜aes. Giving Haskell a promotion. In Proc. of TLDI, pages 53–66. ACM, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  57. Nobuko Yoshida, Martin Berger, and Kohei Honda. Strong normalisation in the pi -calculus. Inf. Comput., 191(2):145–202, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  58. Nobuko Yoshida and Vasco Thudichum Vasconcelos. Language primitives and type discipline for structured communication-based programming revisited: Two systems for higher-order session communication. Electr. Notes Theor. Comput. Sci., 171(4):73–93, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Effects as sessions, sessions as effects

          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

          Full Access

          • Published in

            cover image ACM SIGPLAN Notices
            ACM SIGPLAN Notices  Volume 51, Issue 1
            POPL '16
            January 2016
            815 pages
            ISSN:0362-1340
            EISSN:1558-1160
            DOI:10.1145/2914770
            • Editor:
            • Andy Gill
            Issue’s Table of Contents
            • cover image ACM Conferences
              POPL '16: Proceedings of the 43rd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages
              January 2016
              815 pages
              ISBN:9781450335492
              DOI:10.1145/2837614

            Copyright © 2016 ACM

            Publisher

            Association for Computing Machinery

            New York, NY, United States

            Publication History

            • Published: 11 January 2016

            Check for updates

            Qualifiers

            • article

          PDF Format

          View or Download as a PDF file.

          PDF

          eReader

          View online with eReader.

          eReader
          About Cookies On This Site

          We use cookies to ensure that we give you the best experience on our website.

          Learn more

          Got it!