Nothing Special   »   [go: up one dir, main page]

skip to main content
10.1145/1863597.1863608acmconferencesArticle/Chapter ViewAbstractPublication PagesicfpConference Proceedingsconference-collections
research-article

Type inference in context

Published: 25 September 2010 Publication History

Abstract

We consider the problems of first-order unification and type inference from a general perspective on problem-solving, namely that of information increase in the problem context. This leads to a powerful technique for implementing type inference algorithms. We describe a unification algorithm and illustrate the technique for the familiar Hindley-Milner type system, but it can be applied to more advanced type systems. The algorithms depend on well-founded contexts: type variable bindings and type-schemes for terms may depend only on earlier bindings. We ensure that unification yields a most general unifier, and that type inference yields principal types, by advancing definitions earlier in the context only when necessary.

References

[1]
}}F. Baader and W. Snyder. Unification theory. In J. A. Robinson and A. Voronkov, editors, Handbook of Automated Reasoning, pages 445--532. Elsevier and MIT Press, 2001.
[2]
}}F. Bellegarde and J. Hook. Substitution: a formal methods case study using monads and transformations. Sci. Comp. Programming, 23(2--3):287--311, 1994.
[3]
}}R. Bird and R. Paterson. de Bruijn notation as a nested datatype. J. Functional Programming, 9(1):77--91, 1999.
[4]
}}D. Clément, T. Despeyroux, G. Kahn, and J. Despeyroux. A simple applicative language: mini-ML. In Proc. LISP and Functional Programming, pages 13--27. ACM, 1986.
[5]
}}L. Damas and R. Milner. Principal type-schemes for functional programs. In Proc. POPL '82, pages 207--212. ACM, 1982.
[6]
}}J. Dunfield. Greedy bidirectional polymorphism. In Proc. ML '09, pages 15--26. ACM, 2009.
[7]
}}GHC Team. The GHC user's guide, version 6.12.1. Section 7.5. Extensions to the "deriving" mechanism, 2009.
[8]
}}G. Huet. The Zipper. J. Functional Programming, 7(5):549--554, 1997.
[9]
}}B. J. McAdam. On the unification of substitutions in type inference. In Proc. IFL' 98, pages 139--154. Springer, 1998.
[10]
}}C. McBride. Dependently Typed Functional Programs and their Proofs. PhD thesis, University of Edinburgh, 1999.
[11]
}}C. McBride. First-Order Unification by Structural Recursion. J. Functional Programming, 13(6), 2003.
[12]
}}C. McBride and J. McKinna. The view from the left. J. Functional Programming, 14(1):69--111, 2004a.
[13]
}}C. McBride and J. McKinna. Functional pearl: I am not a number - I am a free variable. In Proc. Haskell workshop, pages 1--9. ACM, 2004b.
[14]
}}D. Miller. Unification under a mixed prefix. J. Symbolic Computation, 14(4):321--358, 1992.
[15]
}}R. Milner. A theory of type polymorphism in programming. J. Computer and System Sciences, 17(3):348--375, 1978.
[16]
}}W. Naraschewski and T. Nipkow. Type inference verified: Algorithm W in Isabelle/HOL. J. Automated Reasoning, 23(3):299--318, 1999.
[17]
}}T. Nipkow and C. Prehofer. Type reconstruction for type classes. J. Functional Programming, 5(2):201--224, 1995.
[18]
}}U. Norell. Towards a practical programming language based on dependent type theory. PhD thesis, Chalmers University of Technology, 2007.
[19]
}}R. Pollack. Implicit syntax. In Informal Proceedings of First Workshop on Logical Frameworks, 1990.
[20]
}}J. A. Robinson. A machine-oriented logic based on the resolution principle. JACM, 12(1):23--41, 1965.
[21]
}}J. B. Wells. The essence of principal typings. In Proc. ICALP '02, pages 913--925. Springer, 2002.

Cited By

View all

Recommendations

Comments

Please enable JavaScript to view thecomments powered by Disqus.

Information & Contributors

Information

Published In

cover image ACM Conferences
MSFP '10: Proceedings of the third ACM SIGPLAN workshop on Mathematically structured functional programming
September 2010
62 pages
ISBN:9781450302555
DOI:10.1145/1863597
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

Sponsors

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 25 September 2010

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. algorithm w
  2. hindley-milner
  3. type inference
  4. unification

Qualifiers

  • Research-article

Conference

ICFP '10
Sponsor:

Acceptance Rates

MSFP '10 Paper Acceptance Rate 4 of 8 submissions, 50%;
Overall Acceptance Rate 4 of 8 submissions, 50%

Upcoming Conference

ICFP '25
ACM SIGPLAN International Conference on Functional Programming
October 12 - 18, 2025
Singapore , Singapore

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)13
  • Downloads (Last 6 weeks)2
Reflects downloads up to 30 Nov 2024

Other Metrics

Citations

Cited By

View all

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media