Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to main content

Type Inference for Overloading without Restrictions, Declarations or Annotations

  • Conference paper
Functional and Logic Programming (FLOPS 1999)

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

Included in the following conference series:

Abstract

This article presents a type system based on the Damas-Milner system [DM82], that supports overloading. Types of overloaded symbols are constrained polymorphic types. The work is related to Haskell type classes [Wad89,NP93,HHJW96], System O [OWW95] and other similar type systems [Kae88,Smi91,Jon94,DCO96]. Restrictions imposed in these systems with respect to overloading are eliminated. User-defined global and local overloading is supported without restrictions. There is no need for declarations or annotations of any sort. No language construct is added in order to cope with overloading. The type system uses a context-dependent overloading policy, specified by a predicate used in a single inference rule. Overloading of functions defined over different type constructors is supported, as done with Haskell’s constructor classes. No monomorphism restriction is required in order to solve ambiguity problems. The system uses an open-world approach, in which new overloaded definitions can be introduced with types automatically reflecting the new definitions. The article also presents a type inference algorithm for the system, which is proved to be sound and to compute principal typings.

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

Access this chapter

Subscribe and save

Springer+ Basic
$34.99 /Month
  • Get 10 units per month
  • Download Article/Chapter or eBook
  • 1 Unit = 1 Article or 1 Chapter
  • Cancel anytime
Subscribe now

Buy Now

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

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

Similar content being viewed by others

References

  1. Duggan, D., Cormack, G., Ophel, J.: Kinded type inference for parametric overloading. Acta Informatica 33(1), 21–68 (1996)

    Article  MATH  MathSciNet  Google Scholar 

  2. Damas, L., Milner, R.: Principal type schemes for functional programs. In: POPL 1982, pp. 207–212 (1982)

    Google Scholar 

  3. Hall, C., Hammond, K., Jones, S.P., Wadler, P.: Type Classes in Haskell. ACM TOPLAS 18(2), 109–138 (1996)

    Article  Google Scholar 

  4. Jones, S.P., et al.: GHC – The Glasgow Haskell Compiler (1998), Available at http://www.dcs.gla.ac.uk/fp/software/ghc/

  5. Jones, S.P., Jones, M., Meijer, E.: Type classes: an exploration of the design space. In: ACM SIGPLAN Haskell Workshop (1997)

    Google Scholar 

  6. Jones, M.: Qualified Types. Cambridge University Press, Cambridge (1994)

    Book  MATH  Google Scholar 

  7. Jon95. Mark Jones. A system of constructor classes: overloading and higher-order polymorphism. Journal of Functional Programming, 5:1{36, 1995. 38, 41

    Article  MATH  Google Scholar 

  8. Jones, S.P.: Bulk types with class. In: Trinder, P. (ed.) Eletronic Proc. 1996 Glasgow Workshop on Functional Programming (October 1996), http://ftp.dcs.glasgow.ac.uk/fp/workshops/fpw96/PeytonJones.ps.gz

  9. Jones, M.: Hugs: The Haskell User’s Gofer System (1998)

    Google Scholar 

  10. Jones, S.P.: Multi-parameter type classes in GHC (1998), Available at http://www.dcs.gla.ac.uk/~simonpj/multi-param.html

  11. Kaes, S.: Parametric overloading in polymorphic programming languages. In: Ganzinger, H. (ed.) ESOP 1988. LNCS, vol. 300, pp. 131–144. Springer, Heidelberg (1988)

    Google Scholar 

  12. Milner, R.: A theory of type polymorphism in programming. Journal of Computer and System Sciences 17, 348–375 (1978)

    Article  MATH  MathSciNet  Google Scholar 

  13. Mitchell, J.: Polymorphic type inference and containment. Information and Computation 76(2/3), 211–249 (1988)

    Article  MATH  MathSciNet  Google Scholar 

  14. Mitchell, J.: Foundations for programming languages. MIT Press, Cambridge (1996)

    Google Scholar 

  15. Milner, R., Tofte, M., Harper, R.: The Definition of Standard ML. MIT Press, Cambridge (1989)

    Google Scholar 

  16. Nipkow, T., Prehofer, C.: Type Reconstruction for Type Classes. Journal of Functional Programming 1(1), 1–100 (1993)

    Google Scholar 

  17. Odersky, M., Wadler, P., Wehr, M.: A Second Look at Overloading. In: ACM Conf. Funct. Prog. Comp. Arch., pp. 135–146 (1995)

    Google Scholar 

  18. Paulson, L.: ML for the Working Programmer. Cambridge Univ. Press, Cambridge (1996)

    MATH  Google Scholar 

  19. Peterson, J., Hammond, K. (eds.): Rep. on the prog. lang. Haskell, a non-strict, purely funct. lang. (v1.4). Techn. rep., Haskell committee (1997)

    Google Scholar 

  20. Robinson, J.A.: A machine oriented logic based on the resolution principle. JACM 12(1), 23–41 (1965)

    Article  MATH  Google Scholar 

  21. Smith, G.: Polymorphic Type Inference for Languages with Overloading and Subtyping. PhD thesis, Cornell University (1991)

    Google Scholar 

  22. Thompson, S.: Haskell: The Craft of Funct. Prog. Addison-Wesley, Reading (1996)

    Google Scholar 

  23. Turner, D.: A non-strict funct. lang. with polymorphic types. In: 2nd Int. Conf. on Funct. Prog. and Comp. Arch. IEEE Comp. Soc. Press, Los Alamitos (1985)

    Google Scholar 

  24. Wadler, P.: How to make ad-hoc polymorphism less ad hoc. In: POPL 1989 (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

Camarão, C., Figueiredo, L. (1999). Type Inference for Overloading without Restrictions, Declarations or Annotations. In: Middeldorp, A., Sato, T. (eds) Functional and Logic Programming. FLOPS 1999. Lecture Notes in Computer Science, vol 1722. Springer, Berlin, Heidelberg. https://doi.org/10.1007/10705424_3

Download citation

  • DOI: https://doi.org/10.1007/10705424_3

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-66677-6

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

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics