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.
Supplemental Material
- D. Baatar, N. Boland, S. Brand, and P. Stuckey. CP and IP approaches to cancer radiotherapy delivery optimization. Constraints, 2011. Google Scholar
Digital Library
- D. Brown and W. R. Cook. Monadic memoization mixins. Technical Report TR-07-11, The University of Texas, 2007.Google Scholar
- 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 Scholar
- W. R. Cook. A Denotational Semantics of Inheritance. PhD thesis, Brown University, 1989. Google Scholar
Digital Library
- L. Duponcheel. Writing modular interpreters using catamorphisms, subtypes and monad transformers. Technical report, Utrecht University, 1995.Google Scholar
- 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 Scholar
Digital Library
- A. Filinski. On the relations between monadic semantics. Theor. Comput. Sci., 375: 41--75, April 2007. Google Scholar
Digital Library
- 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 Scholar
Digital Library
- G. Huet. Functional Pearl: The Zipper. Journal of Functional Programming, 7 (5): 549--554, September 1997. Google Scholar
Digital Library
- M. Jaskelioff. Monatron: An extensible monad transformer library. In IFL '08: Symposium on Implementation and Application of Functional Languages, 2008. Google Scholar
Digital Library
- M. P. Jones and L. Duponcheel. Composing monads. Research Report YALEU/DCS/RR-1004, Yale University, New Haven, Connecticut, USA, December 1993.Google Scholar
- 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 Scholar
Digital Library
- S. Liang, P. Hudak, and M. Jones. Monad transformers and modular interpreters. In POPL'95, 1995. Google Scholar
Digital Library
- 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 Scholar
Digital Library
- E. Moggi. An abstract view of programming languages. Technical Report ECS-LFCS-90-113, Edinburgh University, Department of Computer Science, June 1989.Google Scholar
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- D. Piponi. Tagging monad transformer layers, 2010. http://blog.sigfpe.com/2010/02/tagging-monad-transformer-layers.html.Google Scholar
- 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 Scholar
- J. C. Reynolds. Types, abstraction, and parametric polymorphism. Information Processing, 83: 513--523, 1983.Google Scholar
- 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 Scholar
- T. Schrijvers and B. C. d. S. Oliveira. The monad zipper. Report CW 595, Dept. of Computer Science, K. U. Leuven, 2010.Google Scholar
- 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 Scholar
Digital Library
- M. Snyder and P. Alexander. Monad factory: Type-indexed monads. In TFP 2010: Preproceedings of Trends in Functional Programming, pages 106--120, 2010. Google Scholar
Digital Library
- 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 Scholar
Digital Library
- W. Swierstra. Data types à la carte. J. Funct. Program., 18 (4): 423--436, 2008. Google Scholar
Digital Library
- P. Wadler. Views: a way for pattern matching to cohabit with data abstraction. In POPL '87, pages 307--313, 1987. Google Scholar
Digital Library
- P. Wadler. Theorems for free! In Functional Programming Languages and Computer Architecture, pages 347--359. 1989. Google Scholar
Digital Library
- P. Wadler. Monads for functional programming. In Proceedings of the Marktoberdorf Summer School on Program Design Calculi, August 1992.Google Scholar
- P. Wadler. The essence of functional programming. In POPL '92: Principles of Programming Languages, pages 1--14, 1992. Google Scholar
Digital Library
- 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 Scholar
Digital Library
Index Terms
Monads, zippers and views: virtualizing the monad stack
Recommendations
Monads, zippers and views: virtualizing the monad stack
ICFP '11: Proceedings of the 16th ACM SIGPLAN international conference on Functional programmingWe 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 ...
Programming monads operationally with Unimo
Proceedings of the 2006 ICFP conferenceMonads are widely used in Haskell for modeling computational effects, but defining monads remains a daunting challenge. Since every part of a monad's definition depends on its computational effects, programmers cannot leverage the common behavior of all ...
Programming monads operationally with Unimo
ICFP '06: Proceedings of the eleventh ACM SIGPLAN international conference on Functional programmingMonads are widely used in Haskell for modeling computational effects, but defining monads remains a daunting challenge. Since every part of a monad's definition depends on its computational effects, programmers cannot leverage the common behavior of all ...







Comments