Refactoring Functional Programs
We might program in an
exploratory way: first establishing the functionality we seek,
and then refactoring into a more elegant form. We suspect that
functional languages are particularly suited to this form of programming,
because their clean semantic basis makes wholesale
transformations more feasible than for a language in the C family, say.
The site contains a
catalog of Haskell refactorings a
case study
in refactoring student "Semantic Tableaux" programs
(propositional logic background here), a
presentation,
source code for the refactoring example,
and a difference utility.
Here's a rough distribution of refactorings in the catalog:
types (7), function input arguments (4), case switches (2),
monads (1), folds (1), set comprehensions (1), iteration/fixed point (1).
Refactoring might be a useful tool in getting people
to adopt functional languages in .NET,
SML.NET
and F#,
when they have a comparative advantage over the languages that everyone is familiar with:
Java, C++, and C#.
|