## Modular monad transformers (2009)

Venue: | In ESOP ’09: Proceedings of the 18th European Symposium on Programming Languages and Systems |

Citations: | 9 - 3 self |

### BibTeX

@INPROCEEDINGS{Jaskelioff09modularmonad,

author = {Mauro Jaskelioff},

title = {Modular monad transformers},

booktitle = {In ESOP ’09: Proceedings of the 18th European Symposium on Programming Languages and Systems},

year = {2009},

pages = {64--79},

publisher = {Springer-Verlag}

}

### OpenURL

### Abstract

Abstract. During the last two decades, monads have become an indispensable tool for structuring functional programs with computational effects. In this setting, the mathematical notion of a monad is extended with operations that allow programmers to manipulate these effects. When several effects are involved, monad transformers can be used to build up the required monad one effect at a time. Although this seems to be modularity nirvana, there is a catch: in addition to the construction of a monad, the effect-manipulating operations need to be lifted to the resulting monad. The traditional approach for lifting operations is nonmodular and ad-hoc. We solve this problem with a principled technique for lifting operations that makes monad transformers truly modular. 1

### Citations

1363 | The Essence of Functional Programming
- Wadler
- 1992
(Show Context)
Citation Context ...onad transformers truly modular. 1 Introduction Since monads were introduced by Moggi [13, 14] to model computational effects, they have proven to be extremely useful to structure functional programs =-=[20, 19, 9]-=-. Monads are usually accompanied with operations that manipulate the effects they model. For example, an exception monad may come with operations for throwing an exception and for handling it, and a s... |

772 | Notions of computation and monads
- Moggi
- 1991
(Show Context)
Citation Context ...ns is nonmodular and ad-hoc. We solve this problem with a principled technique for lifting operations that makes monad transformers truly modular. 1 Introduction Since monads were introduced by Moggi =-=[13, 14]-=- to model computational effects, they have proven to be extremely useful to structure functional programs [20, 19, 9]. Monads are usually accompanied with operations that manipulate the effects they m... |

558 | Lambda calculi with types
- Barendregt
- 1992
(Show Context)
Citation Context ...ad we mean expressible monad in F ω (and similarly for other category-theoretic notions). 2 Preliminaries We work with system F ω and its equational theory induced by βη-equivalence (for details, see =-=[1, 5]-=-). One may replace F ω with a weaker system, like HML [6] (which distinguishes types from type schemas), or a stronger system, like CC [4]. To fix the notation, we recall the syntax of F ω kinds type ... |

501 |
The calculus of constructions
- Coquand, Huet
- 1988
(Show Context)
Citation Context ...ational theory induced by βη-equivalence (for details, see [1, 5]). One may replace F ω with a weaker system, like HML [6] (which distinguishes types from type schemas), or a stronger system, like CC =-=[4]-=-. To fix the notation, we recall the syntax of F ω kinds type constuctors terms k ::= ∗ | k → k U ::= X | U → U | ∀X : k. U | ΛX : k. U | U U e ::= x | λx: X. e | ΛX : k. e | e U We write eU for e U (... |

468 | Comprehending monads
- Wadler
- 1990
(Show Context)
Citation Context ...onad transformers truly modular. 1 Introduction Since monads were introduced by Moggi [13, 14] to model computational effects, they have proven to be extremely useful to structure functional programs =-=[20, 19, 9]-=-. Monads are usually accompanied with operations that manipulate the effects they model. For example, an exception monad may come with operations for throwing an exception and for handling it, and a s... |

460 | Computational lambda-calculus and monads
- Moggi
- 1989
(Show Context)
Citation Context ...ns is nonmodular and ad-hoc. We solve this problem with a principled technique for lifting operations that makes monad transformers truly modular. 1 Introduction Since monads were introduced by Moggi =-=[13, 14]-=- to model computational effects, they have proven to be extremely useful to structure functional programs [20, 19, 9]. Monads are usually accompanied with operations that manipulate the effects they m... |

250 | Monad Transformers and Modular Interpreters
- Liang, Hudak, et al.
(Show Context)
Citation Context ... associated to it. In order to combine computational effects, one must combine monads. There are many ways of combining monads: distributive laws [2], coproduct of monads [11], and monad transformers =-=[10, 15, 3]-=-. However, these technologies fall short in combining monads with operations, as they only provide means to combine monads. Liang et al. [10] identified this problem more than a decade ago and propose... |

187 |
Basic Category Theory for Computer Scientists
- Pierce
- 1991
(Show Context)
Citation Context ...ns, such as functors, natural transformations, monads, monad transformers. Familiarity with these notions is not needed to understand the rest of the paper, but interested readers may want to look at =-=[16, 3]-=-.Definition 2 (Functor [18]). The set Functor of functors consists of pairs ˆF = (F, map F ), where F : ∗ → ∗ is a type constructor and map F : Map(F ) ˆ= ∀X, Y : ∗. (X → Y ) → F X → F Y is a term su... |

135 | Higher-order modules and the phase distinction
- HARPER, MITCHELL, et al.
- 1990
(Show Context)
Citation Context ... category-theoretic notions). 2 Preliminaries We work with system F ω and its equational theory induced by βη-equivalence (for details, see [1, 5]). One may replace F ω with a weaker system, like HML =-=[6]-=- (which distinguishes types from type schemas), or a stronger system, like CC [4]. To fix the notation, we recall the syntax of F ω kinds type constuctors terms k ::= ∗ | k → k U ::= X | U → U | ∀X : ... |

