skip to main content

Asynchronous effects

Published:04 January 2021Publication History
Skip Abstract Section

Abstract

We explore asynchronous programming with algebraic effects. We complement their conventional synchronous treatment by showing how to naturally also accommodate asynchrony within them, namely, by decoupling the execution of operation calls into signalling that an operation’s implementation needs to be executed, and interrupting a running computation with the operation’s result, to which the computation can react by installing interrupt handlers. We formalise these ideas in a small core calculus, called λæ. We demonstrate the flexibility of λæ using examples ranging from a multi-party web application, to preemptive multi-threading, to remote function calls, to a parallel variant of runners of algebraic effects. In addition, the paper is accompanied by a formalisation of λæ’s type safety proofs in Agda, and a prototype implementation of λæ in OCaml.

References

  1. D. Ahman. 2020. Agda formalisation of the ae-calculus. Available at https://github.com/danelahman/aef-agda/releases/ tag/popl-2021.Google ScholarGoogle Scholar
  2. D. Ahman and A. Bauer. 2020. Runners in action. In Proc. of 29th European Symp. on Programming, ESOP 2020 (LNCS, Vol. 12075 ). Springer, 29-55.Google ScholarGoogle Scholar
  3. D. Ahman and M. Pretnar. 2020. Software artefact for the POPL 2021 paper "Asynchronous Efects". Available at https: //doi.org/10.5281/zenodo.4072753. Google ScholarGoogle ScholarCross RefCross Ref
  4. R. M. Amadio and P-L. Curien. 1998. Domains and Lambda Calculi. Cambridge University Press.Google ScholarGoogle Scholar
  5. P. Bahr, C. Graulund, and R. E. Mogelberg. 2019. Simply RaTT: a fitch-style modal calculus for reactive programming without space leaks. Proc. ACM Program. Lang. 3, ICFP ( 2019 ), 109 : 1-109 : 27.Google ScholarGoogle Scholar
  6. A. Bauer and M. Pretnar. 2014. An Efect System for Algebraic Efects and Handlers. Logical Methods in Computer Science 10, 4 ( 2014 ).Google ScholarGoogle Scholar
  7. A. Bauer and M. Pretnar. 2015. Programming with algebraic efects and handlers. J. Log. Algebr. Meth. Program. 84, 1 ( 2015 ), 108-123.Google ScholarGoogle Scholar
  8. N. Benton, M. Hofmann, and V. Nigam. 2014. Abstract efects and proof-relevant logical relations. In Proc. of 41st Ann. ACM SIGPLAN-SIGACT Symp. on Principles of Programming Languages, POPL 2014. ACM, 619-632.Google ScholarGoogle Scholar
  9. D. Biernacki, M. Piróg, P. Polesiuk, and F. Sieczkowski. 2019. Abstracting Algebraic Efects. Proc. ACM Program. Lang. 3, POPL ( 2019 ), 6 : 1-6 : 28.Google ScholarGoogle Scholar
  10. E. Bingham, J. P. Chen, M. Jankowiak, F. Obermeyer, N. Pradhan, T. Karaletsos, R. Singh, P. Szerlip, P. Horsfall, and N. D. Goodman. 2019. Pyro: Deep Universal Probabilistic Programming. J. Mach. Learn. Res. 20, 1 (Jan. 2019 ), 973-978.Google ScholarGoogle Scholar
  11. L. Convent, S. Lindley, C. McBride, and C. McLaughlin. 2020. Doo bee doo bee doo. J. Funct. Program. 30 ( 2020 ), e9.Google ScholarGoogle Scholar
  12. S. Dolan, S. Eliopoulos, D. Hillerström, A. Madhavapeddy, K. C. Sivaramakrishnan, and L. White. 2018. Concurrent System Programming with Efect Handlers. In Proc. of 18th Int. Sym. Trends in Functional Programming, TFP 2017. Springer, 98-117.Google ScholarGoogle Scholar
  13. C. Fournet and G. Gonthier. 1996. The Reflexive CHAM and the Join-Calculus. In Proc. of 23rd ACM SIGPLAN-SIGACT Symp. on Principles of Programming Languages, POPL'96. ACM, 372-385.Google ScholarGoogle Scholar
  14. G. Gierz, K. H. Hofmann, K. Keimel, J. D. Lawson, M. Mislove, and D. S. Scott. 2003. Continuous Lattices and Domains. Number 93 in Encyclopedia of Mathematics and its Applications. Cambridge University Press.Google ScholarGoogle Scholar
  15. P. Haller, A. Prokopec, H. Miller, V. Klang, R. Kuhn, and V. Jovanovic. 2020. Scala documentation: Futures and Promises. ( July 2020 ). Available online at https://docs.scala-lang.org/overviews/core/futures.html.Google ScholarGoogle Scholar
  16. C. Hewitt, P. Bishop, and R. Steiger. 1973. A Universal Modular ACTOR Formalism for Artificial Intelligence. In Proc. of 3rd Int. Joint Conf. on Artificial Intelligence, IJCAI' 73. Morgan Kaufmann Publishers Inc., 235-245.Google ScholarGoogle Scholar
  17. K. Honda, V. T. Vasconcelos, and M. Kubo. 1998. Language Primitives and Type Discipline for Structured CommunicationBased Programming. In Proc. of 7th European Symp. on Programming, ESOP 1998 (LNCS, Vol. 1381 ). Springer, 122-138.Google ScholarGoogle Scholar
  18. O. Kammar, S. Lindley, and N. Oury. 2013. Handlers in Action. In Proc. of 18th ACM SIGPLAN Int. Conf. on Functional Programming, ICFP 2013. ACM, 145-158.Google ScholarGoogle Scholar
  19. O. Kammar and G. D. Plotkin. 2012. Algebraic foundations for efect-dependent optimisations. In Proc. of 39th ACM SIGPLAN-SIGACT Symp. on Principles of Programming Languages, POPL 2012. ACM, 349-360.Google ScholarGoogle Scholar
  20. N. R. Krishnaswami. 2013. Higher-Order Functional Reactive Programming without Spacetime Leaks. In Proc of 18th ACM SIGPLAN Int. Conf. on Functional Programming, ICFP 2013. ACM, 221-232.Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. D. Leijen. 2017. Structured asynchrony with algebraic efects. In Proc. of 2nd ACM SIGPLAN Int. Wksh. on Type-Driven Development, [email protected] 2017. ACM, 16-29.Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. P. B. Levy, J. Power, and H. Thielecke. 2003. Modelling environments in call-by-value programming languages. Inf. Comput. 185, 2 ( 2003 ), 182-210.Google ScholarGoogle Scholar
  23. S. Lindley, C. McBride, and C. McLaughlin. 2017. Do Be Do Be Do. In Proc. of 44th ACM SIGPLAN Symp. on Principles of Programming Languages, POPL 2017. ACM, 500-514.Google ScholarGoogle Scholar
  24. R. Milner, J. Parrow, and D. Walker. 1992. A calculus of mobile processes, I. Inf. Comput. 100, 1 ( 1992 ), 1-40.Google ScholarGoogle Scholar
  25. T. Murphy VII. 2008. Modal Types for Mobile Code. Ph.D. Dissertation. Carnegie Mellon University.Google ScholarGoogle Scholar
  26. M. Piróg, T. Schrijvers, N. Wu, and M. Jaskeliof. 2018. Syntax and Semantics for Operations with Scopes. In Proc. of 33rd Annual ACM/IEEE Symp. on Logic in Computer Science, LICS 2018. ACM, 809-818.Google ScholarGoogle Scholar
  27. G. D. Plotkin. 2012. Concurrency and the algebraic theory of efects. ( 2012 ). Invited talk at the 23rd Int. Conf. on Concurrency Theory, CONCUR 2012.Google ScholarGoogle Scholar
  28. G. D. Plotkin and J. Power. 2002. Notions of Computation Determine Monads. In Proc. of 5th Int. Conf. on Foundations of Software Science and Computation Structures, FOSSACS 2002 (LNCS, Vol. 2303 ). Springer, 342-356.Google ScholarGoogle Scholar
  29. G. D. Plotkin and M. Pretnar. 2008. A Logic for Algebraic Efects. In Proc. of 23th Ann. IEEE Symp. on Logic in Computer Science, LICS 2008. IEEE, 118-129.Google ScholarGoogle Scholar
  30. G. D. Plotkin and M. Pretnar. 2013. Handling Algebraic Efects. Logical Methods in Computer Science 9, 4 : 23 ( 2013 ).Google ScholarGoogle Scholar
  31. L. Poulson. 2020. Asynchronous Efect Handling. Master's thesis. School of Informatics, University of Edinburgh.Google ScholarGoogle Scholar
  32. M. Pretnar. 2015. An Introduction to Algebraic Efects and Handlers. Invited tutorial paper. Electr. Notes Theor. Comput. Sci. 319 ( 2015 ), 19-35.Google ScholarGoogle Scholar
  33. M. Pretnar. 2020. Programming language Æff. Available at https://github.com/matijapretnar/aef/releases/tag/popl-2021.Google ScholarGoogle Scholar
  34. J. Schwinghammer. 2002. A Concurrent Lambda-Calculus with Promises and Futures. Master's thesis. Programming Systems Lab, Universität des Saarlandes.Google ScholarGoogle Scholar
  35. S. Staton. 2013. Instances of Computational Efects: An Algebraic Perspective. In Proc. of 28th Ann. ACM/IEEE Symp. on Logic in Computer Science, LICS 2013. IEEE, 519-519.Google ScholarGoogle Scholar
  36. S. Staton. 2015. Algebraic Efects, Linearity, and Quantum Programming Languages. In Proc. of 42nd Annual ACM SIGPLANSIGACT Symp. on Principles of Programming Languages, POPL 2015. ACM, 395-406.Google ScholarGoogle Scholar
  37. A. K. Wright and M. Felleisen. 1994. A Syntactic Approach to Type Soundness. Information and Computation 115, 1 ( 1994 ), 38-94.Google ScholarGoogle Scholar

Index Terms

  1. Asynchronous 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

        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!