skip to main content
10.1145/2633357.2633358acmconferencesArticle/Chapter ViewAbstractPublication PagesicfpConference Proceedingsconference-collections
research-article

Effect handlers in scope

Published:03 September 2014Publication 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.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
    • Published in

      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
      • 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

      Copyright © 2014 ACM

      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: 3 September 2014

      Permissions

      Request permissions about this article.

      Request Permissions

      Check for updates

      Qualifiers

      • research-article

      Acceptance Rates

      Haskell '14 Paper Acceptance Rate12of28submissions,43%Overall Acceptance Rate57of143submissions,40%

      Upcoming Conference

      ICFP '24

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader