Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
10.1145/3240719.3241789acmconferencesArticle/Chapter ViewAbstractPublication PagesicfpConference Proceedingsconference-collections
research-article

First class dynamic effect handlers: or, polymorphic heaps with dynamic effect handlers

Published: 27 September 2018 Publication History

Abstract

Algebraic effect handlers are a powerful abstraction mechanism that can express many complex control-flow mechanisms. This article extends basic algebraic effect handlers with first class dynamic effects. Dynamic effects add a lot more expressiveness but surprisingly only need minimal changes to the original semantics. As such, dynamic effects are a powerful abstraction but can still be understood and reasoned about as regular effect handlers. We illustrate the expressiveness of dynamic effects with first class event streams in CorrL and also model full polymorphic heap references without requiring any further primitives.

References

[1]
Andrej Bauer, and Matija Pretnar. “Programming with Algebraic Effects and Handlers.” J. Log. Algebr. Meth. Program. 84 (1): 108–123. 2015.
[2]
Dariusz Biernacki, Maciej Piróg, Piotr Polesiuk, and Filip Sieczkowski. “Handle with Care: Relational Interpretation of Algebraic Effects and Handlers.” Proc. ACM Program. Lang. 2 (POPL’17 issue): 8:1–8:30. Dec. 2017.
[3]
Oliver Bračevac, Nada Amin, Guido Salvaneschi, Sebastian Erdweg, Patrick Eugster, and Mira Mezini. “Effectful Reactive Programming.” 2018. http://www.st.informatik.tu-darmstadt.de/artifacts/ corrl/corrl_draft.pdf. Draft article.
[4]
Jonathan Immanuel Brachthaëuser, Philipp Schuster, and Klaus Ostermann. “Algebraic Effects for the Masses.” In Submitted for Review to the International Conference on Object Oriented Programming Systems Languages & Applications. OOPSLA ’18. 2018.
[5]
Jonathan Immanuel Brachthäuser, and Philipp Schuster. “Effekt: Extensible Algebraic Effects in Scala.” In Scala’17. Vancouver, CA. Oct. 2017.
[6]
Stephen Dolan, Spiros Eliopoulos, Daniel Hillerström, Anil Madhavapeddy, KC Sivaramakrishnan, and Leo White. “Effectively Tackling the Awkward Squad.” In ML Workshop. 2017.
[7]
Stephen Dolan, Spiros Eliopoulos, Daniel Hillerström, Anil Madhavapeddy, KC Sivaramakrishnan, and Leo White. “Concurrent System Programming with Effect Handlers.” In Proceedings of the Symposium on Trends in Functional Programming. TFP’17. May 2017.
[8]
Stephen Dolan, Leo White, KC Sivaramakrishnan, Jeremy Yallop, and Anil Madhavapeddy. “Effective Concurrency through Algebraic Effects.” In OCaml Workshop. Sep. 2015.
[9]
Ben R. Gaster, and Mark P. Jones. A Polymorphic Type System for Extensible Records and Variants. NOTTCS-TR-96-3. University of Nottingham. 1996.
[10]
Daniel Hillerström, and Sam Lindley. “Liberating Effects with Rows and Handlers.” In Proceedings of the 1st International Workshop on Type-Driven Development, 15–27. TyDe 2016. Nara, Japan. 2016.
[11]
J.R. Hindley. “The Principal Type Scheme of an Object in Combinatory Logic.” Trans. of the American Mathematical Society 146 (December): 29–60. Dec. 1969.
[12]
Ohad Kammar, Sam Lindley, and Nicolas Oury. “Handlers in Action.” In Proceedings of the 18th ACM SIGPLAN International Conference on Functional Programming, 145–158. ICFP ’13. ACM, New York, NY, USA. 2013.
[13]
Oleg Kiselyov, and KC Sivaramakrishnan. “Eff Directly in OCaml.” In ML Workshop 2016. Dec. 2017. http://kcsrk.info/papers/camleff17.pdf. Extended version.
[14]
John Launchbury, and Amr Sabry. “Monadic State: Axiomatization and Type Safety.” In In Proceedings of the 2nd ACM SIGPLAN International Conference on Functional Programming, 227–238. ICFP’97. 1997.
[15]
Daan Leijen. “Extensible Records with Scoped Labels.” In Proceedings of the 2005 Symposium on Trends in Functional Programming, 297–312. 2005.
[16]
Daan Leijen. “HMF: Simple Type Inference for First-Class Polymorphism.” In Proceedings of the 13th ACM Symposium of the International Conference on Functional Programming. ICFP’08. Victoria, Canada. Sep. 2008.
[17]
Daan Leijen. “Koka: Programming with Row Polymorphic Effect Types.” In MSFP’14, 5th Workshop on Mathematically Structured Functional Programming. 2014.
[18]
Daan Leijen. “The Koka Repository.” 2016. https://github.com/ koka-lang/koka.
[19]
Daan Leijen. “Structured Asynchrony with Algebraic Effects.” In Proceedings of the 2nd ACM SIGPLAN International Workshop on Type-Driven Development, 16–29. TyDe 2017. Oxford, UK. 2017.
[20]
Daan Leijen. “Implementing Algebraic Effects in C.” In Programming Languages and Systems, edited by Bor-Yuh Evan Chang, 339–363. Springer International Publishing. 2017.
[21]
Daan Leijen. “Type Directed Compilation of Row-Typed Algebraic Effects.” In Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming Languages (POPL’17), 486–499. Paris, France. Jan. 2017.
[22]
Daan Leijen. Structured Asynchrony with Algebraic Effects. {MSR-TR-2017-21}. Microsoft Research. May 2017.
[23]
Sam Lindley, and James Cheney. “Row-Based Effect Types for Database Integration.” In Proceedings of the 8th ACM SIGPLAN Workshop on Types in Language Design and Implementation, 91–102. TLDI’12. 2012.
[24]
Sam Lindley, Connor McBride, and Craig McLaughlin. “Do Be Do Be Do.” In Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming Languages (POPL’17), 500–514. Paris, France. Jan. 2017.
[25]
Robin Milner. “A Theory of Type Polymorphism in Programming.” Journal of Computer and System Sciences 17: 248–375. 1978.
[26]
Eugenio Moggi. “Notions of Computation and Monads.” Information and Computation 93 (1): 55–92. 1991.
[27]
Simon Peyton Jones, Dimitrios Vytiniotis, Stephanie Weirich, and Mark Shields. “Practical Type Inference for Arbitrary-Rank Types.” Journal of Functional Programming 17 (1). Cambridge University Press, New York, NY, USA: 1–82. 2007.
[28]
Gordon D. Plotkin, and John Power. “Algebraic Operations and Generic Effects.” Applied Categorical Structures 11 (1): 69–94. 2003.
[29]
Gordon D. Plotkin, and Matija Pretnar. “Handlers of Algebraic Effects.” In 18th European Symposium on Programming Languages and Systems, 80–94. ESOP’09. York, UK. Mar. 2009.
[30]
Gordon D. Plotkin, and Matija Pretnar. “Handling Algebraic Effects.” In Logical Methods in Computer Science, volume 9. 4. 2013.
[31]
Didier Rémy. “Type Inference for Records in Natural Extension of ML.” In Theoretical Aspects of Object-Oriented Programming, 67–95. 1994.
[32]
Martin Sulzmann. Designing Record Systems. YALEU/DCS/RR-1128. Yale University. Apr. 1997.
[33]
Wouter Swierstra. “Data Types à La Carte.” Journal of Functional Programming 18 (4): 423–436. Jul. 2008.
[34]
Philip Wadler. “Theorems for Free.” In 4’th International Conference on Functional Programming and Computer Architecture, edited by Mac Queen, 347–359. Addison-Wesley, London. Sep. 1989.
[35]
Leo White. “Effect Types for OCaml.” Sep. 2016. https://github. com/lpw25/ocaml-typed-effects.
[36]
Andrew K. Wright, and Matthias Felleisen. “A Syntactic Approach to Type Soundness.” Inf. Comput. 115 (1): 38–94. Nov. 1994.
[37]
Nicolas Wu, Tom Schrijvers, and Ralf Hinze. “Effect Handlers in Scope.” In Proceedings of the 2014 ACM SIGPLAN Symposium on Haskell, 1–12. Haskell ’14. Göthenburg, Sweden. 2014.

Cited By

View all
  • (2022)First-class names for effect handlersProceedings of the ACM on Programming Languages10.1145/35632896:OOPSLA2(30-59)Online publication date: 31-Oct-2022
  • (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)Effect handlers in Haskell, evidentlyProceedings of the 13th ACM SIGPLAN International Symposium on Haskell10.1145/3406088.3409022(95-108)Online publication date: 27-Aug-2020

Index Terms

  1. First class dynamic effect handlers: or, polymorphic heaps with dynamic effect handlers

    Recommendations

    Comments

    Information & Contributors

    Information

    Published In

    cover image ACM Conferences
    TyDe 2018: Proceedings of the 3rd ACM SIGPLAN International Workshop on Type-Driven Development
    September 2018
    90 pages
    ISBN:9781450358255
    DOI:10.1145/3240719
    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 ACM 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

    Publisher

    Association for Computing Machinery

    New York, NY, United States

    Publication History

    Published: 27 September 2018

    Permissions

    Request permissions for this article.

    Check for updates

    Author Tags

    1. Algebraic Effect Handlers
    2. Polymorphic Heap
    3. Types

    Qualifiers

    • Research-article

    Conference

    ICFP '18
    Sponsor:

    Contributors

    Other Metrics

    Bibliometrics & Citations

    Bibliometrics

    Article Metrics

    • Downloads (Last 12 months)9
    • Downloads (Last 6 weeks)1
    Reflects downloads up to 13 Sep 2024

    Other Metrics

    Citations

    Cited By

    View all
    • (2022)First-class names for effect handlersProceedings of the ACM on Programming Languages10.1145/35632896:OOPSLA2(30-59)Online publication date: 31-Oct-2022
    • (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)Effect handlers in Haskell, evidentlyProceedings of the 13th ACM SIGPLAN International Symposium on Haskell10.1145/3406088.3409022(95-108)Online publication date: 27-Aug-2020

    View Options

    Get Access

    Login options

    View options

    PDF

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader

    Media

    Figures

    Other

    Tables

    Share

    Share

    Share this Publication link

    Share on social media