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.

Full Text
Published version (Free)

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call