Skip to main content

A type system for a lambda calculus with assignments

  • Conference paper
  • First Online:
Theoretical Aspects of Computer Software (TACS 1994)

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

Included in the following conference series:

Abstract

We present a Hindley/Milner-style polymorphic type system for λvar, an extension of the call-by-name λ-calculus with mutable variables and assignments. To match λvar's explicit distinction between functional and imperative worlds, the type universe is stratified into two layers: one for applicative expressions and one for imperative state transformers. In inferring types for λvar-terms, the type system performs a simple effect analysis to statically verify the safety of coercing a state transformer to a pure value. We prove the soundness of the type system with respect to λvar's untyped reduction semantics so that any well-typed program will evaluate to an answer, provided the evaluation terminates. We also discuss some practical aspects of the type system and present a type checker based on the well-known W algorithm.

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

Access this chapter

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Andrew W. Appel and David B. MacQueen. A standard ML compiler. In Functional Programming and Computer Architecture, pages 301–324, August 1987. LNCS 274.

    Google Scholar 

  2. H. Barendregt. The Lambda Calculus: Its Syntax and Semantics, volume 103 of Studies in Logic and the Foundations of Mathematics. North-Holland, 1984.

    Google Scholar 

  3. Luis Damas. Type assignment in programming languages. PhD thesis, Department of Computer Science, Edinburgh University, April 1985.

    Google Scholar 

  4. L. Damas and Robin Milner. Principal type schemes for functional programs. In Proceedings of the Ninth ACM Symposium on Principles of Programming Languages, pages 207–212, January 1982.

    Google Scholar 

  5. My Hoang, John Mitchell, and Ramesh Viswanathan. Standard ML-NJ weak polymorphism and imperative constructs. In Eighth Annual IEEE Symposium on Logic in Computer Science, pages 15–25, June 1993.

    Google Scholar 

  6. Xavier Leroy. Polymorphism by name for references and continuations. In Proc. of 20th ACM Symp. on Principles of Programming Languages, pages 220–231, January 1993.

    Google Scholar 

  7. Xavier Leroy and Pierre Weis. Polymorphic type inference and assignment. In Proc. of the 18th ACM Symp. on Principles of Programming Languages, pages 291–302, January 1991.

    Google Scholar 

  8. Harry G. Mairson. Quantifier elimination and parametric polymorphism in programming languages. To appear in the J. of Functional Programming, 1993.

    Google Scholar 

  9. Robin Milner. A theory of type polymorphism in programming. J. Computer and System Sciences, 17:348–375, 1978.

    Google Scholar 

  10. Martin Odersky, Dan Rabin, and Paul Hudak. Call by name, assignment, and the lambda calculus. In Proc. of 20th ACM Symp. on Principles of Programming Languages, January 1993.

    Google Scholar 

  11. John C.Reynolds. Preliminary design of the programming language forsythe. Technical Report CMU-CS-88-159, Carnegie Mellon University, June 1988.

    Google Scholar 

  12. V. Swarup, U. Reddy, and E. Ireland. Assignments for applicative languages. In J. Hughes, editor, Proc. 5th ACM Conf. on Functional Programming and Computer Architecture, pages 192–214, August 1991. LNCS 582.

    Google Scholar 

  13. Jean-Pierre Talpin and Pierre Jouvelot. Polymorphic type, region and effect inference. To appear in the J. of Functional Programming, 1993.

    Google Scholar 

  14. Jean-Pierre Talpin and Pierre Jouvelot. The type and effect discipline. To appear in the J. of Information and Computation, 1994.

    Google Scholar 

  15. Mads Tofte. Type inference for polymorphic references. Information and Computation, 89(1):1–34, November 1990.

    Google Scholar 

  16. Philip Wadler. The essence of functional programming. In Proc. 19th ACM Symposium on Principles of Programming Languages, pages 1–14, January 1992.

    Google Scholar 

  17. Andrew K. Wright and Matthias Felleisen. A syntactic approach to type soundness. Technical Report TR91-160, Department of Computer Science, Rice University, March 1992.

    Google Scholar 

  18. Stephen Weeks and Matthias Felleisen. On the orthogonality of assignments and procedures in Algol. In Proc. of 20th ACM Symp. on Principles of Programming Languages, January 1993.

    Google Scholar 

  19. Andrew K. Wright. Typing references by effect inferences. In B. Krieg-Brückner, editor, Prod. European Symposium on Programming, pages 473–491, February 1992. LNCS 582.

    Google Scholar 

  20. Andrew K. Wright. Polymorphism for imperative languages without imperative types. Technical Report TR93-200, Rice University, February 1993.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Masami Hagiya John C. Mitchell

Rights and permissions

Reprints and permissions

Copyright information

© 1994 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Chen, K., Odersky, M. (1994). A type system for a lambda calculus with assignments. In: Hagiya, M., Mitchell, J.C. (eds) Theoretical Aspects of Computer Software. TACS 1994. Lecture Notes in Computer Science, vol 789. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-57887-0_103

Download citation

  • DOI: https://doi.org/10.1007/3-540-57887-0_103

  • Published:

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-57887-1

  • Online ISBN: 978-3-540-48383-0

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics