skip to main content
10.1145/3136000.3136007acmconferencesArticle/Chapter ViewAbstractPublication PagessplashConference Proceedingsconference-collections
research-article

Effekt: extensible algebraic effects in Scala (short paper)

Published: 22 October 2017 Publication History

Abstract

Algebraic effects are an interesting way to structure effectful programs and offer new modularity properties. We present the Scala library Effekt, which is implemented in terms of a monad for multi-prompt delimited continuations and centered around capability passing. This makes the newly proposed feature of implicit function types a perfect fit for the syntax of our library. Basing the library design on capability passing and a polymorphic embedding of effect handlers furthermore opens up interesting dimensions of extensibility. Preliminary benchmarks comparing Effekt with an established library suggest significant speedups.

References

[1]
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.
[2]
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.
[3]
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.
[4]
Philipp Haller and Alex Loiko. 2016. LaCasa: Lightweight affinity and object capabilities in Scala. In Proceedings of the Conference on Object-Oriented Programming, Systems, Languages and Applications. ACM, 272-291.
[5]
Christian Hofer, Klaus Ostermann, Tillmann Rendel, and Adriaan Moors. 2008. Polymorphic Embedding of DSLs. In Proceedings of the Conference on Generative Programming and Component Engineering. ACM.
[6]
Paul Hudak. 1998. Modular Domain Specific Languages and Tools. In Proceedings of the Conference on Software Reuse. IEEE Computer Society Press, 134-142.
[7]
Ohad Kammar, Sam Lindley, and Nicolas Oury. 2013. Handlers in Action. In Proceedings of the International Conference on Functional Programming. ACM, 145-158.
[8]
Oleg Kiselyov. 2012. Delimited control in OCaml, abstractly and concretely. Theoretical Computer Science 435 (2012), 56-76.
[9]
Oleg Kiselyov and Hiromi Ishii. 2015. Freer Monads, More Extensible Effects. In Proceedings of the Symposium on Haskell. ACM, 94-105.
[10]
Oleg Kiselyov, Amr Sabry, and Cameron Swords. 2013. Extensible Effects: An Alternative to Monad Transformers. In Proceedings of the Symposium on Haskell. ACM, 59-70.
[11]
Oleg Kiselyov and KC Sivaramakrishnan. 2016. Eff directly in OCaml. In ML Workshop.
[12]
Daan Leijen. 2014. Koka: Programming with Row Polymorphic Effect Types. In Workshop on Mathematically Structured Functional Programming.
[13]
Daan Leijen. 2017a. Implementing Algebraic Effects in C "Monads for Free in C". Technical Report. Microsoft Research MSR-TR-2017-23.
[14]
Daan Leijen. 2017b. Type directed compilation of row-typed algebraic effects. In Proceedings of the Symposium on Principles of Programming Languages. 486-499.
[15]
Sheng Liang, Paul Hudak, and Mark Jones. 1995. Monad Transformers and Modular Interpreters. In Proceedings of the Symposium on Principles of Programming Languages. ACM, New York, NY, USA, 333-343.
[16]
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.
[17]
Fengyun Liu. 2016. A Study of Capability-Based Effect Systems. Master's thesis. École Polytechnique Fédérale de Lausanne, Switzerland.
[18]
Martin Odersky, Aggelos Biboudis, Fengyun Liu, Olivier Blanvillain, and Heather Miller. 2017. Simplicitly. Technical Report.
[19]
Martin Odersky and Matthias Zenger. 2005. Independently Extensible Solutions to the Expression Problem. In Proceedings of the Workshop on Foundations of Object-Oriented Languages.
[20]
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.
[21]
Bruno C. d. S. Oliveira, Tijs van der Storm, Alex Loh, and William R. Cook. 2013. Feature-Oriented Programming with Object Algebras. In Proceedings of the European Conference on Object-Oriented Programming. Springer LNCS 7920.
[22]
Leo Osvald, Grégory Essertel, Xilun Wu, Lilliam I González Alayón, and Tiark Rompf. 2016. Gentrification gone too far? affordable 2nd-class values for fun and (co-) effect. ACM, 234-251.
[23]
Gordon Plotkin and John Power. 2003. Algebraic operations and generic effects. Applied Categorical Structures 11, 1 (2003), 69-94.
[24]
Gordon Plotkin and Matija Pretnar. 2009. Handlers of algebraic effects. In European Symposium on Programming. Springer, 80-94.
[25]
Tiark Rompf, Ingo Maier, and Martin Odersky. 2009. Implementing Firstclass Polymorphic Delimited Continuations by a Type-directed Selective CPS-transform. In Proceedings of the International Conference on Functional Programming. ACM, New York, NY, USA, 317-328.
[26]
Wouter Swierstra. 2008. Data Types à La Carte. Journal of Functional Programming 18, 4 (July 2008), 423-436.
[27]
Philip Wadler. 1998. The Expression Problem. (Nov. 1998). Note to Java Genericity mailing list.

Cited By

View all
  • (2024)Specification and Verification for Unrestricted Algebraic Effects and HandlingProceedings of the ACM on Programming Languages10.1145/36746568:ICFP(909-937)Online publication date: 15-Aug-2024
  • (2022)Effects, capabilities, and boxes: from scope-based reasoning to type-based reasoning and backProceedings of the ACM on Programming Languages10.1145/35273206:OOPSLA1(1-30)Online publication date: 29-Apr-2022
  • (2022)A typed continuation-passing translation for lexical effect handlersProceedings of the 43rd ACM SIGPLAN International Conference on Programming Language Design and Implementation10.1145/3519939.3523710(566-579)Online publication date: 9-Jun-2022
  • Show More Cited By

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Conferences
SCALA 2017: Proceedings of the 8th ACM SIGPLAN International Symposium on Scala
October 2017
77 pages
ISBN:9781450355292
DOI:10.1145/3136000
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than the author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected].

Sponsors

In-Cooperation

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 22 October 2017

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. algebraic effects
  2. capabilities
  3. continuations
  4. effect handlers
  5. implicits
  6. shallow embedding

Qualifiers

  • Research-article

Conference

SPLASH '17
Sponsor:

Upcoming Conference

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)17
  • Downloads (Last 6 weeks)1
Reflects downloads up to 05 Mar 2025

Other Metrics

Citations

Cited By

View all
  • (2024)Specification and Verification for Unrestricted Algebraic Effects and HandlingProceedings of the ACM on Programming Languages10.1145/36746568:ICFP(909-937)Online publication date: 15-Aug-2024
  • (2022)Effects, capabilities, and boxes: from scope-based reasoning to type-based reasoning and backProceedings of the ACM on Programming Languages10.1145/35273206:OOPSLA1(1-30)Online publication date: 29-Apr-2022
  • (2022)A typed continuation-passing translation for lexical effect handlersProceedings of the 43rd ACM SIGPLAN International Conference on Programming Language Design and Implementation10.1145/3519939.3523710(566-579)Online publication date: 9-Jun-2022
  • (2022)What You See Is What You Get: Practical Effect Handlers in Capability-Passing StyleErnst Denert Award for Software Engineering 202010.1007/978-3-030-83128-8_3(15-43)Online publication date: 28-Feb-2022
  • (2021)Implementing Algebraic Effects and Handlers in Non-functional Programming Languages2021 IEEE Asia-Pacific Conference on Computer Science and Data Engineering (CSDE)10.1109/CSDE53843.2021.9718480(1-6)Online publication date: 8-Dec-2021
  • (2020)Effects as capabilities: effect handlers and lightweight effect polymorphismProceedings of the ACM on Programming Languages10.1145/34281944:OOPSLA(1-30)Online publication date: 13-Nov-2020
  • (2020)Compiling effect handlers in capability-passing styleProceedings of the ACM on Programming Languages10.1145/34089754:ICFP(1-28)Online publication date: 3-Aug-2020
  • (2020)Effect handlers via generalised continuationsJournal of Functional Programming10.1017/S095679682000004030Online publication date: 16-Mar-2020
  • (2020)Doo bee doo bee dooJournal of Functional Programming10.1017/S095679682000003930Online publication date: 31-Mar-2020
  • (2020)Mining the use of higher-order functions:Empirical Software Engineering10.1007/s10664-020-09842-7Online publication date: 4-Sep-2020
  • Show More Cited By

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Figures

Tables

Media

Share

Share

Share this Publication link

Share on social media