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

Monads, zippers and views: virtualizing the monad stack

Published: 19 September 2011 Publication History

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.

Supplementary Material

MP4 File (_talk4.mp4)

References

[1]
D. Baatar, N. Boland, S. Brand, and P. Stuckey. CP and IP approaches to cancer radiotherapy delivery optimization. Constraints, 2011.
[2]
D. Brown and W. R. Cook. Monadic memoization mixins. Technical Report TR-07-11, The University of Texas, 2007.
[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.
[4]
W. R. Cook. A Denotational Semantics of Inheritance. PhD thesis, Brown University, 1989.
[5]
L. Duponcheel. Writing modular interpreters using catamorphisms, subtypes and monad transformers. Technical report, Utrecht University, 1995.
[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.
[7]
A. Filinski. On the relations between monadic semantics. Theor. Comput. Sci., 375: 41--75, April 2007.
[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.
[9]
G. Huet. Functional Pearl: The Zipper. Journal of Functional Programming, 7 (5): 549--554, September 1997.
[10]
M. Jaskelioff. Monatron: An extensible monad transformer library. In IFL '08: Symposium on Implementation and Application of Functional Languages, 2008.
[11]
M. P. Jones and L. Duponcheel. Composing monads. Research Report YALEU/DCS/RR-1004, Yale University, New Haven, Connecticut, USA, December 1993.
[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.
[13]
S. Liang, P. Hudak, and M. Jones. Monad transformers and modular interpreters. In POPL'95, 1995.
[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.
[15]
E. Moggi. An abstract view of programming languages. Technical Report ECS-LFCS-90-113, Edinburgh University, Department of Computer Science, June 1989.
[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.
[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.
[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.
[19]
D. Piponi. Tagging monad transformer layers, 2010. http://blog.sigfpe.com/2010/02/tagging-monad-transformer-layers.html.
[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.
[21]
J. C. Reynolds. Types, abstraction, and parametric polymorphism. Information Processing, 83: 513--523, 1983.
[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.
[23]
T. Schrijvers and B. C. d. S. Oliveira. The monad zipper. Report CW 595, Dept. of Computer Science, K. U. Leuven, 2010.
[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.
[25]
M. Snyder and P. Alexander. Monad factory: Type-indexed monads. In TFP 2010: Preproceedings of Trends in Functional Programming, pages 106--120, 2010.
[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.
[27]
W. Swierstra. Data types à la carte. J. Funct. Program., 18 (4): 423--436, 2008.
[28]
P. Wadler. Views: a way for pattern matching to cohabit with data abstraction. In POPL '87, pages 307--313, 1987.
[29]
P. Wadler. Theorems for free! In Functional Programming Languages and Computer Architecture, pages 347--359. 1989.
[30]
P. Wadler. Monads for functional programming. In Proceedings of the Marktoberdorf Summer School on Program Design Calculi, August 1992.
[31]
P. Wadler. The essence of functional programming. In POPL '92: Principles of Programming Languages, pages 1--14, 1992.
[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.

Cited By

View all
  • (2019)Binders by day, labels by night: effect instances via lexically scoped handlersProceedings of the ACM on Programming Languages10.1145/33711164:POPL(1-29)Online publication date: 20-Dec-2019
  • (2019)Monad transformers and modular algebraic effects: what binds them togetherProceedings of the 12th ACM SIGPLAN International Symposium on Haskell10.1145/3331545.3342595(98-113)Online publication date: 8-Aug-2019
  • (2019)Modular effects in Haskell through effect polymorphism and explicit dictionary applications: a new approach and the μVeriFast verifier as a case studyProceedings of the 12th ACM SIGPLAN International Symposium on Haskell10.1145/3331545.3342589(1-14)Online publication date: 8-Aug-2019
  • Show More Cited By

Recommendations

Comments

Information & Contributors

Information

Published In

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

Sponsors

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 19 September 2011

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. components with side effects
  2. modularity
  3. monad transformers
  4. zipper

Qualifiers

  • Research-article

Conference

ICFP '11
Sponsor:

Acceptance Rates

ICFP '11 Paper Acceptance Rate 33 of 92 submissions, 36%;
Overall Acceptance Rate 333 of 1,064 submissions, 31%

Upcoming Conference

ICFP '25
ACM SIGPLAN International Conference on Functional Programming
October 12 - 18, 2025
Singapore , Singapore

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)8
  • Downloads (Last 6 weeks)1
Reflects downloads up to 03 Mar 2025

Other Metrics

Citations

Cited By

View all
  • (2019)Binders by day, labels by night: effect instances via lexically scoped handlersProceedings of the ACM on Programming Languages10.1145/33711164:POPL(1-29)Online publication date: 20-Dec-2019
  • (2019)Monad transformers and modular algebraic effects: what binds them togetherProceedings of the 12th ACM SIGPLAN International Symposium on Haskell10.1145/3331545.3342595(98-113)Online publication date: 8-Aug-2019
  • (2019)Modular effects in Haskell through effect polymorphism and explicit dictionary applications: a new approach and the μVeriFast verifier as a case studyProceedings of the 12th ACM SIGPLAN International Symposium on Haskell10.1145/3331545.3342589(1-14)Online publication date: 8-Aug-2019
  • (2016)Effect capabilities for HaskellScience of Computer Programming10.1016/j.scico.2015.11.010119:C(3-30)Online publication date: 1-Apr-2016
  • (2015)Gradual certified programming in coqACM SIGPLAN Notices10.1145/2936313.281671051:2(26-40)Online publication date: 21-Oct-2015
  • (2015)Gradual certified programming in coqProceedings of the 11th Symposium on Dynamic Languages10.1145/2816707.2816710(26-40)Online publication date: 21-Oct-2015
  • (2015)How functional programming matteredNational Science Review10.1093/nsr/nwv0422:3(349-370)Online publication date: 13-Jul-2015
  • (2014)Effective Aspects: A Typed Monadic Embedding of Pointcuts and AdviceTransactions on Aspect-Oriented Software Development XI10.1007/978-3-642-55099-7_5(145-192)Online publication date: 2014
  • (2013)Compilation à la CarteProceedings of the 25th symposium on Implementation and Application of Functional Languages10.1145/2620678.2620680(13-24)Online publication date: 28-Aug-2013
  • (2013)Extensible effectsACM SIGPLAN Notices10.1145/2578854.250379148:12(59-70)Online publication date: 23-Sep-2013
  • Show More Cited By

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Figures

Tables

Media

Share

Share

Share this Publication link

Share on social media