skip to main content
research-article

Monads, zippers and views: virtualizing the monad stack

Published:19 September 2011Publication History
Skip Abstract Section

Abstract

We make monadic components more reusable and robust to changes by employing two new techniques for virtualizing the monad stack: the monad zipper and monad views. The monad zipper is a higher-order monad transformer that creates virtual monad stacks by ignoring particular layers in a concrete stack. Monad views provide a general framework for monad stack virtualization: they take the monad zipper one step further and integrate it with a wide range of other virtualizations. For instance, particular views allow restricted access to monads in the stack. Furthermore, monad views provide components with a call-by-reference-like mechanism for accessing particular layers of the monad stack.

With our two new mechanisms, the monadic effects required by components no longer need to be literally reflected in the concrete monad stack. This makes these components more reusable and robust to changes.

Skip Supplemental Material Section

Supplemental Material

_talk4.mp4

References

  1. D. Baatar, N. Boland, S. Brand, and P. Stuckey. CP and IP approaches to cancer radiotherapy delivery optimization. Constraints, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. D. Brown and W. R. Cook. Monadic memoization mixins. Technical Report TR-07-11, The University of Texas, 2007.Google ScholarGoogle Scholar
  3. P. Cenciarelli and E. Moggi. A syntactic approach to modularity in denotational semantics. In CCTCS '93: Proceedings of the Conference on Category Theory and Computer Science, 1993.Google ScholarGoogle Scholar
  4. W. R. Cook. A Denotational Semantics of Inheritance. PhD thesis, Brown University, 1989. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. L. Duponcheel. Writing modular interpreters using catamorphisms, subtypes and monad transformers. Technical report, Utrecht University, 1995.Google ScholarGoogle Scholar
  6. A. Filinski. Representing layered monads. In Proceedings of the 26th ACM SIGPLAN-SIGACT symposium on Principles of programming languages, POPL '99, pages 175--188, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. A. Filinski. On the relations between monadic semantics. Theor. Comput. Sci., 375: 41--75, April 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. A. Filinski. Monads in action. In Proceedings of the 37th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languages, POPL '10, pages 483--494, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. G. Huet. Functional Pearl: The Zipper. Journal of Functional Programming, 7 (5): 549--554, September 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. M. Jaskelioff. Monatron: An extensible monad transformer library. In IFL '08: Symposium on Implementation and Application of Functional Languages, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. M. P. Jones and L. Duponcheel. Composing monads. Research Report YALEU/DCS/RR-1004, Yale University, New Haven, Connecticut, USA, December 1993.Google ScholarGoogle Scholar
  12. O. Kiselyov, R. Lämmel, and K. Schupke. Strongly typed heterogeneous collections. In Haskell 04: Proceedings of the ACM SIGPLAN workshop on Haskell, pages 96--107, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. S. Liang, P. Hudak, and M. Jones. Monad transformers and modular interpreters. In POPL'95, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. J. M. Lucassen and D. K. Gifford. Polymorphic effect systems. In Proceedings of the 15th ACM SIGPLAN-SIGACT symposium on Principles of programming languages, POPL '88, pages 47--57, 1988. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. E. Moggi. An abstract view of programming languages. Technical Report ECS-LFCS-90-113, Edinburgh University, Department of Computer Science, June 1989.Google ScholarGoogle Scholar
  16. B. C. d. S. Oliveira, A. Moors, and M. Odersky. Type classes as objects and implicits. In OOPSLA '10:Proceedings of the ACM international conference on Object oriented programming systems languages and applications, pages 341--360, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. B. C. d. S. Oliveira, T. Schrijvers, and W. R. Cook. Effectiveadvice: Disciplined advice with explicit effects. In AOSD '10: ACM SIG Proceedings of the 9th International Conference on Aspect-Oriented Software Development, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. S. Peyton Jones et al. The Haskell 98 language and libraries: The revised report. Journal of Functional Programming, 13 (1): 0--255, Jan 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. D. Piponi. Tagging monad transformer layers, 2010. http://blog.sigfpe.com/2010/02/tagging-monad-transformer-layers.html.Google ScholarGoogle Scholar
  20. C. Prehofer. Flexible construction of software components: A feature oriented approach. Habilitation Thesis, Fakultät für Informatik der Technischen Universität München, 1999.Google ScholarGoogle Scholar
  21. J. C. Reynolds. Types, abstraction, and parametric polymorphism. Information Processing, 83: 513--523, 1983.Google ScholarGoogle Scholar
  22. T. Schrijvers and B. C. d. S. Oliveira. Modular components with monadic effects. In Preproceedings of the 22nd Symposium on Implementation and Application of Functional Languages (IFL 2010), number UU-CS-2010-020, pages 264--277, 2010.Google ScholarGoogle Scholar
  23. T. Schrijvers and B. C. d. S. Oliveira. The monad zipper. Report CW 595, Dept. of Computer Science, K. U. Leuven, 2010.Google ScholarGoogle Scholar
  24. T. Schrijvers, G. Tack, P. Wuille, H. Samulowitz, and P. Stuckey. Search combinators. In Proceedings of the 17th International Conference on Principles and Practice of Constraint Programming, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. M. Snyder and P. Alexander. Monad factory: Type-indexed monads. In TFP 2010: Preproceedings of Trends in Functional Programming, pages 106--120, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. G. L. Steele, Jr. Building interpreters by composing monads. In POPL '94: Proceedings of the 21st ACM SIGPLAN-SIGACT symposium on Principles of programming languages, pages 472--492, 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. W. Swierstra. Data types à la carte. J. Funct. Program., 18 (4): 423--436, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. P. Wadler. Views: a way for pattern matching to cohabit with data abstraction. In POPL '87, pages 307--313, 1987. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. P. Wadler. Theorems for free! In Functional Programming Languages and Computer Architecture, pages 347--359. 1989. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. P. Wadler. Monads for functional programming. In Proceedings of the Marktoberdorf Summer School on Program Design Calculi, August 1992.Google ScholarGoogle Scholar
  31. P. Wadler. The essence of functional programming. In POPL '92: Principles of Programming Languages, pages 1--14, 1992. Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. P. Wadler and S. Blott. How to make ad-hoc polymorphism less ad hoc. In POPL '89: Proceedings of the 16th ACM SIGPLAN-SIGACT symposium on Principles of programming languages, pages 60--76, 1989. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Monads, zippers and views: virtualizing the monad stack

    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 46, Issue 9
      ICFP '11
      September 2011
      456 pages
      ISSN:0362-1340
      EISSN:1558-1160
      DOI:10.1145/2034574
      Issue’s Table of Contents
      • cover image ACM Conferences
        ICFP '11: Proceedings of the 16th ACM SIGPLAN international conference on Functional programming
        September 2011
        470 pages
        ISBN:9781450308656
        DOI:10.1145/2034773

      Copyright © 2011 ACM

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      • Published: 19 September 2011

      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!