skip to main content
10.1145/1706299.1706354acmconferencesArticle/Chapter ViewAbstractPublication PagespoplConference Proceedingsconference-collections
research-article

Monads in action

Published:17 January 2010Publication History

ABSTRACT

In functional programming, monadic characterizations of computational effects are normally understood denotationally: they describe how an effectful program can be systematically expanded or translated into a larger, pure program, which can then be evaluated according to an effect-free semantics. Any effect-specific operations expressible in the monad are also given purely functional definitions, but these definitions are only directly executable in the context of an already translated program. This approach thus takes an inherently Church-style view of effects: the nominal meaning of every effectful term in the program depends crucially on its type.

We present here a complementary, operational view of monadic effects, in which an effect definition directly induces an imperative behavior of the new operations expressible in the monad. This behavior is formalized as additional operational rules for only the new constructs; it does not require any structural changes to the evaluation judgment. Specifically, we give a small-step operational semantics of a prototypical functional language supporting programmer-definable, layered effects, and show how this semantics naturally supports reasoning by familiar syntactic techniques, such as showing soundness of a Curry-style effect-type system by the progress+preservation method.

References

  1. Robert Cartwright and Matthias Felleisen. Extensible denotational language specifications. In Masami Hagiya and John C. Mitchell, editors, Symposium on Theoretical Aspects of Computer Software, volume 789 of Lecture Notes in Computer Science, pages 244--272, Sendai, Japan, April 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Karl Crary and Robert Harper. Syntactic logical relations for polymorphic and recursive types. Electronic Notes in Theoretical Computer Science, 172, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Matthias Felleisen and Robert Hieb. The revised report on the syntactic theories of sequential control and state. Theoretical Computer Science, 103(2):235--271, September 1992. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Andrzej Filinski. Representing layered monads. In Proceedings of the 26th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 175--188, San Antonio, Texas, January 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Andrzej Filinski. On the relations between monadic semantics. Theoretical Computer Science, 375(1-3):41--75, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Andrzej Filinski and Kristian Støvring. Inductive reasoning about effectful data types. In ICFP'07: Proceedings of the 2007 ACM SIGPLAN International Conference on Functional Programming, pages 97--110. ACM Press, October 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Marcelo Fiore and Gordon D. Plotkin. An axiomatisation of computationally adequate domain theoretic models of FPC. In Proceedings of the Ninth Symposium on Logic in Computer Science, pages 92--102, Paris, France, 1994.Google ScholarGoogle ScholarCross RefCross Ref
  8. Carl A. Gunter, Didier Remy, and Jon G. Riecke. A generalization of exceptions and control in ML-like languages. In Functional Programming and Computer Architecture, pages 12--23, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Oleg Kiselyov, Chung chieh Shan, and Amr Sabry. Delimited dynamic binding. In ICFP'06: Proceedings of the 11th International Conference on Functional Programming, pages 26--37, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Paul Blain Levy. Call-by-push-value: Decomposing call-by-value and call-by-name. Higher-Order and Symbolic Computation, 19(4):377--414, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Saunders Mac Lane. Categories for the Working Mathematician, volume 5 of Graduate Texts in Mathematics. Springer-Verlag, 1971.Google ScholarGoogle Scholar
  12. Eugenio Moggi. Computational lambda-calculus and monads. In Proceedings of the Fourth Annual Symposium on Logic in Computer Science, pages 14--23, Pacific Grove, California, June 1989. IEEE. Google ScholarGoogle ScholarCross RefCross Ref
  13. Luc Moreau. A syntactic theory of dynamic binding. Higher-Order and Symbolic Computation, 11(3):233--279, 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Peter D. Mosses. Modular structural operational semantics. Journal of Logic and Algebraic Programming, 60-61:195--228, 2004.Google ScholarGoogle ScholarCross RefCross Ref
  15. Frank Pfenning. Substructural operational semantics and linear destination-passing style (abstract). In Proceedings of the 2nd Asian Symposium on Programming Languages and Systems (APLAS'04), volume 3302 of Lecture Notes in Computer Science, page 196, 2004.Google ScholarGoogle ScholarCross RefCross Ref
  16. Frank Pfenning and Carsten Schurmann. System description: Twelf - a meta-logical framework for deductive systems. In 16th International Conference on Automated Deduction, volume 1632 of Lecture Notes in Computer Science, pages 202--206, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Benjamin Pierce. Types and Programming Languages. MIT Press, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Gordon D. Plotkin and John Power. Algebraic operations and generic effects. Applied Categorical Structures, 11(1):69--94, 2003.Google ScholarGoogle ScholarCross RefCross Ref
  19. Gordon D. Plotkin and Matija Pretnar. Handlers of algebraic effects. In 18th European Symposium on Programming, volume 5502 of Lecture Notes in Computer Science, pages 80--94, March 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. Philip Wadler. Comprehending monads. In Proceedings of the 1990 ACM Conference on Lisp and Functional Programming, pages 61--78, Nice, France, June 1990. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. Andrew K. Wright and Matthias Felleisen. A syntactic approach to type soundness. Information and Computation, 115(1):38--94, 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Monads in action

        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
          POPL '10: Proceedings of the 37th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languages
          January 2010
          520 pages
          ISBN:9781605584799
          DOI:10.1145/1706299
          • cover image ACM SIGPLAN Notices
            ACM SIGPLAN Notices  Volume 45, Issue 1
            POPL '10
            January 2010
            500 pages
            ISSN:0362-1340
            EISSN:1558-1160
            DOI:10.1145/1707801
            Issue’s Table of Contents

          Copyright © 2010 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 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]

          Publisher

          Association for Computing Machinery

          New York, NY, United States

          Publication History

          • Published: 17 January 2010

          Permissions

          Request permissions about this article.

          Request Permissions

          Check for updates

          Qualifiers

          • research-article

          Acceptance Rates

          Overall Acceptance Rate824of4,130submissions,20%

          Upcoming Conference

          POPL '25

        PDF Format

        View or Download as a PDF file.

        PDF

        eReader

        View online with eReader.

        eReader