Making Monads First-class with Template Haskell

Pericles S. Kariotis, Adam M. Procter, and William L. Harrison. Proceedings of the ACM SIGPLAN 2008 Haskell Symposium (Haskell '08), Victoria, BC, Canada, September 2008.

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.