Skip to main content

Optimizing ML using a hierarchy of monadic types

  • Conference paper
  • First Online:

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 1473))

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 a variety 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.

Supported, in part, by the US Air Force Materiel Command under contract F19628-93-C-0069 and by the National Science Foundation under grant CCR-9503383.

This is a preview of subscription content, log in via an institution.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. A. Appel. Compiling with Continuations. Cambridge University Press, 1992.

    Google Scholar 

  2. A. Appel. Loop headers in λ-calculus or CPS. Lisp and Symbolic Computation, 7(4): 337–343, 1994.

    Article  Google Scholar 

  3. N. Benton, July 1997. Personal communication.

    Google Scholar 

  4. L. Birkedal, M. Tofte, and M. Vejlstrup. From region inference to von Neumann machines via region representation inference. In 23rd ACM Symposium on Principles of Programming Languages (POPL’96), pages 171–183. ACM Press, 1996.

    Google Scholar 

  5. C. Flanagan, A. Sabry, B. F. Duba, and M. Felleisen. The essence of compiling with continuations. Proc. SIGPLAN Conference on Programming Language Design and Implementation, 28(6): 237–247, June 1993.

    Google Scholar 

  6. D. Gifford, P. Jouvelot, J. Lucassen, and M. Sheldon. FX-87 REFERENCE MANUAL. Technical Report MIT-LCS//MIT/LCS/TR-407, Massachusetts Institute of Technology, Laboratory for Computer Science, Sept. 1987.

    Google Scholar 

  7. R. Kieburtz and J. Launchbury. Encapsulated effects. (unpublished manuscript), Oct. 1995.

    Google Scholar 

  8. R. Kieburtz and J. Launchbury. Towards algebras of encapsulated effects. (unpublished manuscript), 1997.

    Google Scholar 

  9. J. Launchbury and S. Peyton Jones. State in Haskell. Lisp and Symbolic Computation, pages 293–351, Dec. 1995.

    Google Scholar 

  10. S. Liang, P. Hudak, and M. Jones. Monad transformers and modular interpreters. In 22nd ACM Symposium on Principles of Programming Languages (POPL ’95), Jan. 1995.

    Google Scholar 

  11. S. Peyton Jones, J. Launchbury, M. Shields, and A. Tolmach. Bridging the gulf: a common intermediate language for ml and haskel. In 25th ACM Symposium on Principles of Programming Languages (POPL’98), pages 49–61, San Diego, Jan 1998.

    Google Scholar 

  12. S. Peyton Jones and J. Launchbury. Unboxed values as first class citizens. In Proc. Functional Programming Languages and Computer Architecture (FPCA ’91), pages 636–666, Sept. 191.

    Google Scholar 

  13. S. Peyton Jones and P. Wadler. Imperative functional programming. In 20th ACM Symposium on Principles of Programming Languages (POPL’93), pages 71–84, Jan. 1993.

    Google Scholar 

  14. S. Peyton Jones. Compiling Haskell by program transformation: A report from the trenches. In Proceedings of ESOP’96, volume 1058 of Lecture Notes in Computer Science, pages 18–44. Springer Verlag, 1996.

    Google Scholar 

  15. J.-P. Talpin and P. Jouvelot. Polymorphic type, region and effect inference. Journal of Functional Programming, 2: 245–271, 1992.

    Article  MATH  MathSciNet  Google Scholar 

  16. J.-P. Talpin and P. Jouvelot. The type and effect discipline. Information and Computation, 111(2): 245–296, June 1994.

    Article  MATH  MathSciNet  Google Scholar 

  17. D. Tarditi. Design and Implementation of Code Optimizations for a Type-Directed Compiler for Standard ML. PhD thesis, Carnegie Mellon University, Dec. 1996. Technical Report CMU-CS-97-108.

    Google Scholar 

  18. M. Tofte and J.-P. Talpin. Region-based memory management. Information and Computation, 132(2): 109–176, 1 Feb. 1997.

    Article  MATH  MathSciNet  Google Scholar 

  19. A. Tolmach and D. Oliva. From ML to Ada: Strongly-typed language interoperability via source trans lation. Journal of Functional Programming, 1998. (to appear).

    Google Scholar 

  20. P. Wadler. The marriage of effects and monads. (unpublished manuscript), Mar. 1998.

    Google Scholar 

  21. A. Wright. Typing references by effect inference. In Proc. 4th European Symposium on Programming (ESOP ’92), volume 582 of Lecture Notes in Computer Science, Feb. 1992.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Xavier Leroy Atsushi Ohori

Rights and permissions

Reprints and permissions

Copyright information

© 1998 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Tolmach, A. (1998). Optimizing ML using a hierarchy of monadic types. In: Leroy, X., Ohori, A. (eds) Types in Compilation. TIC 1998. Lecture Notes in Computer Science, vol 1473. Springer, Berlin, Heidelberg. https://doi.org/10.1007/BFb0055514

Download citation

  • DOI: https://doi.org/10.1007/BFb0055514

  • Published:

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-64925-0

  • Online ISBN: 978-3-540-68308-7

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics