Refactorings for Haskell

This is a catalogue of refactorings for the functional programming language Haskell, some of which are implemented in the Haskell Refactorer, HaRe, built by the Refactoring Functional Programs project.

Items in the catalogue are described by a schema.

Catalogue of refactorings

Add or remove an argument
Algebraic or existential type
Concrete to Abstract Data Type
Constructor or constructor function
Delete/Add a definition
Introduce or remove a duplicate definition
Simple folding/unfolding
Generalise or specialise a definition
Inside or Outside the ADT
Layered data types
Memoisation
Monadification (variant 1)
Widen or narrow definition scope
Widen or narrow definition scope, with compensation (generalise/specialise)
Renaming
Add Constructor
Convert Data Type to Newtype
Remove Dead Code
Merge Definitions
Splitting a definition

Categories

The refactorings in the catalogue come in a number of (non-exclusive) categories. A category tends to determine the conditions that will apply to the refactoring being applied successfully. The current categories are:

Data
MultiModule
Naming

Other refactorings

Refacotrings are a particular sort of program transformation. The folding transformation, first described by Burstall and Darlington, is not simply a program to program rewriting; it requires a record of previous definitions of an indentifier in order to be implemented successfully.

Other refactorings that we intend to implement in the Haskell Refactorer, together with some refactoring challenges and not-quite-refactorings, are listed here.