Personal tools


From HaskellWiki

Revision as of 09:16, 3 September 2010 by Chrisbrown (Talk | contribs)

Jump to: navigation, search

1 The HaRe Project

Currently, HaRe is a full Haskell 98 refactoring tool for automated refactoring of Haskell 98 programs. It is integrated with Emacs and Vim. Future plans are to extend support for Haskell 2010 and other language extensions.

The project is lead by Chris Brown.

1.1 Roadmap (sketch)

  • API decisions (ghc-api/ programmatica/ haskell-src-exts)
  • Extending refactorings to cope with new extensions
  • Simpler generics for tree traversals.
  • Query / transform language support
  • Better examples, user extension documentation
  • Maintainance and portability long term.
  • Possibly use Scion, to abstract editor<- scion-{hare} ->ghc-api layer.

1.2 Infrastructure

  • HaRe is currently built upon the Programatica project for access to an AST and Token Stream and Strafunski for generic tree traversal.
  • HaRe uses the Programatica front-end to parse full Haskell projects into an AST with static semantics, and a token stream. Programatica's token stream contains layout and comments together with position information, which HaRe uses (in combination with the AST) to pretty-print the refactored programs. HaRe attempts to produce refactored output that looks as close as possible to the original program.
  • Strafunski is used for tree traversal and transformation. In particular, Strafunski has a powerful and expressible mode of traversal, allowing all nodes, some nodes or one node to be traversed/transformed.
  • Static semantics are vital for refactorings that require binding information of variables. Renaming, for instance, renames all occurrences of a name within its scope. This scope information is currently retrieved from the AST. In addition to this, static semantics are also vital for HaRe to identify particular expressions for refactoring and to also pretty-print the refactored output (together with the token stream).
  • The refactorings in HaRe are relativity low level, working directly on the AST for transformation. An underlying API is used to build the transformations and queries.
  • Some refactorings require types, which are retrieved using hint.
  • HaRe is integrated into Emacs and VIm: when a new refactoring is added, the build system generates the Emacs and VIm scripts automatically.