ABSTRACT
Monads 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 monads easily and thus must build from scratch each monad that models a new computational effect.I propose the Unimo framework which allows programmers to define monads and monad transformers in a modular manner. Unimo contains a heavily parameterized observer function which enforces the monad laws, and programmers define a monad by invoking the observer function with arguments that specify the computational effects of the monad. Since Unimo provides the common behavior of all monads in a reusable form, programmers no longer need to rebuild the semantic boilerplate for each monad and can instead focus on the more interesting and rewarding task of modeling the desired computational effects.
- Koen Claessen. Functional Pearl: Parallel parsing processes. Journal of Functional Programming, 14(6):741--757, November 2004. Google ScholarDigital Library
- William Harrison and James Hook. Achieving information flow security through precise control of effects. In 18th IEEE Computer Security Foundations Workshop, pages 16--30, Los Alamitos, CA, USA, June 2005. IEEE Computer Society. Google ScholarDigital Library
- Ralf Hinze. Deriving backtracking monad transformers. In Proceedings of the Fifth ACM SIGPLAN International Conference on Functional Programming, pages 186--197, New York, NY, USA, September 2000. ACM Press. Google ScholarDigital Library
- John Hughes. The design of a pretty-printing library. In Johan Jeuring and Eric Meijer, editors, Advanced Functional Programming: First International Spring School on Advanced Functional Programming Techniques, volume 925 of LNCS, pages 53--96. Springer, May 1995. Google ScholarDigital Library
- John Hughes. Generalizing monads to arrows. Science of Computer Programming, 37:67--111, May 2000. Google ScholarDigital Library
- Simon Peyton Jones. Tackling the awkward squad: monadic input/output, concurrency, exceptions, and foreign-language calls in Haskell. In CAR Hoare, Manfred Broy, and Ralf Steinbruggen, editors, Engineering Theories of Software Construction, volume 180 of NATO Science Series: Computer & Systems Sciences, pages 47--96. IOS Press, 2001.Google Scholar
- Simon Peyton Jones, editor. Haskell 98 Language and Libraries: The Revised Report. Cambridge University Press, Cambridge, UK, May 2003.Google Scholar
- Simon Peyton Jones and Mark Shields. Lexically scoped type variables. Submitted to ICFP 2004, March 2004.Google Scholar
- Simon Peyton Jones, Dimitrios Vytiniotis, Stephanie Weirich, and Mark Shields. Practical type inference for arbitrary-rank types. Unpublished manuscript, July 2005.Google Scholar
- Simon Peyton Jones, Geoffrey Washburn, and Stephanie Weirich. Wobbly types: type inference for generalized algebraic data types. Technical Report MS-CIS-05-26, University of Pennsylvania, July 2004.Google Scholar
- Guy L. Steele Jr. and Richard P. Gabriel. The evolution of Lisp. ACM SIGPLAN Notices, 28(3):231--270, March 1993. Google ScholarDigital Library
- Gregor Kiczales, Erik Hilsdale, Jim Hugunin, Mik Kersten, Jeffrey Palm, and William G. Griswold. An overview of AspectJ. In ECOOP 2001 - Object-Oriented Programming: 15th European Conference, volume 2072 of LNCS, pages 327--353. Springer-Verlag, June 2001. Google ScholarDigital Library
- Gregor Kiczales, John Lamping, Anurag Mendhekar, Chris Maeda, Cristina Videira Lopes, Jean-Marc Loingtier, and John Irwin. Aspect-oriented programming. In Proceedings of the 11th European Conference on Object-Oriented Programming, volume 1241 of LNCS, pages 220--242. Springer-Verlag, June 1997.Google ScholarCross Ref
- Sheng Liang, Paul Hudak, and Mark P. Jones. Monad transformers and modular interpreters. In Proceedings of the 22nd ACMSIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 333--343, New York, NY, USA, January 1995. ACM Press. Google ScholarDigital Library
- Wolfgang De Meuter. Monads as a theoretical foundation for AOP. Position paper in ECOOP'97 Workshop on Aspect-Oriented Programming, June 1997.Google Scholar
- Eugenio Moggi. Computational lambda-calculus and monads. In Proceedings of the Fourth Symposium on Logic in Computer Science, pages 14--23, Piscataway, NJ, USA, June 1989. IEEE Press. Google ScholarDigital Library
- Eugenio Moggi. Notions of computation and monads. Information And Computation, 93(1):55--92, July 1991. Google ScholarDigital Library
- Peter D. Mosses. Denotational semantics. In Handbook of Theoretical Computer Science, Volume B: Formal Models and Semantics, chapter 11, pages 575--631. MIT Press, December 1990. Google ScholarDigital Library
- Martin Reiser and Niklaus Wirth. Programming in Oberon: Steps Beyond Pascal and Modula. Addison Wesley, Reading, MA, USA, June 1992. Google Scholar
- Niklaus Wirth. Project Oberon: The Design of an Operating System and Compiler. Addison-Wesley, Reading, MA, USA, November 1992. Google ScholarDigital Library
Index Terms
- Programming monads operationally with Unimo
Recommendations
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 ...
Coproducts of Monads on Set
LICS '12: Proceedings of the 2012 27th Annual IEEE/ACM Symposium on Logic in Computer ScienceCoproducts of monads on $\Set$ have arisen in both the study of computational effects and universal algebra. We describe coproducts of consistent monads on $\Set$ by an initial algebra formula, and prove also the converse: if the coproduct exists, so do ...
Idioms are Oblivious, Arrows are Meticulous, Monads are Promiscuous
We revisit the connection between three notions of computation: Moggi s monads, Hughes s arrows and McBride and Paterson s idioms (also called applicative functors). We show that idioms are equivalent to arrows that satisfy the type isomorphism A B 1 (A ...
Comments