Lacking support for generic traversal, functional programming languages suffer from a scalability problem when applied to large-scale program transformation problems. As a solution, we introduce functional strategies: typeful generic functions that not only can be applied to terms of any type, but which also allow generic traversal into subterms. We show how strategies are modelled inside a functional language, and we present a combinator library including generic traversal combinators. We illustrate our technique of programming with functional strategies by an implementation of the extract method refactoring for Java.
@inproceedings{LV02-PADL,
author = "R.~L{\"a}mmel and J.~Visser",
title = "{Typed Combinators for Generic Traversal}",
booktitle = "{Proc.\ Practical Aspects of Declarative Programming PADL 2002}",
publisher = "Springer-Verlag",
series = "LNCS",
volume = "2257",
year = "2002",
month = jan,
pages = "137--154"
}
@techreport{LV01-CWI,
author = "R.~L{\"a}mmel and J.~Visser",
title = "{Typed Combinators for Generic Traversal}",
institution = "Centrum voor Wiskunde en Informatica",
number = "SEN-R0124",
year = "2001",
month = aug,
note = {34 pages},
}