An Expression Processor: A Case Study in Refactoring Haskell Programs

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.

[1]  Frederick P. Brooks The Mythical Man-Month: After 20 years , 1995 .

[2]  Ralf Lämmel,et al.  A Strafunski Application Letter , 2003, PADL.

[3]  Huiqing Li,et al.  Tool support for refactoring functional programs , 2003, PEPM '08.

[4]  Eric S. Raymond,et al.  Learning GNU Emacs , 1991 .

[5]  Thomas Hallgren Haskell tools from the programatica project , 2003, Haskell '03.

[6]  Simon Thompson Higher-order + Polymorphic = Reusable , 1997 .

[7]  John H. Holland,et al.  Adaptation in Natural and Artificial Systems: An Introductory Analysis with Applications to Biology, Control, and Artificial Intelligence , 1992 .

[8]  Zoltán Horváth,et al.  Use Cases for Refactoring in Erlang , 2007, CEFP.

[9]  Andy Gill Introducing the Haskell equational reasoning assistant , 2006, Haskell '06.

[10]  Tom Mens,et al.  A survey of software refactoring , 2004, IEEE Transactions on Software Engineering.

[11]  Ralf Steinbrüggen,et al.  Program Transformation Systems , 1983, CSUR.

[12]  Viktória Zsók,et al.  Central European Functional Programming School - Third Summer School, CEFP 2009, Budapest, Hungary, May 21-23, 2009 and Komárno, Slovakia, May 25-30, 2009, Revised Selected Lectures , 2010, CEFP.

[13]  Christopher Mark Brown,et al.  Tool support for refactoring Haskell programs , 2008 .

[14]  Alan Bundy,et al.  Constructing Induction Rules for Deductive Synthesis Proofs , 2006, CLASE.

[15]  Paul Hudak,et al.  Conception, evolution, and application of functional programming languages , 1989, CSUR.

[16]  Huiqing Li,et al.  The Haskell Refactorer, HaRe, and its API , 2005, Electron. Notes Theor. Comput. Sci..

[17]  Simon Thompson,et al.  Refactoring Functional Programs ( GR / R 75052 / 01 ) Final Report , 2005 .

[18]  Huiqing Li,et al.  Refactoring Haskell programs , 2006 .

[19]  John Darlington,et al.  A Transformation System for Developing Recursive Programs , 1977, J. ACM.

[20]  Håkan Mattsson,et al.  Mnesia - A Distributed Robust DBMS for Telecommunications Applications , 1999, PADL.

[21]  Peyton Jones,et al.  Haskell 98 language and libraries : the revised report , 2003 .

[22]  William F. Opdyke,et al.  Refactoring object-oriented frameworks , 1992 .

[23]  Simon J. Thompson,et al.  Clone detection and elimination for Haskell , 2010, PEPM '10.

[24]  Alberto Pettorossi,et al.  A powerful strategy for deriving efficient programs by transformation , 1984, LFP '84.