Refactorings that Split and Merge Programs

Christopher Brown, Simon Thompson · Kent Academic Repository (University of Kent) · 2007

Abstract. Program slicing is a well understood concept in the imperative paradigm, but so far there has been little work on program slicing in the context of functional languages. This paper describes a program slicing technique for Haskell that takes tuple-returning functions apart (called splitting); the converse of this is also described (called merging). The slicer is implemented as a transformation for the Haskell Refactorer, HaRe. Splitting functions is a useful transformation to allow the programmer to extract a particular subset of the functionality of a tuplereturning function into a new definition. Merging is a useful transformation because it allows many definitions to be merged together, thus eliminating duplicate code and encouraging code reuse. Splitting and merging can help to reduce dead code and increase program productivity and can be also used for debugging purposes. 1

Read the paper · More papers on PaperTik