Affiliation:
1. University of New South Wales, Australia
2. Microsoft Research Ltd., Cambridge, UK
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.
Publisher
Association for Computing Machinery (ACM)
Subject
Computer Graphics and Computer-Aided Design,Software
Reference38 articles.
1. Lecture Notes in Computer Science;Manuel M.,2002
2. Parametric type classes
3. Flexible type analysis
Cited by
36 articles.
订阅此论文施引文献
订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献