Algebraic specialization of generic functions for recursive types

Detalhes bibliográficos
Autor(a) principal: Cunha, Alcino
Data de Publicação: 2011
Outros Autores: Pacheco, Hugo
Tipo de documento: Artigo
Idioma: eng
Título da fonte: Repositório Científico de Acesso Aberto de Portugal (Repositórios Cientìficos)
Texto Completo: http://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ório Científico de Acesso Aberto de Portugal (Repositórios Cientìficos)
repository_id_str
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/pdfhttp://hdl.handle.net/1822/14888eng1571-066110.1016/j.entcs.2011.02.016http://dx.doi.org/10.1016/j.entcs.2011.02.016info:eu-repo/semantics/openAccessreponame:Repositório Científico de Acesso Aberto de Portugal (Repositórios Cientìficos)instname:Agência para a Sociedade do Conhecimento (UMIC) - FCT - Sociedade da Informaçãoinstacron:RCAAP2023-07-21T12:18:58ZPortal AgregadorONG
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 http://hdl.handle.net/1822/14888
url http://hdl.handle.net/1822/14888
dc.language.iso.fl_str_mv eng
language eng
dc.relation.none.fl_str_mv 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ório Científico de Acesso Aberto de Portugal (Repositórios Cientìficos)
instname:Agência para a Sociedade do Conhecimento (UMIC) - FCT - Sociedade da Informação
instacron:RCAAP
instname_str Agência para a Sociedade do Conhecimento (UMIC) - FCT - Sociedade da Informação
instacron_str RCAAP
institution RCAAP
reponame_str Repositório Científico de Acesso Aberto de Portugal (Repositórios Cientìficos)
collection Repositório Científico de Acesso Aberto de Portugal (Repositórios Cientìficos)
repository.name.fl_str_mv
repository.mail.fl_str_mv
_version_ 1777303729028988928