[Haskell-cafe] [GSoC] Porting HaRe to use the GHC API

Chaddaï Fouché chaddai.fouche at gmail.com
Sat Mar 29 10:10:37 EDT 2008

For those unfamiliar with it, HaRe[1] is a refactoring tool in Haskell
for Haskell. It already supports a wide range of useful refactoring
and have Emacs and Vim bindings. Unfortunately, HaRe currently uses
the Programmatica front-end to do his parsing, and Programmatica only
knows Haskell 98, which make the tool far less useful for those that
use GHC extensions in their programs. Moreover, Haskell' is bound to
arrive one day and will encompass some of those extensions.

My proposal for the SoC is to port HaRe (its parsing and refactoring)
to use the GHC API instead of Programmatica. The advantages are :

* GHC API already supports (by definition) all the GHC extensions,
HaRe could be used for any Haskell program.
* GHC development is unlikely to stop in the foreseeable future, thus
HaRe could evolve with the language rather than having to catch up
from time to time.
* A certain number of refactoring can be added that exploit the GHC extensions
* The GHC API is becoming a mature and generally useful tool, having
more libraries that use it can't hurt its growth

There already has been some works done to port HaRe to the GHC API in
2005 that did not run to completion but the API has evolved for the
better since then and using this report [2] and the current API, I
hope to complete the port during the summer. I'm familiarizing myself
with the GHC API, Programmatica, Strafunski and HaRe and I'll do an
internship at the university of Kent for three months in the summer,
which should place me in the best situation to do this work.

Refactoring is an important feature of the modern IDE, often quoted by
the newcomers who search for the best environment to develop in
Haskell. HaRe addresses this point but isn't usable for most programs
actually written, which is really a shame (consult the list of
supported and future refactoring [3] to get a taste of what you're

Comments, reactions ? You can also propose refactoring, if I complete
the port early, I'll try to add some refactoring to HaRe.

[1] http://www.cs.kent.ac.uk/projects/refactor-fp/hare.html
[2] http://www.cs.kent.ac.uk/pubs/2005/2266/
[3] http://www.cs.kent.ac.uk/projects/refactor-fp/catalogue/

Chaddaï Fouché, student in M1, majoring in CS, Ecole Normale Supérieure in Lyon.

More information about the Haskell-Cafe mailing list