Communications of the ACM
Scrap your boilerplate: a practical design pattern for generic programming
Proceedings of the 2003 ACM SIGPLAN international workshop on Types in languages design and implementation
Template meta-programming for Haskell
ACM SIGPLAN Notices
Functional Programming with Bananas, Lenses, Envelopes and Barbed Wire
Proceedings of the 5th ACM Conference on Functional Programming Languages and Computer Architecture
Calculating Functional Programs
Revised Lectures from the International Summer School and Workshop on Algebraic and Coalgebraic Methods in the Mathematics of Program Construction
Strongly typed heterogeneous collections
Haskell '04 Proceedings of the 2004 ACM SIGPLAN workshop on Haskell
Scrap your boilerplate with class: extensible generic functions
Proceedings of the tenth ACM SIGPLAN international conference on Functional programming
Proceedings of the tenth ACM SIGPLAN international conference on Functional programming
Simple unification-based type inference for GADTs
Proceedings of the eleventh ACM SIGPLAN international conference on Functional programming
Strongly Typed Rewriting For Coupled Software Transformation
Electronic Notes in Theoretical Computer Science (ENTCS)
Transformation of structure-shy programs: applied to XPath queries and strategic functions
Proceedings of the 2007 ACM SIGPLAN symposium on Partial evaluation and semantics-based program manipulation
Uniform boilerplate and list processing
Haskell '07 Proceedings of the ACM SIGPLAN workshop on Haskell workshop
Type checking with open type functions
Proceedings of the 13th ACM SIGPLAN international conference on Functional programming
Initial algebra semantics is enough!
TLCA'07 Proceedings of the 8th international conference on Typed lambda calculi and applications
Type-safe two-level data transformation
FM'06 Proceedings of the 14th international conference on Formal Methods
A framework for point-free program transformation
IFL'05 Proceedings of the 17th international conference on Implementation and Application of Functional Languages
Multifocal: a strategic bidirectional transformation language for XML schemas
ICMT'12 Proceedings of the 5th international conference on Theory and Practice of Model Transformations
Hi-index | 0.01 |
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.