skip to main content
research-article
Open Access

Effect handlers for the masses

Published:24 October 2018Publication History
Skip Abstract Section

Abstract

Effect handlers are a program structuring paradigm with rising popularity in the functional programming language community and can express many advanced control flow abstractions. We present the first implementation of effect handlers for Java - an imperative, object oriented programming language. Our framework consists of three core components: A type selective CPS transformation via JVM bytecode transformation, an implementation of delimited continuations on top of the bytecode transformation and finally a library for effect handlers in terms of delimited continuations.

Skip Supplemental Material Section

Supplemental Material

a111-brachthauser.webm

References

  1. Andrej Bauer and Matija Pretnar. 2013. An effect system for algebraic effects and handlers. In International Conference on Algebra and Coalgebra in Computer Science. Springer, 1–16.Google ScholarGoogle ScholarCross RefCross Ref
  2. Andrej Bauer and Matija Pretnar. 2015. Programming with algebraic effects and handlers. Journal of Logical and Algebraic Methods in Programming 84, 1 (2015), 108–123.Google ScholarGoogle ScholarCross RefCross Ref
  3. Gavin Bierman, Claudio Russo, Geoffrey Mainland, Erik Meijer, and Mads Torgersen. 2012. Pause’n’Play: Formalizing Asynchronous C#. In Proceedings of the European Conference on Object-Oriented Programming. Springer-Verlag, 233–257. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Dariusz Biernacki, Maciej Piróg, Piotr Polesiuk, and Filip Sieczkowski. 2017. Handle with Care: Relational Interpretation of Algebraic Effects and Handlers. In Proceedings of the Symposium on Principles of Programming Languages. ACM.Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Jonathan Immanuel Brachthäuser and Philipp Schuster. 2017. Effekt: Extensible Algebraic Effects in Scala (Short Paper). In Proceedings of the International Symposium on Scala. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Edwin Brady. 2013. Programming and Reasoning with Algebraic Effects and Dependent Types. In Proceedings of the International Conference on Functional Programming. ACM, 133–144. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Jacques Carette, Oleg Kiselyov, and Chung-Chieh Shan. 2007. Finally Tagless, Partially Evaluated. In Proceedings of the Asian Symposium on Programming Languages and Systems. Springer LNCS 4807, 222–238. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Melvin E Conway. 1963. Design of a separable transition-diagram compiler. Commun. ACM 6, 7 (1963). Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Stephen Dolan, Spiros Eliopoulos, Daniel Hillerström, Anil Madhavapeddy, KC Sivaramakrishnan, and Leo White. 2017. Concurrent system programming with effect handlers. In Proceedings of the Symposium on Trends in Functional Programming.Google ScholarGoogle Scholar
  10. Stephen Dolan, Leo White, KC Sivaramakrishnan, Jeremy Yallop, and Anil Madhavapeddy. 2015. Effective concurrency through algebraic effects. In OCaml Workshop.Google ScholarGoogle Scholar
  11. Iulian Dragos, Antonio Cunei, and Jan Vitek. 2007. Continuations in the Java virtual machine. In Second ECOOP Workshop on Implementation, Compilation, Optimization of Object-Oriented Languages, Programs and Systems (ICOOOLPS 2007). Technische Universität Berlin.Google ScholarGoogle Scholar
  12. R Kent Dyvbig, Simon Peyton Jones, and Amr Sabry. 2007. A monadic framework for delimited continuations. Journal of Functional Programming 17, 6 (2007), 687–730. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. Michael Eichberg and Ben Hermann. 2014. A Software Product Line for Static Analyses: The OPAL Framework. In Proceedings of the 3rd ACM SIGPLAN International Workshop on the State of the Art in Java Program Analysis (SOAP ’14). ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Steven E. Ganz, Daniel P. Friedman, and Mitchell Wand. 1999. Trampolined Style. In Proceedings of the International Conference on Functional Programming. ACM, 18–27. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. R. Hieb and R. Kent Dybvig. 1990. Continuations and Concurrency. In Proceedings of the Second ACM SIGPLAN Symposium on Principles & Practice of Parallel Programming (PPOPP ’90). ACM, 128–136. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Daniel Hillerström, Sam Lindley, Bob Atkey, and KC Sivaramakrishnan. 2017. Continuation Passing Style for Effect Handlers. In Formal Structures for Computation and Deduction (LIPIcs), Vol. 84. Schloss Dagstuhl–Leibniz-Zentrum für Informatik.Google ScholarGoogle Scholar
  17. Paul Hudak. 1998. Modular Domain Specific Languages and Tools. In Proceedings of the Conference on Software Reuse. IEEE Computer Society Press, 134–142. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Ohad Kammar, Sam Lindley, and Nicolas Oury. 2013. Handlers in Action. In Proceedings of the International Conference on Functional Programming. ACM, 145–158. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Oleg Kiselyov and Hiromi Ishii. 2015. Freer Monads, More Extensible Effects. In Proceedings of the Haskell Symposium. ACM, 94–105. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. Oleg Kiselyov, Amr Sabry, and Cameron Swords. 2013. Extensible Effects: An Alternative to Monad Transformers. In Proceedings of the Haskell Symposium. ACM, 59–70. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. Oleg Kiselyov and KC Sivaramakrishnan. 2016. Eff directly in OCaml. In ML Workshop.Google ScholarGoogle Scholar
  22. Daan Leijen. 2014. Koka: Programming with Row Polymorphic Effect Types. In Proceedings of the Workshop on Mathematically Structured Functional Programming.Google ScholarGoogle ScholarCross RefCross Ref
  23. Daan Leijen. 2016. Algebraic Effects for Functional Programming. Technical Report. MSR-TR-2016-29. Microsoft Research technical report.Google ScholarGoogle Scholar
  24. Daan Leijen. 2017a. Implementing Algebraic Effects in C. In Proceedings of the Asian Symposium on Programming Languages and Systems. Springer International Publishing, Cham, Switzerland, 339–363.Google ScholarGoogle ScholarCross RefCross Ref
  25. Daan Leijen. 2017b. Structured Asynchrony with Algebraic Effects. In Proceedings of the Workshop on Type-Driven Development. ACM, 16–29. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. Daan Leijen. 2017c. Type directed compilation of row-typed algebraic effects. In Proceedings of the Symposium on Principles of Programming Languages. 486–499. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. Sam Lindley. 2018. Encapsulating effects, In Algebraic Effect Handlers go Mainstream (Dagstuhl Seminar 18172). Dagstuhl Reports 8, 4.Google ScholarGoogle Scholar
  28. Sam Lindley, Conor McBride, and Craig McLaughlin. 2017. Do Be Do Be Do. In Proceedings of the Symposium on Principles of Programming Languages. ACM, 500–514. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. Florian Loitsch. 2007. Exceptional continuations in JavaScript. In Workshop on Scheme and Functional Programming.Google ScholarGoogle Scholar
  30. Bruno C. d. S. Oliveira and William R. Cook. 2012. Extensibility for the Masses: Practical Extensibility with Object Algebras. In Proceedings of the European Conference on Object-Oriented Programming. Springer LNCS 7313, 2–27. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. Greg Pettyjohn, John Clements, Joe Marshall, Shriram Krishnamurthi, and Matthias Felleisen. 2005. Continuations from Generalized Stack Inspection. In Proceedings of the International Conference on Functional Programming. ACM, 216–227. Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. Gordon Plotkin and John Power. 2003. Algebraic operations and generic effects. Applied Categorical Structures 11, 1 (2003), 69–94.Google ScholarGoogle Scholar
  33. Gordon Plotkin and Matija Pretnar. 2009. Handlers of algebraic effects. In European Symposium on Programming. SpringerVerlag, 80–94. Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. Joe Gibbs Politz, Alejandro Martinez, Matthew Milano, Sumner Warren, Daniel Patterson, Junsong Li, Anand Chitipothu, and Shriram Krishnamurthi. 2013. Python: The Full Monty. In Proceedings of the Conference on Object-Oriented Programming, Systems, Languages and Applications. ACM, 217–232. Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. Ron Pressler. 2017. Loom Project: Fibers and Continuations for the Java Virtual Machine. OpenJDK Project. HotSpot Group. http://mail.openjdk.java.net/pipermail/discuss/2017-September/004390.htmlGoogle ScholarGoogle Scholar
  36. Aleksandar Prokopec and Fengyun Liu. 2018. Theory and practice of coroutines with snapshots. In Proceedings of the European Conference on Object-Oriented Programming. Schloss Dagstuhl–Leibniz-Zentrum für Informatik.Google ScholarGoogle Scholar
  37. John C. Reynolds. 1972. Definitional Interpreters for Higher-Order Programming Languages. In Proceedings of the ACM annual conference. ACM, 717–740. Google ScholarGoogle ScholarDigital LibraryDigital Library
  38. Tatsurou Sekiguchi, Takahiro Sakamoto, and Akinori Yonezawa. 2001. Advances in Exception Handling Techniques. Springer-Verlag, Heidelberg, Berlin, Germany, Chapter Portable Implementation of Continuation Operators in Imperative Languages by Exception Handling, 217–233. Google ScholarGoogle ScholarDigital LibraryDigital Library
  39. Lukas Stadler, Christian Wimmer, Thomas Würthinger, Hanspeter Mössenböck, and John Rose. 2009. Lazy continuations for Java virtual machines. In Proceedings of the International Conference on Principles and Practice of Programming in Java. ACM, 143–152. Google ScholarGoogle ScholarDigital LibraryDigital Library
  40. Nicolas Wu and Tom Schrijvers. 2015. Fusion for Free - Efficient Algebraic Effect Handlers. In Proceedings of the Conference on Mathematics of Program Construction. Springer LNCS 9129.Google ScholarGoogle Scholar

Index Terms

  1. Effect handlers for the masses

          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!