## Optimizing ML Using a Hierarchy of Monadic Types (1998)

### Cached

### Download Links

- [www-internal.cse.ogi.edu]
- [www.cs.pdx.edu]
- DBLP

### Other Repositories/Bibliography

Venue: | WORKSHOP ON TYPES IN COMPILATION, KYOTO |

Citations: | 13 - 0 self |

### BibTeX

@INPROCEEDINGS{Tolmach98optimizingml,

author = {Andrew Tolmach},

title = {Optimizing ML Using a Hierarchy of Monadic Types},

booktitle = {WORKSHOP ON TYPES IN COMPILATION, KYOTO},

year = {1998},

pages = {97--113},

publisher = {Springer Verlag}

}

### Years of Citing Articles

### OpenURL

### Abstract

We describe a type system and typed semantics that use a hierarchy of monads to describe and delimit a variety of effects, including non-termination, exceptions, and state, in a call-by-value functional language. The type system and semantics can be used to organize and justify avariety of optimizing transformations in the presence of effects. In addition, we describe a simple monad inferencing algorithm that computes the minimum effect for each subexpression of a program, and provides more accurate effects information than local syntactic methods.

### Citations

1314 | Introduction to Functional Programming
- Bird, Wadler
- 1988
(Show Context)
Citation Context ...ne obtain the power of side-e ecting operations without invalidating simple \equational reasoning" based on (Beta) and similar rules? The e ective solution discovered in that context is to use mo=-=nads [9, 14]-=-. An obvious idea, therefore, is to use monads in an internal representation (IR) for compilers of call-by-value languages. Some initial steps in this direction were recently taken by Peyton Jones, La... |

620 |
Compiling with continuations
- Appel
- 1992
(Show Context)
Citation Context ... algorithm for annotating source program subexpressions with their minimal e ect. Past approaches to coping with e ects have fallen into two main camps. One approach (used, e.g., by SML of New Jersey =-=[1]-=- and the TIL compiler [17]) is to fall back onaweaker form of (Beta), called (Betav), which is valid in eager settings. (Betav) restricts the bound expression e to variables, constants, and -abstracti... |

280 | Region-based memory management
- Tofte, Talpin
- 1997
(Show Context)
Citation Context ...in e3.spolymorphic generalization rules (e.g., as in [21, 16]), or to perform signi cantly more sophisticated optimizations, such as automatic parallelization [6] or stackallocation of heap-like data =-=[18]-=-. In support of these goals, e ect inference has generally been used to track store e ects at a ne-grained level. Our approach is essentially a simple monomorphic variant of e ect inference applied to... |

269 | The essence of compiling with continuations
- FLANAGAN, SABRY, et al.
- 1993
(Show Context)
Citation Context ... y describes an ML-like source language we use to explain our approach. The call-by-value source language is presented in Fig. 1. It is a simple, monomorphic variant of ML, expressed in A-normal form =-=[5]-=-, which names the result of each computation and makes evaluation order completely explicit. The class const includes primitive functions as well as constants. The Let construct is monomorphic; that i... |

