TypeCase A Design Pattern for Type-Indexed Functions
Short Description
paper is to present TypeCase: a design pattern that allows the defin- ….. Motivation: The typecase design pattern captures a closed-world …
Website: www.comlab.ox.ac.uk | Filesize: 173kb
Content
TypeCase: A Design Pattern for Type-Indexed Functions
Bruno C. d. S. Oliveira and Jeremy Gibbons
Oxford University Computing Laboratory
Wolfson Building, Parks Road, Oxford OX1 3QD, UK
{bruno,jg}@comlab.ox.ac.uk
Abstract
A type-indexed function is a function that is defined for each
member of some family of types. Haskell’s type class mechanism
provides collections of open type-indexed functions, in which
the indexing family can be extended by defining a new type class
instance but the collection of functions is fixed. The purpose of this
paper is to present TypeCase: a design pattern that allows the definition
of closed type-indexed functions, in which the index family
is fixed but the collection of functions is extensible. It is inspired
by Cheney and Hinze’s work on lightweight approaches to generic
programming. We generalise their techniques as a design pattern.
Furthermore, we show that type-indexed functions with typeindexed
types, and consequently generic functions with generic
types, can also be encoded in a lightweight manner, thereby overcoming
one of the main limitations of the lightweight approaches.
Categories and Subject Descriptors D.3.3 [Programming Languages]:
Language Constructs and Features
General Terms Languages
Keywords Generic programming, type…
Get the file Download here
Related Books:Related Searches: oxford ox1 3qd, oxford university computing, jeremy gibbons, generic programming, generic functions
Comments
Leave a Reply