Abstract
Lacking support for generic traversal, functional programming languages suffer from a scalability problem when applied to largescale 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.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
M. Abadi, L. Cardelli, B. Pierce, and G. Plotkin. Dynamic Typing in a Statically Typed Language. ACM Transactions on Programming Languages and Systems, 13(2):237–268, Apr. 1991.
G. Arango, I. Baxter, P. Freeman, and C. Pidgeon. TMM: Software maintenance by transformation. IEEE Software, 3(3):27–39, May 1986.
M. Brand, M. Sellink, and C. Verhoef. Generation of Components for Software Renovation Factories from Context-free Grammars. Science of Computer Programming, 36(2–3):209–266, 2000.
E. Chikofsky and J. C. II. Reverse Engineering and Design Recovery: A Taxonomy. IEEE Software, 7(1):13–17, Jan. 1990.
K. Crary, S. Weirich, and G. Morrisett. Intensional polymorphism in type-erasure semantics. ACM SIGPLAN Notices, 34(1):301–312, Jan. 1999.
A. Deursen, P. Klint, and C. Verhoef. Research Issues in the Renovation of Legacy Systems. In J. Finance, editor, Proc. of FASE’99, volume 1577 of LNCS, pages 1–21. Springer-Verlag, 1999.
C. Dubois, F. Rouaix, and P. Weis. Extensional polymorphism. In Conference record of POPL’95, pages 118–129. ACM Press, 1995.
P. H. Eidor., F. Henglein, C. Mossin, H. Niss, M. H. B. Sørensen, and M. Tofte. AnnoDomini: From type theory to year 2000 conversion tool. In Conference Record of POPL’99, pages 1–14. ACM press, 1999. Invited paper.
M. Fowler. Refactoring: Improving the Design of Existing Code. Addison Wesley, 1999.
Haskell 98: A Non-strict, Purely Functional Language, Feb. 1999. http://www.haskell.org/onlinereport/.
R. Hinze. A generic programming extension for Haskell. In E. Meijer, editor, Proceedings of the 3rd Haskell Workshop, Paris, France, Sept. 1999. Technical report, Universiteit Utrecht, UU-CS-1999-28.
P. Jansson and J. Jeuring. PolyP-a polytypic programming language extension. In Conference record of POPL’97, pages 470–482. ACM Press, 1997.
J. Jeuring, editor. Proc. of WGP’2000, Technical Report, Universiteit Utrecht, July 2000.
M. Jones. First-class polymorphism with type inference. In Conference record of POPL’97, pages 483–496, Paris, France, 15-17 Jan. 1997.
J. Kort, R. Lämmel, and J. Visser. Functional Transformation Systems. In 9th International Workshop on Functional and Logic Programming, Benicassim, Spain, July 2000.
R. Lämmel. Typed Generic Traversals in S 1 ?. Technical Report SEN-R0122, CWI, Aug. 2001.
R. Lämmel, J. Visser, and J. Kort. Dealing with Large Bananas. In Jeuring [13], pages 46–59.
L. Paulson. A Higher-Order Implementation of Rewriting. Science of Computer Programming, 3(2):119–149, Aug. 1983.
E. Visser. Language Independent Traversals for Program Transformation. In Jeuring [13], pages 86–104.
E. Visser, Z. Benaissa, and A. Tolmach. Building Program Optimizers with Rewriting Strategies. In Proc. of ICFP’98, pages 13–26, Sept. 1998.
P. Wadler. Theorems for Free! In Proc. of FPCA’89, London, pages 347–359. ACM Press, New York, Sept. 1989.
P. Wadler. The essence of functional programming. In Conference record of POPL’92, pages 1–14. ACM Press, 1992.
M. Wallace and C. Runciman. Haskell and XML: Generic combinators or typebased translation? ACM SIGPLAN Notices, 34(9):148–159, Sept. 1999. Proceedings of ICFP’99.
S. Weirich. Type-safe cast: (functional pearl). ACM SIGPLAN Notices, 35(9):58–67, Sept. 2000.
N. Winstanley. Derive User Guide, version 1.0. Available at http://www.dcs.gla.ac.uk/~nww/Derive/, June 1997.
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2002 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Lämmel, R., Visser, J. (2002). Typed Combinators for Generic Traversal. In: Krishnamurthi, S., Ramakrishnan, C.R. (eds) Practical Aspects of Declarative Languages. PADL 2002. Lecture Notes in Computer Science, vol 2257. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-45587-6_10
Download citation
DOI: https://doi.org/10.1007/3-540-45587-6_10
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-43092-6
Online ISBN: 978-3-540-45587-5
eBook Packages: Springer Book Archive