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.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
Similar content being viewed by others
References
Duggan, D., Cormack, G., Ophel, J.: Kinded type inference for parametric overloading. Acta Informatica 33(1), 21–68 (1996)
Damas, L., Milner, R.: Principal type schemes for functional programs. In: POPL 1982, pp. 207–212 (1982)
Hall, C., Hammond, K., Jones, S.P., Wadler, P.: Type Classes in Haskell. ACM TOPLAS 18(2), 109–138 (1996)
Jones, S.P., et al.: GHC – The Glasgow Haskell Compiler (1998), Available at http://www.dcs.gla.ac.uk/fp/software/ghc/
Jones, S.P., Jones, M., Meijer, E.: Type classes: an exploration of the design space. In: ACM SIGPLAN Haskell Workshop (1997)
Jones, M.: Qualified Types. Cambridge University Press, Cambridge (1994)
Jon95. Mark Jones. A system of constructor classes: overloading and higher-order polymorphism. Journal of Functional Programming, 5:1{36, 1995. 38, 41
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
Jones, M.: Hugs: The Haskell User’s Gofer System (1998)
Jones, S.P.: Multi-parameter type classes in GHC (1998), Available at http://www.dcs.gla.ac.uk/~simonpj/multi-param.html
Kaes, S.: Parametric overloading in polymorphic programming languages. In: Ganzinger, H. (ed.) ESOP 1988. LNCS, vol. 300, pp. 131–144. Springer, Heidelberg (1988)
Milner, R.: A theory of type polymorphism in programming. Journal of Computer and System Sciences 17, 348–375 (1978)
Mitchell, J.: Polymorphic type inference and containment. Information and Computation 76(2/3), 211–249 (1988)
Mitchell, J.: Foundations for programming languages. MIT Press, Cambridge (1996)
Milner, R., Tofte, M., Harper, R.: The Definition of Standard ML. MIT Press, Cambridge (1989)
Nipkow, T., Prehofer, C.: Type Reconstruction for Type Classes. Journal of Functional Programming 1(1), 1–100 (1993)
Odersky, M., Wadler, P., Wehr, M.: A Second Look at Overloading. In: ACM Conf. Funct. Prog. Comp. Arch., pp. 135–146 (1995)
Paulson, L.: ML for the Working Programmer. Cambridge Univ. Press, Cambridge (1996)
Peterson, J., Hammond, K. (eds.): Rep. on the prog. lang. Haskell, a non-strict, purely funct. lang. (v1.4). Techn. rep., Haskell committee (1997)
Robinson, J.A.: A machine oriented logic based on the resolution principle. JACM 12(1), 23–41 (1965)
Smith, G.: Polymorphic Type Inference for Languages with Overloading and Subtyping. PhD thesis, Cornell University (1991)
Thompson, S.: Haskell: The Craft of Funct. Prog. Addison-Wesley, Reading (1996)
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)
Wadler, P.: How to make ad-hoc polymorphism less ad hoc. In: POPL 1989 (1989)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights 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