Class Types

Carlos Camarão e Lucília Figueiredo

This article presents class types. A class type is a type constrained by the definition of functions or constants of given types. This notion supports both overloading and a form of subtyping, and is related to Haskell type classes[Wad89, HHJW94] and System O[OWW95]. We study an extension of th Damas-Milner system[Mil78,DM82] with class types. The inference system presented uses a context-dependent overloading policy, which is specified by means of a predicate used in a single inference rule. The idea simplifies the treatment of overloading, enables the simplification of inferred types (by means of class type annotations), and is adequate for use in a type system with higher-order types.