skip to main content
research-article

Effect handlers in scope

Published:03 September 2014Publication History
Skip Abstract Section

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.Google ScholarGoogle Scholar
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. M. Hyland, G. D. Plotkin, and J. Power. Combining effects: Sum and tensor. Theor. Comput. Sci., 357 (1--3): 70--99, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. M. Jaskelioff and E. Moggi. Monad transformers as monoid transformers. Theor. Comput. Sci., 411 (51--52): 4441--4466, Dec. 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. S. Liang, P. Hudak, and M. Jones. Monad transformers and modular interpreters. In POPL'95, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. kC. McBride. The Frank manual, May 2012. https://personal.cis.strath.ac.uk/conor.mcbride/pub/Frank/TFM.pdf.Google ScholarGoogle Scholar
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. G. D. Plotkin and J. Power. Algebraic operations and generic effects. Applied Categorical Structures, 11 (1): 69--94, 2003.Google ScholarGoogle ScholarCross RefCross Ref
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. W. Swierstra. Data types à la carte. J. Funct. Program., 18 (4): 423--436, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Effect handlers in scope

    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

    • 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

      Copyright © 2014 ACM

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      • Published: 3 September 2014

      Check for updates

      Qualifiers

      • research-article

    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!