## General Terms

### BibTeX

@MISC{Kariotis_generalterms,

author = {Pericles S. Kariotis and Adam M. Procter and William L. Harrison},

title = {General Terms},

year = {}

}

### OpenURL

### 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.

### Citations

1353 | Introduction to Functional Programming
- Bird, Wadler
- 1988
(Show Context)
Citation Context ...ing on an interpreter for a simple functional language, we show that MonadLab makes it very easy to add new “layers” of semantic features to the language. We start with the familiar interpreter from (=-=Wadler 1992-=-), and extend it with mutable state, then with output, and finally with non-deterministic choice. Each successive extension requires only a small iterative change to the monad specification, and strai... |

254 | Multi-stage programming with explicit annotations
- Taha, Sheard
(Show Context)
Citation Context ...ork The MonadLab compiler relies on Template Haskell’s meta-programming constructs to generate monad implementations. Template Haskell’s meta-programming capabilities are weaker than those of MetaML (=-=Taha and Sheard 2000-=-) and MetaOCaml 2 in that Template Haskell programs have (at most) two stages and MetaML and MetaOCaml support arbitrary staging levels. While Haskell code is being constructed in processing the first... |

248 | Monad transformers and modular interpreters
- Liang, Hudak, et al.
- 1995
(Show Context)
Citation Context .... A Tag is an identifier. Supported monad transformers include StateT, EnvT, WriterT, ErrorT, and ContT, along with the List and Id base monads. These are equivalent to the transformers described in (=-=Liang et al. 1995-=-) and in the MTL. MonadLab supports other monad transformers (in particular, resumption monad transformers (Papaspyrou 2001; Harrison and Hook 2008)) that will not be discussed in this paper. Figure 1... |

51 | Wobbly types: type inference for generalised algebraic data types. Microsoft Research - Jones, Washburn, et al. - 2004 |

47 | Programming in Haskell - Hutton - 2007 |

37 | Data types à la carte
- Swierstra
(Show Context)
Citation Context ...equire revision and recompilation of existing functions. One approach to the expression problem builds modular data types through the explicit encoding of a co-product in Haskell (Weaver et al. 2007; =-=Swierstra 2008-=-). The advantage of this approach is that the modular construction of data types is type-checked. MonadLab sidesteps the expression problem via the generate-then-type-check paradigm followed by Templa... |

30 | Modular Monadic Semantics and Compilation
- Liang
- 1998
(Show Context)
Citation Context ...pecification. While monad transformers always produce monads, there are certain cases in which the behavior of the extra “non-proper” morphisms defined on a monad depends on the order of application (=-=Liang 1998-=-) and the MTL requires users to grasp this somewhat arcane material. MonadLab incorporates this domain knowledge, thereby freeing users from such considerations. The MTL is not well-suited to multiple... |

24 | Composing Monads Using Coproducts
- Lüth, Ghani
- 2002
(Show Context)
Citation Context ...dify the monadic underpinnings of these kernels in a source language. There have recently been a number of proposed categorical alternatives to monad transformers as a structure for combining monads (=-=Lüth and Ghani 2002-=-; Power 2006). Some of these (especially Lüth and Ghani, 2002) would seem to be an attractive target representation for MonadLab, although we have not explored this approach as of this writing. Anothe... |

14 |
The expression problem
- Wadler
- 1998
(Show Context)
Citation Context ...nimo encodes the syntax of monadic operations with generalized data types (Peyton Jones et al. 2004) and then encapsulates the semantics of monads in an evaluation function. The “expression problem” (=-=Wadler 1998-=-) concerns the difficulty of extending data types with new constructors in a manner that does not require revision and recompilation of existing functions. One approach to the expression problem build... |

12 | A Resumption Monad Transformer and its Applications in the Semantics of Concurrency
- Papaspyrou
(Show Context)
Citation Context ...and Id base monads. These are equivalent to the transformers described in (Liang et al. 1995) and in the MTL. MonadLab supports other monad transformers (in particular, resumption monad transformers (=-=Papaspyrou 2001-=-; Harrison and Hook 2008)) that will not be discussed in this paper. Figure 1 shows some sample MonadLab programs. A monad program consists of one or more <Monad> declarations and related data declara... |

7 | Achieving information flow security through monadic control of effects. Invited submission to - Harrison, Hook |

7 | Programming monads operationally with unimo
- Lin
- 2006
(Show Context)
Citation Context ...would seem to be an attractive target representation for MonadLab, although we have not explored this approach as of this writing. Another approach, based in operational semantics, is taken by Unimo (=-=Lin 2006-=-). Unimo encodes the syntax of monadic operations with generalized data types (Peyton Jones et al. 2004) and then encapsulates the semantics of monads in an evaluation function. The “expression proble... |

5 | Generic models for computational effects - Power - 2006 |

3 | Unrolling and simplifying expressions with Template Haskell. http://web.comlab.ox.ac.uk /oucl/work/ian.lynagh/papers
- Lynagh
- 2003
(Show Context)
Citation Context ...e quasiquotation and splice operators. For a more detailed description of Template Haskell, please refer to the bibliography. In particular, there are a number of Template Haskell experience reports (=-=Lynagh 2003-=-a,b; Seefried et al. 2004) and a useful reference guide (Sheard and Peyton Jones 2003). 3.1 Code Representation Types To facilitate the manipulation of code, TH provides a set of algebraic data types ... |

2 |
Template haskell: A report from the field
- Lynagh
- 2003
(Show Context)
Citation Context ...e quasiquotation and splice operators. For a more detailed description of Template Haskell, please refer to the bibliography. In particular, there are a number of Template Haskell experience reports (=-=Lynagh 2003-=-a,b; Seefried et al. 2004) and a useful reference guide (Sheard and Peyton Jones 2003). 3.1 Code Representation Types To facilitate the manipulation of code, TH provides a set of algebraic data types ... |

2 | Notes on template haskell version 2 - Sheard, Jones - 2003 |

1 |
Code Repository for MonadLab
- Kariotis
- 2008
(Show Context)
Citation Context ... requires only a small iterative change to the monad specification, and straightforward extensions to the interpreter code. Source code for all of the interpreters described here is available online (=-=Kariotis 2008-=-). Each interpreter presented here is composed of two parts: the monad specification (in file InterpMonad.mlab), and the interpreter code (in file Interp.hs). The code for the core interpreter is show... |

1 | Optimising Embedded DSLs using Template - Seefried, Chakravarty, et al. - 2002 |