The Haskell Refactoring Tool
Haskell TeX HTML Yacc Emacs Lisp Shell Other
#22 Compare This branch is 47 commits ahead, 3 commits behind RefactoringTools:master.
Latest commit 681c0b8 Mar 1, 2016 @alanz More tweaks
Failed to load latest commit information.
docker wip Mar 9, 2014
docs Typo May 17, 2014
elisp Fix backup problems on Windows (a path can't contain colons) Jan 29, 2016
experiments Starting to integrate DualTree Dec 5, 2013
hareview Capture latest hareview state, to clean up workspace Sep 12, 2012
hcar Do not want to commit to "speeding up" Oct 30, 2015
old Getting rid of some old files no longer needed. Jul 28, 2013
src More tweaks Mar 1, 2016
test Some cleaning up Feb 29, 2016
.ghci MoveDef tests now pass Sep 23, 2015
.gitignore Draft HCAR Nov 2015 entry Oct 30, 2015
.travis.yml Update travis to use GHC 7.10.3 Jan 6, 2016
ChangeLog Update to use ghc-mod 5.5, ready for HaRe Jan 20, 2016
GHC-NOTES Cleanup and introduce rdrName2Name Jan 25, 2015
HaRe.cabal Remove Binds module Feb 21, 2016
HaReLogo.svg Doc tweaks Dec 16, 2013 Setting lower bound on Diff dependency. Closes #7 Oct 21, 2013
LICENSE Update license May 15, 2014
NOTES Minor Nov 5, 2015 Revert GHC API docs links Jan 30, 2016
Setup.hs Adding files that are in the hackage HaRe- package, but not in… Jul 22, 2012
TODO Remove trailing whitespace Jan 23, 2015 Update TODO Aug 5, 2015 WIP. Does not want to load files properly if not in project directory Jan 26, 2014 rename refactor handles names in client modules Oct 4, 2015 Cleaning up Dec 4, 2012 Update the NameMap construction for GHC 8.0 Feb 24, 2016 Experimenting with docker Feb 4, 2014
stack-travis.yaml Rework RefactGhc use of GhcModT Oct 1, 2015
travis_long stack based travis build, with caching Aug 5, 2015

HaRe : The Haskell Refactorer

Home is now

HaRe can rename symbols, lift definitions, convert equivalent Haskell constructs like ifs and cases and more while preserving program semantics, types and correctly handling indentation. Only HaRe can execute identity transformation!

Available on Hackage License BSD3 Build Status Stackage LTS Stackage Nightly


  • GHC versions up to 7.6.3 are supported via HaRe version
  • GHC version 7.8.x is NOT supported, and never will be
  • GHC version 7.10.2 and up is supported for HaRe >=


HaRe will only work for projects using GHC 7.10.2 for compilation. Compiling HaRe with 7.10.2 and then using it against projects using an earlier compiler will not work, as HaRe needs to be able to invoke GHC to the type checker stage on the project using GHC 7.10.2.


Getting Started

cabal install HaRe
stack install HaRe --resolver=lts-4.0

Check that it works from the command line

$ ghc-hare --version

Running the bare command lists available refactorings and their parameters

Emacs integration

Currently only emacs integration is offered. Add the following to your ~/.emacs using the load-path entry that matches the installation on your machine.

(add-to-load-path "~/.cabal/share/x86_64-linux-ghc-7.10.2/HaRe-")
(require 'hare)
(autoload 'hare-init "hare" nil t)

Add an intializer hook to the ghc-mode command

(add-hook 'haskell-mode-hook (lambda () (ghc-init) (hare-init)))

Alternatively, if using haskell-mode, and initializing via a function

;; Haskell main editing mode key bindings.
(defun haskell-hook ()

  ;(lambda nil (ghc-init))

If this is done correctly, there should be an additional Refactorer menu entry when opening a haskell file. The refactorings can be initiated via the menu, or using the keyboard shortcuts displayed in the menu.

The installation can be fine-tuned using

M-x customize-variable



Each refactoring will first ask for any information it requires, e.g. a new name if renaming, and then attempt the refactoring. If any precondition is not met this will be reported and the refactoring will abort.

If it succeeds, you will be given the option to look at an ediff session to see what changes would be made, and each file can be individually accepted or declined.

If the refactoring is commited, the original file is renamed to have a suffix containing the current timestamp.

E.g., after renaming in Foo.hs, there will be two files


This allows a sequence of refactorings to be undone manually if required. In theory.

VIM integration


Development & Support

Join in at #haskell-refactorer on freenode.

Note: (2015-10-04) HaRe cannot be tested using stack. It can be built, but the tests will fail, as HaRe makes use of ghc-mod as a library and the interaction between stack, ghc-mod and cabal-helper does not work for the tests.

Running test suite

To run the test suite do:

cabal test

The script simply makes sure that all the cabal projects used in the tests are also configured.

See for details on hspec

see for continuous build results


Coding style

Contributors: please try to follow Note:A consistent coding layout style is more important than what specific on is used.


  • Alan Zimmerman
  • Christopher Brown
  • Francisco Soares
  • Gracjan Polak
  • Harald Jagenteufel
  • Huiqing Li
  • Matthew Pickering
  • Simon Thompson

Please put a pull request for this list if you are missing.


The logo was designed by Christi du Toit,