{"status":"ok","message-type":"work","message-version":"1.0.0","message":{"indexed":{"date-parts":[[2026,5,26]],"date-time":"2026-05-26T23:05:46Z","timestamp":1779836746411,"version":"3.53.1"},"reference-count":86,"publisher":"Cambridge University Press (CUP)","issue":"3","license":[{"start":{"date-parts":[[2013,10,22]],"date-time":"2013-10-22T00:00:00Z","timestamp":1382400000000},"content-version":"unspecified","delay-in-days":174,"URL":"https:\/\/www.cambridge.org\/core\/terms"}],"content-domain":{"domain":[],"crossmark-restriction":false},"short-container-title":["J. Funct. Prog."],"published-print":{"date-parts":[[2013,5]]},"abstract":"<jats:title>Abstract<\/jats:title>\n                  <jats:p>Refactoring is the process of changing the design of a program without changing what it does. Typical refactorings, such as function extraction and generalisation, are intended to make a program more amenable to extension, more comprehensible and so on. Refactorings differ from other sorts of program transformation in being applied to source code, rather than to a \u2018core\u2019 language within a compiler, and also in having an effect across a code base, rather than to a single function definition, say. Because of this, there is a need to give automated support to the process. This paper reflects on our experience of building tools to refactor functional programs written in Haskell (HaRe) and Erlang (Wrangler). We begin by discussing what refactoring means for functional programming languages, first in theory, and then in the context of a larger example. Next, we address system design and details of system implementation as well as contrasting the style of refactoring and tooling for Haskell and Erlang. Building both tools led to reflections about what particular refactorings mean, as well as requiring analyses of various kinds, and we discuss both of these. We also discuss various extensions to the core tools, including integrating the tools with test frameworks; facilities for detecting and eliminating code clones; and facilities to make the systems extensible by users. We then reflect on our work by drawing some general conclusions, some of which apply particularly to functional languages, while many others are of general value.<\/jats:p>","DOI":"10.1017\/s0956796813000117","type":"journal-article","created":{"date-parts":[[2013,10,22]],"date-time":"2013-10-22T07:39:24Z","timestamp":1382427564000},"page":"293-350","source":"Crossref","is-referenced-by-count":11,"title":["Refactoring tools for functional languages"],"prefix":"10.1017","volume":"23","author":[{"given":"SIMON","family":"THOMPSON","sequence":"first","affiliation":[],"role":[{"vocabulary":"crossref","role":"author"}]},{"given":"HUIQING","family":"LI","sequence":"additional","affiliation":[],"role":[{"vocabulary":"crossref","role":"author"}]}],"member":"56","published-online":{"date-parts":[[2013,10,22]]},"reference":[{"key":"S0956796813000117_ref86","volume-title":"IEEE\/IFIP International Conference on Dependable Systems Networks (DSN '09)","author":"Yin","year":"2009"},{"key":"S0956796813000117_ref83","unstructured":"Tullsen M. (2002) PATH, A Program Transformation System for Haskell. PhD thesis, Yale University, Yale, CT."},{"key":"S0956796813000117_ref79","doi-asserted-by":"publisher","DOI":"10.1145\/2328876"},{"key":"S0956796813000117_ref78","doi-asserted-by":"crossref","first-page":"49","DOI":"10.1145\/2384716.2384737","volume-title":"Proceedings of the 3rd Annual Conference on Systems, Programming, and Applications: Software for Humanity (SPLASH '12)","author":"Soares","year":"2012"},{"key":"S0956796813000117_ref75","first-page":"37","volume-title":"Proceedings of the 9th International ACM SIGPLAN Symposium on Principles and Practice of Declarative Programming (PPDP '07)","author":"Sagonas","year":"2007"},{"key":"S0956796813000117_ref72","unstructured":"ReSharper. (n.d.) Introductory web page. Available at: http:\/\/www.jetbrains.com\/resharper\/. Accessed 6 September 2013."},{"key":"S0956796813000117_ref67","unstructured":"Mitchell N. (2011) HLint Manual. Available at: http:\/\/community.haskell.org\/~ndm\/hlint\/. Accessed 6 September 2013."},{"key":"S0956796813000117_ref66","volume-title":"xUnit Test Patterns: Refactoring Test Code","author":"Meszaros","year":"2007"},{"key":"S0956796813000117_ref62","first-page":"11","volume-title":"Proceedings of the 2009 ACM SIGPLAN Erlang Workshop","author":"L\u00f6vei","year":"2009"},{"key":"S0956796813000117_ref61","volume-title":"ACM SIGPLAN Erlang Workshop 2008","author":"Li","year":"2008"},{"key":"S0956796813000117_ref60","volume-title":"Refactoring and Testing Workshop (RefTest 2011)","author":"Li","year":"2011"},{"key":"S0956796813000117_ref59","doi-asserted-by":"publisher","DOI":"10.1145\/2328876.2328881"},{"key":"S0956796813000117_ref58","volume-title":"Automated Software Engineering (ASE'12","author":"Li","year":"2012"},{"key":"S0956796813000117_ref55","volume-title":"A User-Extensible Refactoring Tool for Erlang Programs","author":"Li","year":"2011"},{"key":"S0956796813000117_ref49","first-page":"197","volume-title":"Sixth IEEE International Workshop on Source Code Analysis and Manipulation (SCAM'06)","author":"Li","year":"2006"},{"key":"S0956796813000117_ref82","first-page":"451","volume-title":"Central European Functional Programming Summer School (CEFP 2011), Revisited Selected Lectures","author":"T\u00f3th","year":"2012"},{"key":"S0956796813000117_ref56","volume-title":"Proceedings of the Conference on Fundamental Approaches to Software Engineering (FASE'11)","author":"Li","year":"2011"},{"key":"S0956796813000117_ref43","volume-title":"Proceedings of the 5th International Symposium on Practical Aspects of Declarative Languages. PADL'03","author":"L\u00e4mmel","year":"2003"},{"key":"S0956796813000117_ref68","first-page":"287","volume-title":"Proceedings of the 31st International Conference on Software Engineering (ICSE '09)","author":"Murphy-Hill","year":"2009"},{"key":"S0956796813000117_ref41","doi-asserted-by":"publisher","DOI":"10.1145\/2328876.2328886"},{"key":"S0956796813000117_ref40","volume-title":"Lecture Notes in Computer Science","author":"Komondoor","year":"2001"},{"key":"S0956796813000117_ref36","doi-asserted-by":"publisher","DOI":"10.1109\/ICSE.2007.30"},{"key":"S0956796813000117_ref51","volume-title":"ACM SIGPLAN Workshop on Partial Evaluation and Program Manipulation (PEPM'09)","author":"Li","year":"2009"},{"key":"S0956796813000117_ref35","unstructured":"Hughes J. & Peyton Jones, S. (eds). (1999) Report on the Programming Language Haskell 98. Available at: http:\/\/www.haskell.org\/onlinereport\/. Accessed 6 September 2013."},{"key":"S0956796813000117_ref34","volume-title":"Workshop on Advanced Software Development Tools and Techniques (WASDETT 2008)","author":"Horv\u00e1th","year":"2008"},{"key":"S0956796813000117_ref33","doi-asserted-by":"publisher","DOI":"10.1145\/2328876.2328882"},{"key":"S0956796813000117_ref31","unstructured":"HaRe. (n.d.) The HaRe system. Available at: http:\/\/www.cs.kent.ac.uk\/projects\/refactor-fp\/hare.html. Accessed 6 September 2013."},{"key":"S0956796813000117_ref30","volume-title":"In ACM Sigplan Haskell Workshop","author":"Hallgren","year":"2003"},{"key":"S0956796813000117_ref48","first-page":"95","volume-title":"Trends in Functional Programming","author":"Li","year":"2005"},{"key":"S0956796813000117_ref29","unstructured":"Hackage. (2010) HackageDB. Available at: http:\/\/hackage.haskell.org\/. Accessed 6 September 2013."},{"key":"S0956796813000117_ref27","unstructured":"Griswold W. G. (1991) Program Restructuring as an Aid to Software Maintenance. PhD thesis, Department of Computer Science and Engineering, University of Washington, Seattle, WA."},{"key":"S0956796813000117_ref28","doi-asserted-by":"publisher","DOI":"10.1145\/152388.152389"},{"key":"S0956796813000117_ref26","volume-title":"Proceedings of the 2009 European Conference on Software Maintenance and Reengineering (CSMR'09)","author":"G\u00f6de","year":"2009"},{"key":"S0956796813000117_ref52","first-page":"1","volume-title":"3rd ACM Workshop on Refactoring Tools","author":"Li","year":"2009"},{"key":"S0956796813000117_ref25","unstructured":"GHC API. (n.d.) GHC Commentary. Available at: http:\/\/hackage.haskell.org\/trac\/ghc\/wiki\/Commentary\/Compiler\/API. Accessed 6 September 2013."},{"key":"S0956796813000117_ref24","first-page":"211","volume-title":"Proceedings of the 2012 International Conference on Software Engineering (ICSE 2012","author":"Ge","year":"2012"},{"key":"S0956796813000117_ref23","volume-title":"Proceedings of the Sixth IEEE International Workshop on Source Code Analysis and Manipulation (SCAM '06)","author":"Garrido","year":"2006"},{"key":"S0956796813000117_ref84","volume-title":"1st International Conference on Software Testing, Verification, and Validation, 2008","author":"Ubayashi","year":"2008"},{"key":"S0956796813000117_ref20","first-page":"150","volume-title":"The 14th Working Conference on Reverse Engineering","author":"Evans","year":"2008"},{"key":"S0956796813000117_ref70","volume-title":"International Conference on Software Maintenance (ICSM'09)","author":"Nguyen","year":"2009"},{"key":"S0956796813000117_ref16","volume-title":"Functional Programming and Its Applications","author":"Darlington","year":"1982"},{"key":"S0956796813000117_ref85","doi-asserted-by":"publisher","DOI":"10.1109\/ICSE.2012.6227190"},{"key":"S0956796813000117_ref18","unstructured":"Erlang E-learning. (2011) Online e-Learning System. Available at: https:\/\/elearning.erlang-solutions.com. Accessed 6 September 2013."},{"key":"S0956796813000117_ref15","first-page":"185","volume-title":"Proceedings of the the 6th Joint Meeting of the European Software Engineering Conference and the ACM SIGSOFT Symposium on The Foundations of Software Engineering (ESEC-FSE '07)","author":"Daniel","year":"2007"},{"key":"S0956796813000117_ref14","doi-asserted-by":"publisher","DOI":"10.1145\/351240.351266"},{"key":"S0956796813000117_ref57","first-page":"294","volume-title":"Fundamental Approaches to Software Engineering (FASE 2012)","author":"Li","year":"2012"},{"key":"S0956796813000117_ref12","doi-asserted-by":"publisher","DOI":"10.1016\/j.entcs.2007.03.014"},{"key":"S0956796813000117_ref11","volume-title":"Proceedings of the 2006 ACM SIGPLAN Workshop on Erlang (ERLANG '06)","author":"Carlsson","year":"2006"},{"key":"S0956796813000117_ref10","doi-asserted-by":"publisher","DOI":"10.1145\/800027.808470"},{"key":"S0956796813000117_ref37","first-page":"140","volume-title":"Proceedings of the 9th WSEAS International Conference on Applied Computer Science","author":"Kati\u0107","year":"2009"},{"key":"S0956796813000117_ref8","first-page":"111","volume-title":"Partial Evaluation and Program Manipulation (PEPM'10)","author":"Brown","year":"2010"},{"key":"S0956796813000117_ref7","volume-title":"Symposium on Trends in Functional Programming (TFP'11)","author":"Brown","year":"2011"},{"key":"S0956796813000117_ref6","unstructured":"Brown C. (2008) Tool Support for Refactoring Haskell Programs. PhD thesis, School of Computing, University of Kent, Kent, UK."},{"key":"S0956796813000117_ref1","volume-title":"Proceedings of the 9th International Conference on Automated Technology for Verification and Analysis (ATVA'11)","author":"Alglave","year":"2011"},{"key":"S0956796813000117_ref4","doi-asserted-by":"publisher","DOI":"10.1109\/WCRE.1995.514697"},{"key":"S0956796813000117_ref65","doi-asserted-by":"publisher","DOI":"10.1109\/TSE.2004.1265817"},{"key":"S0956796813000117_ref63","doi-asserted-by":"publisher","DOI":"10.1145\/1411273.1411285"},{"key":"S0956796813000117_ref50","volume-title":"19th International Symposium on Implementation and Application of Functional Languages (IFL 2007)","author":"Li","year":"2007"},{"key":"S0956796813000117_ref3","first-page":"49","article-title":"A program for identifying duplicated code","volume":"24","author":"Baker","year":"1992","journal-title":"Comput. Sci. Stat."},{"key":"S0956796813000117_ref39","volume-title":"14th International Erlang\/OTP User Conference","author":"Kitlei","year":"2008"},{"key":"S0956796813000117_ref77","doi-asserted-by":"publisher","DOI":"10.1145\/1869459.1869485"},{"key":"S0956796813000117_ref69","unstructured":"NetBeans. (n.d.) Wiki entry on refactoring. Available at: http:\/\/wiki.netbeans.org\/Refactoring. Accessed 6 September 2013."},{"key":"S0956796813000117_ref47","doi-asserted-by":"publisher","DOI":"10.1109\/TSE.2006.28"},{"key":"S0956796813000117_ref38","doi-asserted-by":"publisher","DOI":"10.1145\/1863509.1863517"},{"key":"S0956796813000117_ref80","volume-title":"Workshop on Partial Evaluation and Program Manipulation","author":"Sultana","year":"2008"},{"key":"S0956796813000117_ref44","volume-title":"Proceedings of the Sixth European Conference on Software Maintenance and Reengineering (CSMR '02)","author":"Leit\u00e3o","year":"2002"},{"key":"S0956796813000117_ref22","unstructured":"Gallardo D. (n.d.) Refactoring for Everyone: How and Why to use Eclipse's Automated Refactoring Features. Available at: http:\/\/www.ibm.com\/developerworks\/library\/os-ecref\/. Accessed 6 September 2013."},{"key":"S0956796813000117_ref64","unstructured":"Marlow S. (ed). (2010) Haskell 2010 language report. Available at: http:\/\/www.haskell.org\/onlinereport\/haskell2010\/. Accessed 6 September 2013."},{"key":"S0956796813000117_ref45","unstructured":"Li H. (2006) Refactoring Haskell programs. PhD thesis, School of Computing, University of Kent, Canterbury, Kent, UK."},{"key":"S0956796813000117_ref9","first-page":"51","volume-title":"Spring Young Researchers Colloquium on Software Engineering (SYRCoSE)","author":"Bulychev","year":"2008"},{"key":"S0956796813000117_ref71","unstructured":"Opdyke W. F. (1992) Refactoring Object-Oriented Frameworks. PhD thesis, University of Illinois at Urbana-Champaign, IL."},{"key":"S0956796813000117_ref46","volume-title":"Improving Your Test Code with Wrangler","author":"Li","year":"2009"},{"key":"S0956796813000117_ref2","unstructured":"Armstrong J. (2007) Programming Erlang: Software for a Concurrent World. The Pragmatic Bookshelf."},{"key":"S0956796813000117_ref42","first-page":"143","volume-title":"Selected Papers from the 1st Scottish Functional Programming Workshop","author":"L\u00e4mmel","year":"2000"},{"key":"S0956796813000117_ref76","first-page":"13","volume-title":"Principles and Practice of Declarative Programming (PPDP'09)","author":"Sagonas","year":"2009"},{"key":"S0956796813000117_ref32","unstructured":"Haskell Platform. (2010) The Haskell Platform. Available at: http:\/\/hackage.haskell.org\/platform\/. Accessed 6 September 2013."},{"key":"S0956796813000117_ref19","unstructured":"ErlIDE. (n.d.) The Erlang IDE. Available at: http:\/\/erlide.sourceforge.net\/. Accessed 6 September 2013."},{"key":"S0956796813000117_ref54","volume-title":"Twelfth International Symposium on Practical Aspects of Declarative Languages (PADL10)","author":"Li","year":"2010"},{"key":"S0956796813000117_ref73","doi-asserted-by":"publisher","DOI":"10.1002\/(SICI)1096-9942(1997)3:4<253::AID-TAPO3>3.0.CO;2-T"},{"key":"S0956796813000117_ref17","first-page":"75","volume-title":"Proceedings of the 2010 ACM SIGPLAN Erlang Workshop (Erlang'10)","author":"Drienyovszky","year":"2010"},{"key":"S0956796813000117_ref5","doi-asserted-by":"publisher","DOI":"10.1016\/j.scico.2007.11.003"},{"key":"S0956796813000117_ref13","volume-title":"An Introduction to Programming in Emacs Lisp","author":"Chassell","year":"2004"},{"key":"S0956796813000117_ref81","first-page":"28","volume-title":"Brazilian Symposium on Programming Languages","author":"Thompson","year":"2003"},{"key":"S0956796813000117_ref53","first-page":"157","volume-title":"10th IEEE International Working Conference on Source Code Analysis and Manipulation","author":"Li","year":"2010"},{"key":"S0956796813000117_ref74","doi-asserted-by":"publisher","DOI":"10.1016\/j.scico.2009.02.007"},{"key":"S0956796813000117_ref21","volume-title":"Refactoring: Improving the Design of Existing Code","author":"Fowler","year":"1999"}],"container-title":["Journal of Functional Programming"],"original-title":[],"language":"en","link":[{"URL":"https:\/\/www.cambridge.org\/core\/services\/aop-cambridge-core\/content\/view\/S0956796813000117","content-type":"unspecified","content-version":"vor","intended-application":"similarity-checking"}],"deposited":{"date-parts":[[2026,5,26]],"date-time":"2026-05-26T22:36:30Z","timestamp":1779834990000},"score":1,"resource":{"primary":{"URL":"https:\/\/www.cambridge.org\/core\/product\/identifier\/S0956796813000117\/type\/journal_article"}},"subtitle":[],"short-title":[],"issued":{"date-parts":[[2013,5]]},"references-count":86,"journal-issue":{"issue":"3","published-print":{"date-parts":[[2013,5]]}},"alternative-id":["S0956796813000117"],"URL":"https:\/\/doi.org\/10.1017\/s0956796813000117","relation":{},"ISSN":["0956-7968","1469-7653"],"issn-type":[{"value":"0956-7968","type":"print"},{"value":"1469-7653","type":"electronic"}],"subject":[],"published":{"date-parts":[[2013,5]]}}}