Abstract
Refactoring is the process of changing the structure of a program while preserving its behaviour in order to increase code quality, programming productivity and code reuse. With the advent of refactoring tools, refactoring can be performed semi-automatically, allowing refactorings to be performed (and undone) easily.
In this paper, we briefly describe a number of new refactorings for Haskell 98 programs implemented in the Haskell Refactorer, HaRe. In particular, a number of new structural and data-type refactorings are presented. We also implement a simple expression processor, clearly demonstrating how the refactorings and the HaRe tool can aid programmers in developing Haskell software. We conclude the paper with a discussion of the benefits of refactoring Haskell programs, together with their implementation and design limitations.
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
Brooks, F.P.: The Mythical Man-Month: After 20 Years. IEEE Software 12(5), 57–60 (1995)
Opdyke, W.F.: Refactoring Object-Oriented Frameworks. PhD thesis, Department of Computer Science, University of Illinois at Urbana-Champaign, Champaign, IL, USA (1992)
Burstall, R.M., Darlington, J.: A Transformation System for Developing Recursive Programs. J. ACM 24(1), 44–67 (1977)
Li, H., Thompson, S., Reinke, C.: The Haskell Refactorer, HaRe, and its API. Electronic Notes in Theoretical Computer Science 141(4), 29–34 (2005); Proceedings of the Fifth Workshop on Language Descriptions, Tools, and Applications (LDTA 2005)
Li, H., Reinke, C., Thompson, S.: Tool Support for Refactoring Functional Programs. In: ACM SIGPLAN 2003 Haskell Workshop, Association for Computing Machinery, pp. 27–38 (August 2003)
Peyton Jones, S., Hammond, K.: Haskell 98 Language and Libraries, the Revised Report. Cambridge University Press, Cambridge (2003)
Refactor-fp Group, T.: The Haskell Editing Survey (2004), http://www.cs.kent.ac.uk/projects/refactor-fp/surveys/haskell-editors-July-2002.txt
Oualine, S.: Vim (Vi Improved). Sams (April 2001)
Cameron, D., Elliott, J., Loy, M.: Learning GNU Emacs. O’Reilly, Sebastopol (2004)
Hallgren, T.: Haskell Tools from the Programatica Project. In: Haskell 2003: Proceedings of the 2003 ACM SIGPLAN Workshop on Haskell, pp. 103–106. ACM Press, New York (2003)
Lämmel, R., Visser, J.: A Strafunski Application Letter. In: Dahl, V. (ed.) PADL 2003. LNCS, vol. 2562, pp. 357–375. Springer, Heidelberg (2002)
Li, H.: Refactoring Haskell Programs. PhD thesis, School of Computing, University of Kent, Canterbury, Kent, UK (September 2006)
Brown, C.: Tool Support for Refactoring Haskell Programs. PhD thesis, School of Computing, University of Kent, Canterbury, Kent, UK (September 2008), http://www.cs.kent.ac.uk/projects/refactor-fp/publications/ChrisThesis.pdf
Brown, C., Thompson, S.: Clone Detection and Elimination for Haskell. In: Gallagher, J., Voigtlander, J. (eds.) PEPM 2010: Proceedings of the 2010 ACM SIGPLAN Workshop on Partial Evaluation and Program Manipulation, pp. 111–120. ACM Press, New York (2010)
Refactor-fp Group, T.: Refactoring Functional Programs (2008), http://www.cs.kent.ac.uk/projects/refactor-fp
Pettorossi, A.: A Powerful Strategy for Deriving Efficient Programs by Transformation. In: LFP 1984: Proceedings of the 1984 ACM Symposium on LISP and Functional Programming, pp. 273–281. ACM, New York (1984)
Brown, C., Thompson, S.: Expression processor example code (2010), http://www.cs.st-and.ac.uk/~chrisb/tfp2010.html
Partsch, H., Steinbruggen, R.: Program Transformation Systems. ACM Comput. Surv. 15(3), 199–236 (1983)
Hudak, P.: Conception, Evolution, and Application of Functional Programming Languages. ACM Computing Survey 21(3), 359–411 (1989)
Mens, T., Tourwé, T.: A Survey of Software Refactoring. IEEE Trans. Softw. Eng. 30(2), 126–139 (2004)
Kozsik, T., Csörnyei, Z., Horváth, Z., Király, R., Kitlei, R., Lövei, L., Nagy, T., Tóth, M., VÃg, A.: Use cases for refactoring in erlang. In: Horváth, Z., Plasmeijer, R., Soós, A., Zsók, V. (eds.) Central European Functional Programming School. LNCS, vol. 5161, pp. 250–285. Springer, Heidelberg (2008)
Mattsson, H., Nilsson, H., Wikström, C., Ericsson Telecom Ab: Mnesia – A distributed robust DBMS for telecommunications applications. In: Gupta, G. (ed.) PADL 1999. LNCS, vol. 1551, pp. 152–163. Springer, Heidelberg (1999)
Gill, A.: Introducing the Haskell Equational Reasoning Assistant. In: Proceedings of the 2006 ACM SIGPLAN Workshop on Haskell, pp. 108–109. ACM Press, New York (2006)
Thompson, S.: Higher-order + Polymorphic = Reusable (May 1997)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2011 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Brown, C., Li, H., Thompson, S. (2011). An Expression Processor: A Case Study in Refactoring Haskell Programs. In: Page, R., Horváth, Z., Zsók, V. (eds) Trends in Functional Programming. TFP 2010. Lecture Notes in Computer Science, vol 6546. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-22941-1_3
Download citation
DOI: https://doi.org/10.1007/978-3-642-22941-1_3
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-642-22940-4
Online ISBN: 978-3-642-22941-1
eBook Packages: Computer ScienceComputer Science (R0)