Skip to main content

Incremental polymorphic type checking with update

Preliminary version

  • Conference paper
  • First Online:
Logical Foundations of Computer Science — Tver '92 (LFCS 1992)

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

Included in the following conference series:

  • 157 Accesses

Abstract

We describe a variant of Milner's ML type inference algorithm which can be used to perform incremental type checking of programs with partially unspecified functions (or predicates in Prolog). This supports modification (e.g. for correction) of procedures defined previously and provides for a convenient treatment of top-level mutual recursion including Prolog-style incremental clausal definition.

The system allows us to: define a function of, say, type α→α a, use it in suceeding functions and then modify its definition to a type instance, such as list(β x int) → list(β x int), provided that, in the meantime, it has not been used by other functions at an incompatible instance. Undefined procedures can be treated as having type α (or α → β corresponding to the function λx.fail).

This is useful for the case of languages (like HOPE, Miranda, Haskell and Prolog) which require that all top-level procedures are defined mutually recursively — forward references can then be treated as if defined by λx.fail which is then updated when the proper definition is seen. Such languages generally require either top-level mutually recursive phrases to be textually partitioned or require all procedures to have their type declared before their definition or first use — this is because Milner's type inference for recursive definitions is decidable but too weak and because Mycroft's ML+ generalisation is semantically stronger but undecidable in the absence of advance type declarations.

The algorithm presented here allows mutually recursive functions to be type-checked one-by-one (online) with or without type declarations and always gives a type at least as general as the offline algorithm for recursive definitions in ML (or its strongly-connected dependency component variant used in Miranda). With type declarations preceding all forward references it exhibits the decidable type system in HOPE and Prolog.

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. Damas, L. “Type assignment in programming languages”, Ph.D. thesis, Edinburgh University, 1985. Available as Computer Science Report CST-33-85.

    Google Scholar 

  2. Damas L. and Milner, R. “Principal type schemes for functional programs”, Proc. ACM Symp. on Principles of Programming Languages, 1982.

    Google Scholar 

  3. Henglein F., “Type inference and semi-unification”, Proc. ACM Symp. on Lisp and Functional Programming, 1988.

    Google Scholar 

  4. Kfoury, A.J., Tiuryn, J. and Urzyczyn, P. “A proper extension of ML with an effective type discipline”, Proc. ACM Symp. on Principles of Programming Languages, 1988.

    Google Scholar 

  5. Kfoury, A.J., Tiuryn, J. and Urzyczyn, P. “On the computational power of univerally polymorphic recursion” Proc. IEEE Symp. on Logic in Computer Science, 1988.

    Google Scholar 

  6. Kfoury, A.J., Tiuryn, J. and Urzyczyn, P. “The undecidability of the semi-unification problem”, Proc. ACM Symp. on Theory of Computing, 1990.

    Google Scholar 

  7. Milner, R. “A theory of polymorphism in programming”, JCSS 1978.

    Google Scholar 

  8. Mycroft, A. “Polymorphic type schemes and recursive definition”, Proc. Int. Symp. on Programming, Springer-Verlag LNCS vol. 167, 1984.

    Google Scholar 

  9. Mycroft, A. and O'Keefe, R. “A polymorphic type system for Prolog”, Artificial Intelligence, 1984.

    Google Scholar 

  10. Nikhil, R.S. “Practical polymorphism”, Proc. Functional Languages and Computer Architecture, Springer-Verlag LNCS vol. 201, 1985.

    Google Scholar 

  11. Tiuryn, J. “Type inference problems: a survey”, Proc. Math. Foundations of Computer Science, Springer-Verlag LNCS vol. 452, 1990.

    Google Scholar 

  12. Tofte, M. “Operational semantics and polymorphic type inference”, Ph.D. thesis, Edinburgh University, 1988. Available as Computer Science Report CST-52-88.

    Google Scholar 

  13. Turner, D.A. “Miranda: a non-strict functional language with polymorphic types” Proc. Functional Languages and Ccomputer Architecture, Springer-Verlag LNCS vol. 201, 1985.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Anil Nerode Mikhail Taitslin

Rights and permissions

Reprints and permissions

Copyright information

© 1992 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Mycroft, A. (1992). Incremental polymorphic type checking with update. In: Nerode, A., Taitslin, M. (eds) Logical Foundations of Computer Science — Tver '92. LFCS 1992. Lecture Notes in Computer Science, vol 620. Springer, Berlin, Heidelberg. https://doi.org/10.1007/BFb0023888

Download citation

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

  • Published:

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-55707-4

  • Online ISBN: 978-3-540-47276-6

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics