Nothing Special   »   [go: up one dir, main page]

skip to main content
research-article

Effect handlers in scope

Published: 03 September 2014 Publication History

Abstract

Algebraic effect handlers are a powerful means for describing effectful computations. They provide a lightweight and orthogonal technique to define and compose the syntax and semantics of different effects. The semantics is captured by handlers, which are functions that transform syntax trees.
Unfortunately, the approach does not support syntax for scoping constructs, which arise in a number of scenarios. While handlers can be used to provide a limited form of scope, we demonstrate that this approach constrains the possible interactions of effects and rules out some desired semantics.
This paper presents two different ways to capture scoped constructs in syntax, and shows how to achieve different semantics by reordering handlers. The first approach expresses scopes using the existing algebraic handlers framework, but has some limitations. The problem is fully solved in the second approach where we introduce higher-order syntax.

References

[1]
A. Bauer and M. Pretnar. Programming with algebraic effects and handlers, 2012.
[2]
E. Brady. Programming and reasoning with algebraic effects and dependent types. In Proceedings of the 18th ACM SIGPLAN International Conference on Functional programming, pages 133--144. ACM, 2013.
[3]
R. Hinze. Deriving backtracking monad transformers. In Proceedings of the Fifth ACM SIGPLAN International Conference on Functional Programming, pages 186--197. ACM, 2000. ISBN 1-58113-202-6.
[4]
M. Hyland, G. D. Plotkin, and J. Power. Combining effects: Sum and tensor. Theor. Comput. Sci., 357 (1--3): 70--99, 2006.
[5]
M. Jaskelioff. Monatron: An extensible monad transformer library. In S.-B. Scholz and O. Chitil, editors, Implementation and Application of Functional Languages - Revised Selected Papers, volume 5836 of Lecture Notes in Computer Science, pages 233--248. Springer, 2008.
[6]
M. Jaskelioff and E. Moggi. Monad transformers as monoid transformers. Theor. Comput. Sci., 411 (51--52): 4441--4466, Dec. 2010.
[7]
O. Kammar, S. Lindley, and N. Oury. Handlers in action. In Proceedings of the 18th ACM SIGPLAN International Conference on Functional programming, pages 145--158. ACM, 2013.
[8]
O. Kiselyov, A. Sabry, and C. Swords. Extensible effects: an alternative to monad transformers. In Proceedings of the 2013 ACM SIGPLAN symposium on Haskell, Haskell '13, pages 59--70. ACM, 2013.
[9]
S. Liang, P. Hudak, and M. Jones. Monad transformers and modular interpreters. In POPL'95, 1995.
[10]
kC. McBride. The Frank manual, May 2012. https://personal.cis.strath.ac.uk/conor.mcbride/pub/Frank/TFM.pdf.
[11]
G. D. Plotkin and J. Power. Notions of computation determine monads. In M. Nielsen and U. Engberg, editors, Foundations of Software Science and Computation Structures, volume 2303 of Lecture Notes in Computer Science, pages 342--356. Springer, 2002.
[12]
G. D. Plotkin and J. Power. Algebraic operations and generic effects. Applied Categorical Structures, 11 (1): 69--94, 2003.
[13]
G. D. Plotkin and M. Pretnar. Handlers of algebraic effects. In ESOP, volume 5502 of Lecture Notes in Computer Science, pages 80--94. Springer, 2009.
[14]
W. Swierstra. Data types à la carte. J. Funct. Program., 18 (4): 423--436, 2008.

Cited By

View all

Recommendations

Comments

Please enable JavaScript to view thecomments powered by Disqus.

Information & Contributors

Information

Published In

cover image ACM SIGPLAN Notices
ACM SIGPLAN Notices  Volume 49, Issue 12
Haskell '14
December 2014
141 pages
ISSN:0362-1340
EISSN:1558-1160
DOI:10.1145/2775050
  • Editor:
  • Andy Gill
Issue’s Table of Contents
  • cover image ACM Conferences
    Haskell '14: Proceedings of the 2014 ACM SIGPLAN symposium on Haskell
    September 2014
    154 pages
    ISBN:9781450330411
    DOI:10.1145/2633357
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].

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 03 September 2014
Published in SIGPLAN Volume 49, Issue 12

Check for updates

Author Tags

  1. Haskell
  2. effect handlers
  3. modularity
  4. monads
  5. semantics
  6. syntax

Qualifiers

  • Research-article

Funding Sources

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)66
  • Downloads (Last 6 weeks)20
Reflects downloads up to 13 Nov 2024

Other Metrics

Citations

Cited By

View all
  • (2024)A framework for higher-order effects & handlersScience of Computer Programming10.1016/j.scico.2024.103086234:COnline publication date: 1-May-2024
  • (2021)Safe mutation with algebraic effectsProceedings of the 14th ACM SIGPLAN International Symposium on Haskell10.1145/3471874.3472988(122-135)Online publication date: 18-Aug-2021
  • (2021)Latent Effects for Reusable Language ComponentsProgramming Languages and Systems10.1007/978-3-030-89051-3_11(182-201)Online publication date: 12-Oct-2021
  • (2020)Compiling symbolic execution with staging and algebraic effectsProceedings of the ACM on Programming Languages10.1145/34282324:OOPSLA(1-33)Online publication date: 13-Nov-2020
  • (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
  • (2019)Handling Local State with Global StateMathematics of Program Construction10.1007/978-3-030-33636-3_2(18-44)Online publication date: 20-Oct-2019
  • (2015)Fusion for FreeMathematics of Program Construction10.1007/978-3-319-19797-5_15(302-322)Online publication date: 9-Jun-2015
  • (2024)Making a Curry Interpreter using Effects and HandlersProceedings of the 17th ACM SIGPLAN International Haskell Symposium10.1145/3677999.3678279(68-82)Online publication date: 29-Aug-2024
  • (2024)Parallel Algebraic Effect HandlersProceedings of the ACM on Programming Languages10.1145/36746518:ICFP(756-788)Online publication date: 15-Aug-2024
  • (2024)Algebraic Effects Meet Hoare Logic in Cubical AgdaProceedings of the ACM on Programming Languages10.1145/36328988:POPL(1663-1695)Online publication date: 5-Jan-2024
  • Show More Cited By

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