Generalized algebraic data types and object-oriented programming

12 years 3 months ago
Generalized algebraic data types and object-oriented programming
Generalized algebraic data types (GADTs) have received much attention recently in the functional programming community. They generalize the (type) parameterized algebraic datatypes (PADTs) of ML and Haskell by permitting value constructors to return specific, rather than parametric, typeinstantiations of their own datatype. GADTs have a number of applications, including strongly-typed evaluators, generic pretty-printing, generic traversals and queries, and typed LR parsing. We show that existing object-oriented programming languages such as Java and C can express GADT definitions, and a large class of GADT-manipulating programs, through the use of generics, subclassing, and virtual dispatch. However, some programs can be written only through the use of redundant runtime casts. Moreover, instantiationspecific, yet safe, operations on ordinary PADTs only admit indirect cast-free implementations, via higher-order encodings. We propose a generalization of the type constraint mechanisms...
Andrew Kennedy, Claudio V. Russo
Added 28 Jun 2010
Updated 28 Jun 2010
Type Conference
Year 2005
Authors Andrew Kennedy, Claudio V. Russo
Comments (0)