[Haskell] ANNOUNCE: HaRe, the Haskell Refactorer 0.6
Chris BROWN
chrisb at cs.st-andrews.ac.uk
Mon Jun 28 07:37:13 EDT 2010
Dear Haskellers,
As part of our project on Refactoring Functional Programs
http://www.cs.kent.ac.uk/projects/refactor-fp/
we are pleased to announce the availability of HaRe 0.6 (also known as
HaRe 28/06/2010), a snapshot of our Haskell Refactorer prototype. Apart
from bug-fixes, there are major changes since HaRe 0.5 and HaRe 0.4:
A number of new refactorings have been added to HaRe. Some of these
include:
Adding and removing fields and constructors to data-type definitions,
folding and unfolding against as-patterns, merging and splitting,
converting between let and where constructs, introduce pattern matching,
generative folding, and a clone detection and elimination tool.
We have evolved the ongoing architecture of HaRe and derived an API
(documented using Haddock) for program analysis and transformation.
This allows HaRe to serve as a framework for end-users to build their
own refactorings or just program transformations (or analyses).
HaRe is available to download directly from here:
http://www.cs.kent.ac.uk/projects/refactor-fp/hare/HaRe_28062010.tar.gz
You can get HaRe 0.6 and the documentation about how to build your own
refactorings via:
http://www.cs.kent.ac.uk/projects/refactor-fp/hare.html
Please see the README.txt for build/use instructions and known issues,
and let us know about any problems, bugs, suggestions or additional
platforms you can confirm as working.
You will need:
1. ghc-6.12.1
2. hint-0.3.2.3 (available from cabal)
3. unix/gnu tools (or cygwin tools, if on windows)
4. vim or emacs (we've tested with gvim 6.2 and with emacs 21.4)
5. If you intend on running the test suite, HUnit-1.0.
Happy Refactoring!
The HaRe Team (Chris Brown, Huiqing Li, Simon Thompson)
Project email: refactor-fp at kent.ac.uk<http://www.haskell.org/mailman/listinfo/haskell>
Background:
Refactoring is the process of changing the structure of programs
without changing their functionality, i.e., refactorings are
meaning-preserving program transformations that implement design
changes. For more details about refactoring, about our project and
for background on HaRe, see our project pages.
HaRe - the Haskell Refactorer:
HaRe is our prototype tool supporting a collection of refactorings
for Haskell 98 (see README.txt for known issues and limitations).
It is implemented as a separate refactoring engine (on top of
Programatica's Haskell frontend and Strafunski's generic traversal
strategy library), with small scripting frontends that call this
engine from either Vim or Emacs.
Currently supported refactorings:
Introduce Pattern Match : place cursor over pattern variable
Introduce Sub pattern : place cursor over pattern variable
Introduce Case Expression : place cursor over pattern variable
Generative Fold : highlight expression to fold.
Must have equation in comment directly before
definition of highlighted expression.
Clone Analysis : select from menu
Clone Extraction : highlight clone from the clone class to extract, follow
step-by-step instructions.
Converting Let to Where : place cursor at start of identifier whose
definition is to be moved
Converting Where to Let : place cursor at start of identifier whose
definition is to be moved.
create type signatures : select from menu
remove redundant declarations
: highlight definition to clean up
add constructor to data
type : place cursor at start of data type, you'll
be prompted to add the new Constructor
name, followed by any Type parameters as a
complete string
Split a tuple : place cursor at start of top level definition that
returns a tuple.
Slicing based on a subexpression
: highlight sub-expression to extract.
Instantiate a general pattern
: select a function equation and enter
the new instances for each pattern in the argument set.
Extract an expression : highlight an expression within a definition
Convert data type to
newtype : place cursor at start of data type
add definition to merge : place cursor at start of definition that is to be merged
merge definitions : use "add definition for merge" for each definition to be merged.
then choose merge definitions from menu.
fold function definition : highlight function equation to fold against.
fold constant definition : highlight constant equation to fold against.
convert pattern to an as pattern
: highlight pattern to convert.
unfold references to as patterns
: place cursor over as pattern name.
remove field from a data type
: place cursor at start of field to remove.
add field to data type
: place cursor over start of constructor.
enter new field name.
add debug information : add trace calls to function by placing cursor at the
start of the function to trace
rename : place cursor at start of identifier to
be renamed, you'll be prompted for a
new name
Lift def to top level : place cursor at start of identifier
whose definition is to be moved
Lift def one level : place cursor at start of identifier
whose definition is to be moved
Demote : place cursor at start of identifier
whose definition is to be moved
Introduce new def : highlight expression to be named,
you'll be prompted for a new name
Unfold def : place cursor at start of identifier
where its definition is to be unfolded
Generalise def : place cursor at start of identifier
where its definition is to be unfolded
Remove def : place cursor at start of identifier
whose definition is to be removed
Duplicate def : place cursor at start of identifier
whose definition is to be duplicated,
you'll be prompted for a new name
Add one parameter : place cursor at start of identifier
whose definition is to be modified,
you'll be prompted for a new name
rm one parameter : place cursor in formal parameter
which is to be removed
Move def to another module : place cursor at start of the identifier
whose definition is to be moved, you'll
be prompted for the module name
Clean imports : cursor position does not matter, just
choose the command from the refactor menu
Make import explicit : place cursor at the start of the module
name in the import declaration
Add to export : place cursor at start of the identifier
which is to be added to the export
Remove from export : place cursor at start of the entry to
be removed in the export list
From concrete to abstract data type: place cursor at start of the data type name
Add field names : place cursor at start of the data type name
Add discriminators : place cursor at start of the data type name
Add constructors : place cursor at start of the data type name
Eliminate nested patterns : place cursor at start of the data type name
Eliminate patterns : place cursor at start of the data type name
Create an ADT module : place cursor at start of the data type name
Eliminate intermediate list: cursor position does not matter, just choose
the command from the menu.
Caveats (see also README.txt):
Please keep in mind that this is a prototype, so we do not recommend
to use it on your productions sources just yet. Just play with it
to get an idea of tool-supported refactoring in Haskell, and send us
your feedback and bug-reports. Our goal is to develop this into a
tool that many of you will find indispensable for Haskell
development.
Regards,
The HaRe team.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell/attachments/20100628/b93ade23/attachment-0001.html
More information about the Haskell
mailing list