54 | Monads and Effects
- Benton, Hughes, et al.
- 2002
(Show Context)
Citation Context ... associated to it. In order to combine computational effects, one must combine monads. There are many ways of combining monads: distributive laws [2], coproduct of monads [11], and monad transformers =-=[10, 15, 3]-=-. However, these technologies fall short in combining monads with operations, as they only provide means to combine monads. Liang et al. [10] identified this problem more than a decade ago and propose... |

44 |
Categories for the Working Mathematician. Number 5
- Lane
- 1971
(Show Context)
Citation Context ... (λx: X. (f x)Z k) lift K ˆ M,X (m: MX): KMX ˆ= ΛY : ∗.λk : X →MY.bind M X,Y (m, k) Remark 24. The monad transformer ˆ K is related to the construction of the condensity monad for an endofunctor (see =-=[12]-=-). In what follows, we use only some properties of ˆ K, which are provable by simple calculations in system F ω. Thus, we do not exploit in full the universal property of the codensity monad. ⊓⊔�� ��... |

32 | Combining effects: Sum and tensor
- Hyland, Plotkin, et al.
- 2006
(Show Context)
Citation Context ...n an ad-hoc manner, and therefore the number of liftings of operation grows like the product of the number of monad transformers and operations involved (see Section 3.) More recently, Plotkin et al. =-=[17, 7]-=- have proposed to look at monads induced by algebraic theories, and to address the problem of combining monads (and associated operations) as a problem of combining algebraic theories. Their approach ... |

24 | Composing Monads Using Coproducts
- Lüth, Ghani
- 2002
(Show Context)
Citation Context ...d. ˆ M is algeDefinition 15 (Algebraic ˆ Σ-operation). A ˆ Σ-operation op for braic provided that for every f : A→MB and t: Σ(MA) bind M A,B(op A t, f) = op B(map Σ MA,MB(λm: MA. bind M A,B(m, f)) t) =-=(11)-=- or equivalently, that the following diagram commutes: map Σ bind M (−,f) Σ(MA) Σ(MB) op A op B �� MA � MB bind M (−,f) Remark 16. The notion of algebraic operation given in [17] corresponds to algebr... |

23 |
Toposes, Triples and Theories, volume 278 of Grundleheren der math
- Barr, Wells
- 1985
(Show Context)
Citation Context ...really working with is a monad and a set of operations associated to it. In order to combine computational effects, one must combine monads. There are many ways of combining monads: distributive laws =-=[2]-=-, coproduct of monads [11], and monad transformers [10, 15, 3]. However, these technologies fall short in combining monads with operations, as they only provide means to combine monads. Liang et al. [... |

16 | On functors expressible in the polymorphic typed lambda calculus
- Reynolds, Plotkin
- 1990
(Show Context)
Citation Context ...tion) and we often write definitions gX(x: A) ˆ= t when we mean g ˆ= ∀X : ∗. λx: A. t. We often write term application using a tuple, that is, we write t (z1, . . . , zn) for t z1 . . . zn. Following =-=[18]-=- we express in the setting of F ω several category-theoretic notions, such as functors, natural transformations, monads, monad transformers. Familiarity with these notions is not needed to understand ... |

12 | Monatron: An extensible monad transformer library
- Jaskelioff
- 2008
(Show Context)
Citation Context ...rations. The current design of monad transformer libraries is based on the traditional approach to operation lifting which has other problems besides non-modularity. The experimental library Monatron =-=[8]-=- implements a new design which not only lifts operations uniformly, but also avoids many of these problems. There are several possible directions for further research: – The lifting of ˆ Σ-operations ... |

12 | Metalanguages and applications
- Moggi
- 1997
(Show Context)
Citation Context ... associated to it. In order to combine computational effects, one must combine monads. There are many ways of combining monads: distributive laws [2], coproduct of monads [11], and monad transformers =-=[10, 15, 3]-=-. However, these technologies fall short in combining monads with operations, as they only provide means to combine monads. Liang et al. [10] identified this problem more than a decade ago and propose... |

10 | Semantics for algebraic operations
- Plotkin, Power
- 2001
(Show Context)
Citation Context ...n an ad-hoc manner, and therefore the number of liftings of operation grows like the product of the number of monad transformers and operations involved (see Section 3.) More recently, Plotkin et al. =-=[17, 7]-=- have proposed to look at monads induced by algebraic theories, and to address the problem of combining monads (and associated operations) as a problem of combining algebraic theories. Their approach ... |

2 |
Eta-expansions in F-omega
- Ghani
- 1996
(Show Context)
Citation Context ...ad we mean expressible monad in F ω (and similarly for other category-theoretic notions). 2 Preliminaries We work with system F ω and its equational theory induced by βη-equivalence (for details, see =-=[1, 5]-=-). One may replace F ω with a weaker system, like HML [6] (which distinguishes types from type schemas), or a stronger system, like CC [4]. To fix the notation, we recall the syntax of F ω kinds type ... |