Skip to main content

On the Unification of Substitutions in Type Inference

  • Conference paper
  • First Online:

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

Abstract

The response of compilers to programs with type errors can be unpredictable and confusing. In part this is because the point at which type inference fails may not be the point at which the programmer has made a mistake. This paper explores a way of making type inference algorithms fail at different locations in programs so that clearer error messages may then be produced.

Critical to the operation of type inference algorithms is their use of substitutions. We will see that the way in which substitutions are applied in type inference algorithm W means that errors are detected towards the right-hand side of expressions. This paper introduces a new operation — unification of substitutions — which allows greater control over the use of substitutions so that this bias can be removed.

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

Buying options

Chapter
USD   29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD   39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD   54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Learn about institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. M. Beaven and R. Stansifer. Explaining Type Errors in Polymorphic Languages. ACM Letters on Programming Languages and Systems, 2(1):17–30, March 1993.

    Article  Google Scholar 

  2. K.L. Bernstein and E.W. Stark. Debugging Type Errors (Full version). Technical report, State University of New York at Stony Brook, Computer Science Department, November 1995. http://www.cs.sunysb.edu/~stark/REPORTS/INDEX.html.

  3. L. Cardelli. Basic Polymorphic Type-Checking. Science of Computer Programming, 8(2):147–172, 1987.

    Article  MATH  MathSciNet  Google Scholar 

  4. L.M.M. Damas. Type Assignment in Programming Languages. PhD thesis, Department of Computer Science, The University of Edinburgh, April 1985. CST-33-85.

    Google Scholar 

  5. L.M.M. Damas and A.J.R.G. Milner. Principal Type-Schemes for Functional Programs. In Proc. 9th. ACM Symposium on Principles of Programming Languages (POPL’ 82), pages 207–212, 1982.

    Google Scholar 

  6. D. Duggan and F. Bent. Explaining Type Inference. Science of Computer Programming, (27):37–83, 1996.

    Article  MATH  Google Scholar 

  7. G.F. Johnson and J.A. Walz. A Maximum-Flow Approach to Anomaly Isolation in Unification-Based Incremental Type-Inference. In Proc. 13th. ACM Symposium on Principles of Programming Languages (POPL’ 86), pages 44–57, 1986.

    Google Scholar 

  8. K. Knight. Unification: A Multidisciplinary Survey. ACM Computing Surveys, 21(1):93–124, 1989.

    Article  MATH  MathSciNet  Google Scholar 

  9. O. Lee and K. Yi. Proofs About a Folklore Let-Polymorphic Type Inference Algorithm. ACM Transactions on Programming Languages and Systems, 1999. To Appear.

    Google Scholar 

  10. B.J. McAdam. On the Unification of Substitutions in Type-Inference. Technical Report ECS-LFCS-98-384, Laboratory for Foundations of Computer Science, The University of Edinburgh, James Clerk Maxwell Building, The Kings Buildings, Mayfield Road, Edinburgh, UK, March 1998.

    Google Scholar 

  11. S.L. Peyton Jones and P.L. Wadler. Imperative Functional Programming. In Proc. 20th. ACM Symposium on Principles of Programming Languages (POPL’ 93), pages 71–84, January 1993.

    Google Scholar 

  12. M. Tofte. Four Lectures on Standard ML. Technical Report ECS-LFCS-89-73, Laboratory for Foundations of Computer Science, The University of Edinburgh, March 1989.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 1999 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

McAdam, B.J. (1999). On the Unification of Substitutions in Type Inference. In: Hammond, K., Davie, T., Clack, C. (eds) Implementation of Functional Languages. IFL 1998. Lecture Notes in Computer Science, vol 1595. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-48515-5_9

Download citation

  • DOI: https://doi.org/10.1007/3-540-48515-5_9

  • Published:

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-66229-7

  • Online ISBN: 978-3-540-48515-5

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics