ABSTRACT
Monads as an organizing principle for programming and semantics are notoriously difficult to grasp, yet they are a central and powerful abstraction in Haskell. This paper introduces a domain-specific language, MonadLab, that simplifies the construction of monads, and describes its implementation in Template Haskell. MonadLab makes monad construction truly first class, meaning that arcane theoretical issues with respect to monad transformers are completely hidden from the programmer. The motivation behind the design of MonadLab is to make monadic programming in Haskell simpler while providing a tool for non-Haskell experts that will assist them in understanding this powerful abstraction.
Supplemental Material
Available for Download
- William Harrison and James Hook. Achieving information flow security through monadic control of effects. Invited submission to: Journal of Computer Security, 2008. 46 pages. Accepted for Publication. Google Scholar
Digital Library
- Graham Hutton. Programming in Haskell. Cambridge University Press, January 2007. Google Scholar
Digital Library
- Pericles Kariotis. Code Repository for MonadLab. June 2008. Available from http://monadgarden.cs.missouri.edu/MonadLab.Google Scholar
- Sheng Liang. Modular Monadic Semantics and Compilation. PhD thesis, Yale University, 1998. Google Scholar
Digital Library
- Sheng Liang, Paul Hudak, and Mark Jones. Monad transformers and modular interpreters. In Proceedings of the 22nd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL), pages 333--343. ACM Press, 1995. Google Scholar
Digital Library
- Chuan-Kai Lin. Programming monads operationally with Unimo. In International Conference on Functional Programming ICFP'06, pages 274--285, 2006. Google Scholar
Digital Library
- Christoph Lüth and Neil Ghani. Composing monads using coproducts. In International Conference on Functional Programming ICFP'02, pages 133--144. ACM Press, September 2002. Google Scholar
Digital Library
- Ian Lynagh. Template Haskell: A report from the field. May 2003.Google Scholar
- Ian Lynagh. Unrolling and simplifying expressions with Template Haskell. May 2003.Google Scholar
- Nikos S. Papaspyrou. A Resumption Monad Transformer and its Applications in the Semantics of Concurrency. In Proceedings of the 3rd Panhellenic Logic Symposium, 2001. Expanded version available as a tech. report from the author by request.Google Scholar
- Simon Peyton Jones, Geoffrey Washburn, and Stephanie Weirich. Wobbly types: type inference for generalised algebraic data types. Technical Report MS-CIS-05-26, University of Pennsylvania, Computer and Information Science Department, Levine Hall, 3330 Walnut Street, Philadelphia, Pennsylvania, 19104-6389, July 2004.Google Scholar
- John Power. Generic models for computational effects. Theoretical Computer Science, 364 (2): 254--269, 2006. Google Scholar
Digital Library
- Sean Seefried, Manuel Chakravarty, and Gabriele Keller. Optimising Embedded DSLs using Template Haskell. URL: http://www.cse.unsw.edu.au/~sseefried/papers.html, March 2004.Google Scholar
- Tim Sheard and Simon Peyton Jones. Template metaprogramming for Haskell. In Manuel M. T. Chakravarty, editor, ACM SIGPLAN Haskell Workshop 02, pages 1--16. ACM Press, October 2002. Google Scholar
Digital Library
- Tim Sheard and Simon Peyton Jones. Notes on Template Haskell version 2. November 2003.Google Scholar
- Wouter Swierstra. Data types à la carte. Journal of Functional Programming, 18 (4): 423--436, July 2008. Google Scholar
Digital Library
- Walid Taha and Tim Sheard. Metaml and multi-stage programming with explicit annotations. Theoretical Computer Science, 248 (1-2): 211--242, 2000. Google Scholar
Digital Library
- Phillip Wadler. The essence of functional programming. In Proceedings of the 19th Symposium on Principles of Programming Languages (POPL), pages 1--14. ACM Press, 1992. Google Scholar
Digital Library
- Phillip Wadler. The expression problem. November 1998. Available from www.daimi.au.dk/~madst/tool/papers/expression.txt.Google Scholar
- Philip Weaver, Garrin Kimmell, Nicolas Frisby, and Perry Alexander. Modular and generic programming with InterpreterLib. In ASE '07: Proceedings of the twenty-second IEEE/ACM International Conference on Automated Software Engineering, pages 473--476, New York, NY, USA, 2007. ACM. ISBN 978-1-59593-882-4. http://doi.acm.org/10.1145/1321631.1321712. Google Scholar
Digital Library
Index Terms
Making monads first-class with template haskell
Recommendations
Template meta-programming for Haskell
Haskell '02: Proceedings of the 2002 ACM SIGPLAN workshop on HaskellWe propose a new extension to the purely functional programming language Haskell that supports compile-time meta-programming. The purpose of the system is to support the algorithmic construction of programs at compile-time.The ability to generate code ...
Making monads first-class with template haskell
HASKELL '08Monads as an organizing principle for programming and semantics are notoriously difficult to grasp, yet they are a central and powerful abstraction in Haskell. This paper introduces a domain-specific language, MonadLab, that simplifies the construction ...
Modular Compilers Based on Monad Transformers
ICCL '98: Proceedings of the 1998 International Conference on Computer LanguagesThe monadic style of language specification has the advantages of modularity and extensibility: it is simple to add or change features in an interpreter to reflect modifications in the source language. It has proven difficult to extend the method to ...







Comments