TypeCase: A design pattern for type-indexed functions
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 i...
Main Authors: | , |
---|---|
Formato: | Conference item |
Publicado em: |
2005
|
_version_ | 1826268226676326400 |
---|---|
author | Oliveira, B Gibbons, J |
author_facet | Oliveira, B Gibbons, J |
author_sort | Oliveira, B |
collection | OXFORD |
description | 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 type-indexed 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. Copyright © 2005 ACM. |
first_indexed | 2024-03-06T21:06:25Z |
format | Conference item |
id | oxford-uuid:3c9e2ba1-3e3b-4ffb-be43-b0473f2ffea0 |
institution | University of Oxford |
last_indexed | 2024-03-06T21:06:25Z |
publishDate | 2005 |
record_format | dspace |
spelling | oxford-uuid:3c9e2ba1-3e3b-4ffb-be43-b0473f2ffea02022-03-26T14:14:37ZTypeCase: A design pattern for type-indexed functionsConference itemhttp://purl.org/coar/resource_type/c_5794uuid:3c9e2ba1-3e3b-4ffb-be43-b0473f2ffea0Symplectic Elements at Oxford2005Oliveira, BGibbons, JA 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 type-indexed 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. Copyright © 2005 ACM. |
spellingShingle | Oliveira, B Gibbons, J TypeCase: A design pattern for type-indexed functions |
title | TypeCase: A design pattern for type-indexed functions |
title_full | TypeCase: A design pattern for type-indexed functions |
title_fullStr | TypeCase: A design pattern for type-indexed functions |
title_full_unstemmed | TypeCase: A design pattern for type-indexed functions |
title_short | TypeCase: A design pattern for type-indexed functions |
title_sort | typecase a design pattern for type indexed functions |
work_keys_str_mv | AT oliveirab typecaseadesignpatternfortypeindexedfunctions AT gibbonsj typecaseadesignpatternfortypeindexedfunctions |