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.
- D. Ahman. 2020. Agda formalisation of the ae-calculus. Available at https://github.com/danelahman/aef-agda/releases/ tag/popl-2021.Google Scholar
- 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 Scholar
- 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 Scholar
Cross Ref
- R. M. Amadio and P-L. Curien. 1998. Domains and Lambda Calculi. Cambridge University Press.Google Scholar
- 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 Scholar
- A. Bauer and M. Pretnar. 2014. An Efect System for Algebraic Efects and Handlers. Logical Methods in Computer Science 10, 4 ( 2014 ).Google Scholar
- A. Bauer and M. Pretnar. 2015. Programming with algebraic efects and handlers. J. Log. Algebr. Meth. Program. 84, 1 ( 2015 ), 108-123.Google Scholar
- 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 Scholar
- 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 Scholar
- 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 Scholar
- L. Convent, S. Lindley, C. McBride, and C. McLaughlin. 2020. Doo bee doo bee doo. J. Funct. Program. 30 ( 2020 ), e9.Google Scholar
- 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 Scholar
- 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 Scholar
- 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 Scholar
- 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 Scholar
- 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 Scholar
- 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 Scholar
- 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 Scholar
- 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 Scholar
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
- 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 Scholar
- R. Milner, J. Parrow, and D. Walker. 1992. A calculus of mobile processes, I. Inf. Comput. 100, 1 ( 1992 ), 1-40.Google Scholar
- T. Murphy VII. 2008. Modal Types for Mobile Code. Ph.D. Dissertation. Carnegie Mellon University.Google Scholar
- 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 Scholar
- 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 Scholar
- 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 Scholar
- 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 Scholar
- G. D. Plotkin and M. Pretnar. 2013. Handling Algebraic Efects. Logical Methods in Computer Science 9, 4 : 23 ( 2013 ).Google Scholar
- L. Poulson. 2020. Asynchronous Efect Handling. Master's thesis. School of Informatics, University of Edinburgh.Google Scholar
- M. Pretnar. 2015. An Introduction to Algebraic Efects and Handlers. Invited tutorial paper. Electr. Notes Theor. Comput. Sci. 319 ( 2015 ), 19-35.Google Scholar
- M. Pretnar. 2020. Programming language Æff. Available at https://github.com/matijapretnar/aef/releases/tag/popl-2021.Google Scholar
- J. Schwinghammer. 2002. A Concurrent Lambda-Calculus with Promises and Futures. Master's thesis. Programming Systems Lab, Universität des Saarlandes.Google Scholar
- 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 Scholar
- 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 Scholar
- A. K. Wright and M. Felleisen. 1994. A Syntactic Approach to Type Soundness. Information and Computation 115, 1 ( 1994 ), 38-94.Google Scholar
Index Terms
Asynchronous effects
Recommendations
Handling fibred algebraic effects
We study algebraic computational effects and their handlers in the dependently typed setting. We describe computational effects using a generalisation of Plotkin and Pretnar's effect theories, whose dependently typed operations allow us to capture ...
Structured asynchrony with algebraic effects
TyDe 2017: Proceedings of the 2nd ACM SIGPLAN International Workshop on Type-Driven DevelopmentAlgebraic effect handlers generalize many control-flow abstractions that are implemented specially in most languages, like exception handling, iterators, or backtracking. In this article, we show how we can implement full support for asynchronous ...
Algebraic effects and effect handlers for idioms and arrows
WGP '14: Proceedings of the 10th ACM SIGPLAN workshop on Generic programmingPlotkin and Power's algebraic effects combined with Plotkin and Pretnar's effect handlers provide a foundation for modular programming with effects. We present a generalisation of algebraic effects and effect handlers to support other kinds of effectful ...






Comments