234 | Monad transformers and modular interpreters
- Liang, Hudak, et al.
- 1995
(Show Context)
Citation Context ...1 <m2implies that there exists an unique embedding up m1!m2 which, for every value type t, maps M[m1 ](T [t]) to M[m2 ](T [t]). The up functions, sometimes called monad morphisms or lifting functions =-=[10]-=-, obey these laws: (Unit) up m1!m2 unitm1 = unitm2 (Bind) up m1!m2 (bindm1 ek)=bindm2 (up m1!m2 e)(up m1!m2 k) The up functions can also be viewed as generalizations of unit operations, since, by (Uni... |

153 | P.: The type and effect discipline
- Talpin, Jouvelot
- 1992
(Show Context)
Citation Context ...f e1 is expensive to compute and x appears many times in e2 ; similarly, (RecHoist) (oriented left-to-right) is not improving if f is not applied in e3 . polymorphic generalization rules (e.g., as in =-=[21, 16]-=-), or to perform significantly more sophisticated optimizations, such as automatic parallelization [6] or stackallocation of heap-like data [18]. In support of these goals, effect inference has genera... |

121 | Polymorphic type, region, and effect inference
- Talpin, Jouvelot
- 1992
(Show Context)
Citation Context ...lysis can be quite effective, particularly if the compiler inlines functions enthusiastically. The other approach (used, e.g., by the ML Kit compiler [4]) uses a sophisticated effect inference system =-=[15]-=- to track the latent effects of functions on a very detailed basis. The goals of this school are typically more far-reaching; the aim is to use effects information to provide more generous 1 Of course... |

89 | From region inference to von Neumann machines via region representation inference
- Birkedal, Tofte, et al.
- 1996
(Show Context)
Citation Context ...impure and non-terminating. Still, this form of analysis can be quite e ective, particularly if the compiler inlines functions enthusiastically. The other approach (used, e.g., by the ML Kit compiler =-=[4]-=-) uses a sophisticated e ect inference system [15] to track the latent e ects of functions on a very detailed basis. The goals of this school are typically more far-reaching; the aim is to use e ects ... |

65 | From ML to Ada: Strongly-Typed Language Interoperability via Source Translation
- Tolmach, Oliva
- 1998
(Show Context)
Citation Context ...stantiations for monad variables. Supporting this form of monad polymorphism seems desirable even if there is no type polymorphism (e.g., because the program has already been explicitly monomorphized =-=[19]-=-). In whole-program compilation of a monad-polymorphic program, the complete set of e ect instantiations for each polymorphic de nition would be known. This set could be used to put an upper e ect bou... |

55 | Compiling haskell by program transformation: a report from the trenches
- Jones
- 1996
(Show Context)
Citation Context ...93-C-0069 and by the National Science Foundation under grant CCR-9503383.sorientation of the equation generates a valid transformation. 1 E ective compilers for pure, lazy functional languages (e.g., =-=[11]-=-) have been conceived and built on the basis of such transformations, with considerable advantages for modularity and correctness. It would be nice to apply similar methods to the optimization of lang... |

49 | Design and Implementation of Code Optimizations for a Type-Directed Compiler for Standard ML
- Tarditi
- 1996
(Show Context)
Citation Context ... source program subexpressions with their minimal e ect. Past approaches to coping with e ects have fallen into two main camps. One approach (used, e.g., by SML of New Jersey [1] and the TIL compiler =-=[17]) is -=-to fall back onaweaker form of (Beta), called (Betav), which is valid in eager settings. (Betav) restricts the bound expression e to variables, constants, and -abstractions; since \evaluating" th... |

30 |
Unboxed values as first-class citizens
- Jones, S, et al.
- 1991
(Show Context)
Citation Context ...ery primitive would return a value in ST. Peyton Jones et al. [13] suggest performing such a translation, and then using the monad laws (analogous to those in Fig. 9) and the worker-wrapper transform =-=[12]-=- to simplify the result, hopefully resulting in some less-effectful expression bindings. The main objection to this approach is that it doesn't allow calls to unknown functions (for which worker-wrapp... |

26 | Typing references by effect inference
- Wright
- 1992
(Show Context)
Citation Context ...f e1 is expensive to compute and x appears many times in e2 ; similarly, (RecHoist) (oriented left-to-right) is not improving if f is not applied in e3 . polymorphic generalization rules (e.g., as in =-=[21, 16]-=-), or to perform significantly more sophisticated optimizations, such as automatic parallelization [6] or stackallocation of heap-like data [18]. In support of these goals, effect inference has genera... |

19 | Bridging the gulf: a common intermediate language for ML and Haskell
- Jones, Launchbury, et al.
- 1998
(Show Context)
Citation Context ...s to use monads in an internal representation (IR) for compilers of call-by-value languages. Some initial steps in this direction were recently taken by Peyton Jones, Launchbury, Shields, and Tolmach =-=[13]-=-. The aim of that work was to design an IR suitable for both eager and lazy source languages. In this paper we pursue the use of monads with particular reference to eager languages (only), and address... |

10 |
Polymorphic Type, Region and E ect Inference
- Talpin, Jouvelot
- 1992
(Show Context)
Citation Context ...nalysis can be quite e ective, particularly if the compiler inlines functions enthusiastically. The other approach (used, e.g., by the ML Kit compiler [4]) uses a sophisticated e ect inference system =-=[15]-=- to track the latent e ects of functions on a very detailed basis. The goals of this school are typically more far-reaching; the aim is to use e ects information to provide more generous 1 Of course, ... |

10 |
The type and e ect discipline
- Talpin, Jouvelot
- 1992
(Show Context)
Citation Context ... if e1 is expensive to compute and x appears many times in e2; similarly, (RecHoist) (oriented left-to-right) is not improving if f is not applied in e3.spolymorphic generalization rules (e.g., as in =-=[21, 16]-=-), or to perform signi cantly more sophisticated optimizations, such as automatic parallelization [6] or stackallocation of heap-like data [18]. In support of these goals, e ect inference has generall... |

5 |
Typing References by E ect Inference
- Wright
- 1992
(Show Context)
Citation Context ... if e1 is expensive to compute and x appears many times in e2; similarly, (RecHoist) (oriented left-to-right) is not improving if f is not applied in e3.spolymorphic generalization rules (e.g., as in =-=[21, 16]-=-), or to perform signi cantly more sophisticated optimizations, such as automatic parallelization [6] or stackallocation of heap-like data [18]. In support of these goals, e ect inference has generall... |

4 |
Loop headers in -calculus or cps
- Appel
- 1994
(Show Context)
Citation Context ...may seem a crude way tocharacterize functions guaranteed to be called at least once, and unlikely to appear in practice, it arises naturally if we systematically introduce loop headers for recursions =-=[2]-=-, according to the following law: (Hdr) Letrec(f ,x,e1,e2):M(m,t) = Let(ID,m,f ,Abs(z,Letrec(f 0 ,x,e1[f 0 =f],App(f 0 ,z))),e2) (f 0 62 FV(e1); f 0 6= z) (HandleHoistExn) says that an expression that... |

4 |
Unboxed values as rstclass citizens
- Jones, Launchbury
- 1991
(Show Context)
Citation Context ...ery primitive would return a value in ST. Peyton Jones et al. [13] suggest performing such a translation, and then using the monad laws (analogous to those in Fig. 9) and the worker-wrapper transform =-=[12]-=- to simplify the result, hopefully resulting in some less-e ectful expression bindings. The main objection to this approach is that it doesn't allow calls to unknown functions (for which worker-wrappe... |

1 |
Encapsulated e ects. (unpublished manuscript
- Kieburtz, Launchbury
- 1995
(Show Context)
Citation Context ...imply the de nition for other pairs of monads.sAcknowledgements We have bene tted from conversations with John Launchbury and Dick Kieburtz, and from exposure to the ideas in their unpublished papers =-=[7, 8]-=-. The comments of the anonymous referees also motivated us to clarify the relationship of our algorithm with the existing work of Talpin and Jouvelot. Phil Wadler made helpful commments on an earlier ... |

1 |
Towards algebras of encapsulated e ects. (unpublished manuscript
- Kieburtz, Launchbury
- 1997
(Show Context)
Citation Context ...imply the de nition for other pairs of monads.sAcknowledgements We have bene tted from conversations with John Launchbury and Dick Kieburtz, and from exposure to the ideas in their unpublished papers =-=[7, 8]-=-. The comments of the anonymous referees also motivated us to clarify the relationship of our algorithm with the existing work of Talpin and Jouvelot. Phil Wadler made helpful commments on an earlier ... |

1 |
The marriage of e ects and monads. (unpublished manuscript
- Wadler
(Show Context)
Citation Context ... advantage of the monadic semantics is that it provides a natural foundation for probing and proving the correctness of transformations in the presence of a variety of e ects. In related work, Wadler =-=[20]-=- has recently and independently shown that Talpin and Jouvelot's e ect inference system can be applied in a monadic framework; he uses an untyped semantics, and considers only store e ects. In another... |

1 |
Encapsulated effects. (unpublished manuscript
- Kieburtz, Launchbury
- 1995
(Show Context)
Citation Context ...ply the definition for other pairs of monads. Acknowledgements We have benefitted from conversations with John Launchbury and Dick Kieburtz, and from exposure to the ideas in their unpublished papers =-=[7, 8]-=-. The comments of the anonymous referees also motivated us to clarify the relationship of our algorithm with the existing work of Talpin and Jouvelot. Phil Wadler made helpful commments on an earlier ... |

1 |
Towards algebras of encapsulated effects. (unpublished manuscript
- Kieburtz, Launchbury
- 1997
(Show Context)
Citation Context ...ply the definition for other pairs of monads. Acknowledgements We have benefitted from conversations with John Launchbury and Dick Kieburtz, and from exposure to the ideas in their unpublished papers =-=[7, 8]-=-. The comments of the anonymous referees also motivated us to clarify the relationship of our algorithm with the existing work of Talpin and Jouvelot. Phil Wadler made helpful commments on an earlier ... |

1 |
The marriage of effects and monads. (unpublished manuscript
- Wadler
(Show Context)
Citation Context ...advantage of the monadic semantics is that it provides a natural foundation for probing and proving the correctness of transformations in the presence of a variety of effects. In related work, Wadler =-=[20]-=- has recently and independently shown that Talpin and Jouvelot's effect inference system can be applied in a monadic framework; he uses an untyped semantics, and considers only store effects. In anoth... |