Advertisement

Typed Combinators for Generic Traversal

  • Ralf Lämmel
  • Joost Visser
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 2257)

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.

Keywords

Genericity traversal combinators program transformation 

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    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.CrossRefGoogle Scholar
  2. 2.
    G. Arango, I. Baxter, P. Freeman, and C. Pidgeon. TMM: Software maintenance by transformation. IEEE Software, 3(3):27–39, May 1986.CrossRefGoogle Scholar
  3. 3.
    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.CrossRefGoogle Scholar
  4. 4.
    E. Chikofsky and J. C. II. Reverse Engineering and Design Recovery: A Taxonomy. IEEE Software, 7(1):13–17, Jan. 1990.CrossRefGoogle Scholar
  5. 5.
    K. Crary, S. Weirich, and G. Morrisett. Intensional polymorphism in type-erasure semantics. ACM SIGPLAN Notices, 34(1):301–312, Jan. 1999.CrossRefGoogle Scholar
  6. 6.
    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.Google Scholar
  7. 7.
    C. Dubois, F. Rouaix, and P. Weis. Extensional polymorphism. In Conference record of POPL’95, pages 118–129. ACM Press, 1995.Google Scholar
  8. 8.
    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.Google Scholar
  9. 9.
    M. Fowler. Refactoring: Improving the Design of Existing Code. Addison Wesley, 1999.Google Scholar
  10. 10.
    Haskell 98: A Non-strict, Purely Functional Language, Feb. 1999. http://www.haskell.org/onlinereport/.
  11. 11.
    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.Google Scholar
  12. 12.
    P. Jansson and J. Jeuring. PolyP-a polytypic programming language extension. In Conference record of POPL’97, pages 470–482. ACM Press, 1997.Google Scholar
  13. 13.
    J. Jeuring, editor. Proc. of WGP’2000, Technical Report, Universiteit Utrecht, July 2000.Google Scholar
  14. 14.
    M. Jones. First-class polymorphism with type inference. In Conference record of POPL’97, pages 483–496, Paris, France, 15-17 Jan. 1997.Google Scholar
  15. 15.
    J. Kort, R. Lämmel, and J. Visser. Functional Transformation Systems. In 9th International Workshop on Functional and Logic Programming, Benicassim, Spain, July 2000.Google Scholar
  16. 16.
    R. Lämmel. Typed Generic Traversals in S 1 ?. Technical Report SEN-R0122, CWI, Aug. 2001.Google Scholar
  17. 17.
    R. Lämmel, J. Visser, and J. Kort. Dealing with Large Bananas. In Jeuring [13], pages 46–59.Google Scholar
  18. 18.
    L. Paulson. A Higher-Order Implementation of Rewriting. Science of Computer Programming, 3(2):119–149, Aug. 1983.zbMATHCrossRefMathSciNetGoogle Scholar
  19. 19.
    E. Visser. Language Independent Traversals for Program Transformation. In Jeuring [13], pages 86–104.Google Scholar
  20. 20.
    E. Visser, Z. Benaissa, and A. Tolmach. Building Program Optimizers with Rewriting Strategies. In Proc. of ICFP’98, pages 13–26, Sept. 1998.Google Scholar
  21. 21.
    P. Wadler. Theorems for Free! In Proc. of FPCA’89, London, pages 347–359. ACM Press, New York, Sept. 1989.Google Scholar
  22. 22.
    P. Wadler. The essence of functional programming. In Conference record of POPL’92, pages 1–14. ACM Press, 1992.Google Scholar
  23. 23.
    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.CrossRefGoogle Scholar
  24. 24.
    S. Weirich. Type-safe cast: (functional pearl). ACM SIGPLAN Notices, 35(9):58–67, Sept. 2000.CrossRefGoogle Scholar
  25. 25.
    N. Winstanley. Derive User Guide, version 1.0. Available at http://www.dcs.gla.ac.uk/~nww/Derive/, June 1997.

Copyright information

© Springer-Verlag Berlin Heidelberg 2002

Authors and Affiliations

  • Ralf Lämmel
    • 1
    • 2
  • Joost Visser
    • 2
  1. 1.Vrije UniversiteitHV Amsterdam
  2. 2.CWISJ Amsterdam

Personalised recommendations