Algebraic specialization of generic functions for recursive types
| Autor(a) principal: | |
|---|---|
| Data de Publicação: | 2011 |
| Outros Autores: | |
| Tipo de documento: | Artigo |
| Idioma: | eng |
| Título da fonte: | Repositórios Científicos de Acesso Aberto de Portugal (RCAAP) |
| Texto Completo: | https://hdl.handle.net/1822/14888 |
Resumo: | Defining functions over large, possibly recursive, data structures usually involves a lot of boilerplate. This code simply traverses non-interesting parts of the data, and rapidly becomes a maintainability problem. Many generic programming libraries have been proposed to address this issue. Most of them allow the user to specify the behavior just for the interesting bits of the structure, and provide traversal combinators to “scrap the boilerplate”. The expressive power of these libraries usually comes at the cost of efficiency, since runtime checks are used to detect where to apply the type-specific behavior. In previous work we have developed an effective rewrite system for specialization and optimization of generic programs. In this paper we extend it to also cover recursive data types. The key idea is to specialize traversal combinators using well-known recursion patterns, such as folds or paramorphisms. These are ruled by a rich set of algebraic laws that enable aggressive optimizations. We present a type-safe encoding of this rewrite system in Haskell, based on recent language extensions such as type-indexed type families. |
| id |
RCAP_17f8317a6f48b65109a7f0679f810f12 |
|---|---|
| oai_identifier_str |
oai:repositorium.sdum.uminho.pt:1822/14888 |
| network_acronym_str |
RCAP |
| network_name_str |
Repositórios Científicos de Acesso Aberto de Portugal (RCAAP) |
| repository_id_str |
https://opendoar.ac.uk/repository/7160 |
| spelling |
Algebraic specialization of generic functions for recursive typesGeneric programmingRecursion patternsRewrite systemsSpecializationType familiesScience & TechnologyDefining functions over large, possibly recursive, data structures usually involves a lot of boilerplate. This code simply traverses non-interesting parts of the data, and rapidly becomes a maintainability problem. Many generic programming libraries have been proposed to address this issue. Most of them allow the user to specify the behavior just for the interesting bits of the structure, and provide traversal combinators to “scrap the boilerplate”. The expressive power of these libraries usually comes at the cost of efficiency, since runtime checks are used to detect where to apply the type-specific behavior. In previous work we have developed an effective rewrite system for specialization and optimization of generic programs. In this paper we extend it to also cover recursive data types. The key idea is to specialize traversal combinators using well-known recursion patterns, such as folds or paramorphisms. These are ruled by a rich set of algebraic laws that enable aggressive optimizations. We present a type-safe encoding of this rewrite system in Haskell, based on recent language extensions such as type-indexed type families.ElsevierUniversidade do MinhoCunha, AlcinoPacheco, Hugo2011-03-082011-03-08T00:00:00Zinfo:eu-repo/semantics/publishedVersioninfo:eu-repo/semantics/articleapplication/pdfhttps://hdl.handle.net/1822/14888engCunha, A., & Pacheco, H. (2011, March). Algebraic Specialization of Generic Functions for Recursive Types. Electronic Notes in Theoretical Computer Science. Elsevier BV. http://doi.org/10.1016/j.entcs.2011.02.0161571-066110.1016/j.entcs.2011.02.016http://dx.doi.org/10.1016/j.entcs.2011.02.016info:eu-repo/semantics/openAccessreponame:Repositórios Científicos de Acesso Aberto de Portugal (RCAAP)instname:FCCN, serviços digitais da FCT – Fundação para a Ciência e a Tecnologiainstacron:RCAAP2025-04-12T04:33:56Zoai:repositorium.sdum.uminho.pt:1822/14888Portal AgregadorONGhttps://www.rcaap.pt/oai/openaireinfo@rcaap.ptopendoar:https://opendoar.ac.uk/repository/71602025-05-28T15:24:03.406859Repositórios Científicos de Acesso Aberto de Portugal (RCAAP) - FCCN, serviços digitais da FCT – Fundação para a Ciência e a Tecnologiafalse |
| dc.title.none.fl_str_mv |
Algebraic specialization of generic functions for recursive types |
| title |
Algebraic specialization of generic functions for recursive types |
| spellingShingle |
Algebraic specialization of generic functions for recursive types Cunha, Alcino Generic programming Recursion patterns Rewrite systems Specialization Type families Science & Technology |
| title_short |
Algebraic specialization of generic functions for recursive types |
| title_full |
Algebraic specialization of generic functions for recursive types |
| title_fullStr |
Algebraic specialization of generic functions for recursive types |
| title_full_unstemmed |
Algebraic specialization of generic functions for recursive types |
| title_sort |
Algebraic specialization of generic functions for recursive types |
| author |
Cunha, Alcino |
| author_facet |
Cunha, Alcino Pacheco, Hugo |
| author_role |
author |
| author2 |
Pacheco, Hugo |
| author2_role |
author |
| dc.contributor.none.fl_str_mv |
Universidade do Minho |
| dc.contributor.author.fl_str_mv |
Cunha, Alcino Pacheco, Hugo |
| dc.subject.por.fl_str_mv |
Generic programming Recursion patterns Rewrite systems Specialization Type families Science & Technology |
| topic |
Generic programming Recursion patterns Rewrite systems Specialization Type families Science & Technology |
| description |
Defining functions over large, possibly recursive, data structures usually involves a lot of boilerplate. This code simply traverses non-interesting parts of the data, and rapidly becomes a maintainability problem. Many generic programming libraries have been proposed to address this issue. Most of them allow the user to specify the behavior just for the interesting bits of the structure, and provide traversal combinators to “scrap the boilerplate”. The expressive power of these libraries usually comes at the cost of efficiency, since runtime checks are used to detect where to apply the type-specific behavior. In previous work we have developed an effective rewrite system for specialization and optimization of generic programs. In this paper we extend it to also cover recursive data types. The key idea is to specialize traversal combinators using well-known recursion patterns, such as folds or paramorphisms. These are ruled by a rich set of algebraic laws that enable aggressive optimizations. We present a type-safe encoding of this rewrite system in Haskell, based on recent language extensions such as type-indexed type families. |
| publishDate |
2011 |
| dc.date.none.fl_str_mv |
2011-03-08 2011-03-08T00:00:00Z |
| dc.type.status.fl_str_mv |
info:eu-repo/semantics/publishedVersion |
| dc.type.driver.fl_str_mv |
info:eu-repo/semantics/article |
| format |
article |
| status_str |
publishedVersion |
| dc.identifier.uri.fl_str_mv |
https://hdl.handle.net/1822/14888 |
| url |
https://hdl.handle.net/1822/14888 |
| dc.language.iso.fl_str_mv |
eng |
| language |
eng |
| dc.relation.none.fl_str_mv |
Cunha, A., & Pacheco, H. (2011, March). Algebraic Specialization of Generic Functions for Recursive Types. Electronic Notes in Theoretical Computer Science. Elsevier BV. http://doi.org/10.1016/j.entcs.2011.02.016 1571-0661 10.1016/j.entcs.2011.02.016 http://dx.doi.org/10.1016/j.entcs.2011.02.016 |
| dc.rights.driver.fl_str_mv |
info:eu-repo/semantics/openAccess |
| eu_rights_str_mv |
openAccess |
| dc.format.none.fl_str_mv |
application/pdf |
| dc.publisher.none.fl_str_mv |
Elsevier |
| publisher.none.fl_str_mv |
Elsevier |
| dc.source.none.fl_str_mv |
reponame:Repositórios Científicos de Acesso Aberto de Portugal (RCAAP) instname:FCCN, serviços digitais da FCT – Fundação para a Ciência e a Tecnologia instacron:RCAAP |
| instname_str |
FCCN, serviços digitais da FCT – Fundação para a Ciência e a Tecnologia |
| instacron_str |
RCAAP |
| institution |
RCAAP |
| reponame_str |
Repositórios Científicos de Acesso Aberto de Portugal (RCAAP) |
| collection |
Repositórios Científicos de Acesso Aberto de Portugal (RCAAP) |
| repository.name.fl_str_mv |
Repositórios Científicos de Acesso Aberto de Portugal (RCAAP) - FCCN, serviços digitais da FCT – Fundação para a Ciência e a Tecnologia |
| repository.mail.fl_str_mv |
info@rcaap.pt |
| _version_ |
1833595292897771520 |