Associated types with class
Authors:
Open Access
- 12 January 2005
- journal article
- research article
- Published by Association for Computing Machinery (ACM) in ACM SIGPLAN Notices
- Vol. 40 (1) , 1-13
Abstract
Haskell's type classes allow ad-hoc overloading, or type-indexing, of functions . A natural generalisation is to allow type-indexing of data types as well. It turns out that this idea directly supports a powerful form of abstraction called associated types , which are available in C++ using traits classes. Associated types are useful in many applications, especially for self-optimising libraries that adapt their data representations and algorithms in a type-directed manner.In this paper, we introduce and motivate associated types as a rather natural generalisation of Haskell's existing type classes. Formally, we present a type system that includes a type-directed translation into an explicitly typed target language akin to System F; the existence of this translation ensures that the addition of associated data types to an existing Haskell compiler only requires changes to the front end.Keywords
This publication has 28 references indexed in Scilit:
- A system of constructor classes: overloading and implicit higher-order polymorphismJournal of Functional Programming, 2008
- A theory of overloadingACM Transactions on Programming Languages and Systems, 2005
- The Sketch of a Polymorphic SymphonyElectronic Notes in Theoretical Computer Science, 2002
- Type-Indexed Data Types2002
- A static semantics for HaskellJournal of Functional Programming, 2002
- Generalizing generalized triesJournal of Functional Programming, 2000
- Parametricity and variants of Girard's operatorInformation Processing Letters, 1999
- The Matrix Template Library: generic components for high-performance scientific computingComputing in Science & Engineering, 1999
- Dynamic typing for distributed programming in polymorphic languagesACM Transactions on Programming Languages and Systems, 1999
- Flexible representation analysis1997