## Representing Layered Monads (1999)

Venue: | PROCEEDINGS OF THE TWENTY-SIXTH ANNUAL ACM SYMPOSIUM ON PRINCIPLES OF PROGRAMMING LANGUAGES |

Citations: | 55 - 2 self |

### BibTeX

@INPROCEEDINGS{Filinski99representinglayered,

author = {Andrzej Filinski},

title = {Representing Layered Monads},

booktitle = {PROCEEDINGS OF THE TWENTY-SIXTH ANNUAL ACM SYMPOSIUM ON PRINCIPLES OF PROGRAMMING LANGUAGES},

year = {1999},

pages = {175--188},

publisher = {ACM Press}

}

### Years of Citing Articles

### OpenURL

### Abstract

There has already been considerable research on constructing modular, monad-based specications of computational effects (state, exceptions, nondeterminism, etc.) in programming languages. We present a simple framework in this tradition, based on a Church-style effect-typing system for an ML-like language. The semantics of this language is formally dened by a series of monadic translations, each one expanding away a layer of effects. Such a layered specication is easy to reason about, but its direct implementation (whether by parameterized interpretation or by actual translation) is often prohibitively inefficient. By exploiting deeper semantic properties of monads, however, it is also possible to derive a vastly more efficient implementation: we show that each layer of eects can be uniformly simulated by continuation-passing, and further that multiple such layers can themselves be simulated by a standard semantics for call/cc and mutable state. Thus, even multi-effect programs can be execu...

### Citations

1562 | The Definition of Standard ML
- Miller, Tofte, et al.
- 1990
(Show Context)
Citation Context .../NJ As suggested by the development, the construction applies directly to a language withsrst-class continuations and state, such as Scheme or SML/NJ. We show it here for the latter (in SML'97 syntax =-=[MTHM97]-=-), using parameterized modules to represent syntactic realizations. Figure 2 is a straightforward encoding of the controloperator construction from Section 3.2. Figure 3 shows a simple implementation ... |

458 | Comprehending Monads
- Wadler
- 1990
(Show Context)
Citation Context ... a monad for all interpretations of the eect e. For example, the formal list monad (used to give a semantics of nondeterminism in Section 4.2) can only be properly layered over a commutative monad [KW93], such as partiality. The component glue can usually be constructed systematically from just the form of T , as follows: T glue T : (1 e ! T) ! T F e ! G t:a:let e f ( t () in f a F n ... |

441 | Computational lambda-calculus and monads
- MOGGI
- 1989
(Show Context)
Citation Context ...possible dynamic interleavings of execution threads. 1 Introduction By now, monads aresrmly established as an key concept in functional programming, both as a semantic framework for ML-like languages =-=[Mog89-=-], and as a structuring technique for purely functional programs with computational eects [Wad92]. But the situation is less clear for the prospect of using monads to structure multiple, potentially i... |

268 | The essence of compiling with continuations - Flanagan, Sabry, et al. - 1993 |

233 | Monad Transformers and Modular Interpreters - Liang, Hudak, et al. - 1995 |

217 | Categories for the working mathematician, volume 5 - Lane - 1998 |

165 |
An Abstract View of Programming Languages
- Moggi
- 1989
(Show Context)
Citation Context ... : T (TA) ! TA. When T is layered over T , we can also dene a computation-inclusion or lifting [LHJ95, Tol98] function family i A = A �� TA : TA ! TA. This is easily checked to be a monad morphism=-= [Mog90-=-], i.e., to satisfy the equations i A (A a) = A a and i B (t 0 ? f) = i A t 0 ? (a: i B (f a)) Conversely, given a monad morphism i : T ! T , we can obtain a layering by A = id TA �� i A . Both f... |

156 |
Revised report on the algorithmic language Scheme
- Clinger, Rees
- 1991
(Show Context)
Citation Context ...imple variation on call=cc, interdenable with both Scheme's and SML/NJ's operators. We usually write !v for get v () and v := E for set v E. The formal semantics of this language is also Scheme-like [KCR98]: we interpret cs as the continuation-state monad, T cs A = A! S !P? cs a = ::a t ? cs f = :: t (a: 0 : f a 0 ) where S = Q v2dom L[[(v)]]. (Note that, since the types in may ... |

130 | Representing monads
- Filinski
- 1994
(Show Context)
Citation Context ...he verication of the additional property of bind is usually straightforward. Given T we construct an extension L T of L, with a new eect t and new proto-operations, monadic re ection and reication [Fil94]: re ect t : T t ! reify t : (1 t ! ) ! T When E : T=n, we often write t (E) : =t for re ect t E; and conversely, when E : =t, [E] t : T=n for reify t (():E). Informally, evaluating ... |

105 | Danvy and Andrzej Filinski. Representing control: A study of the CPS transformation - Olivier - 1992 |

87 | A generic account of continuationpassing styles - Hatcliff, Danvy - 1994 |

67 | Continuation semantics in typed lambda calculi (summary
- Meyer, Wand
- 1985
(Show Context)
Citation Context ... that the translations are equivalent is surprisingly complicated. This was sketched in [Fil94] for a single eect in an otherwise completely pure language; unfortunately the retractionbased approach [=-=MW85]-=- used there does not seem to generalize well to more general settings, such as unrestricted recursion. In [Fil96], the proof was redone with admissible relations in the style of [Rey74], and extended ... |

61 | A generalization of exceptions and control in ML–like languages - Gunter, Remy, et al. - 1995 |

58 | Abstract continuations: A mathematical semantics for handling full functional jumps - Felleisen, Wand, et al. - 1988 |

56 | Danvy and Andrzej Filinski. Abstracting control - Olivier - 1990 |

36 | Semantic Lego - Espinosa - 1995 |

10 |
Controlling E#ects
- Filinski
- 1996
(Show Context)
Citation Context ...ct in an otherwise completely pure language; unfortunately the retractionbased approach [MW85] used there does not seem to generalize well to more general settings, such as unrestricted recursion. In =-=[Fil9-=-6], the proof was redone with admissible relations in the style of [Rey74], and extended to a base language with arbitrary pre-existing eects; and that approach does generalize to the multi-eect langu... |

5 |
Typing continuations in ML
- Duba, Harper, et al.
- 1991
(Show Context)
Citation Context ...on of various computational paradigms using control operators directly, without involving monads at all. Examples include uses of basic call/cc for thread packages [Wan80] and imperative backtracking =-=[HDM93-=-]; simple composable-control [FWFD88, DF92] for nondeterminism and other basic effects, and a number of proposals for hierarchical control [DF90, SF90, GRR95] to represent general layered eects. Most ... |

3 | Extensible denotational language speci - Cartwright, Felleisen - 1994 |