Tutorial: DIY Refactoring in Wrangler

« back to Presentations Download Presentation Download

Wrangler is an Erlang refactoring tool which provides a range of refactorings – including renaming, function extraction and generalisation – as well as facilities for clone detection and removal as well as improvement of the module structure of projects. Wrangler is integrated into emacs and Eclipse (via ErlIDE).

Up to now, you could only use the refactorings built into Wrangler, or dive deep into the internals to extend it. The latest version of Wrangler now provides a much easier way of defining and applying refactorings for yourself. All you need to do is implement them as a refactoring behaviour and they are accessible in emacs, and you can write descriptions of what the refactorings do using a combination of Erlang macros and templates that describe the particular changes to be made. You can also use the same facilities write new forms of code inspection equally easily.

As well as being able to write new refactorings from scratch, we’re providing a scripting language in which you can build complex refactorings by putting together simpler components: this can, for example, provide a mechanism for migrating from an old to a new API, or for transforming the data type forming the input/output of a collection of functions.

After giving an overview of the DIY facilities we’ll help you to get started writing your own refactorings and scripts.


  • Simon Thompson

    Creator of Wrangler and co-author of Erlang Programming
    The University of Kent

    Simon Thompson is Professor of Logic and Computation in the Computing Laboratory of the University of Kent, where he has taught computing at undergraduate and postgraduate levels for the past twenty five years, where he was department head 2002-2009.

    His research work has centered on functional programming: program verification, type systems, and most recently development of software tools for functional programming languages. His team has built the HaRe tool for refactoring Haskell programs, and is currently developing Wrangler to do the same for Erlang. His research has been funded by various agencies including EPSRC and the European Framework programme. His training is as a mathematician: he has an MA in Mathematics from Cambridge and a D.Phil. in mathematical logic from Oxford.

    He has written four books in his field of interest; Type Theory and Functional Programming published in 1991; Miranda: The Craft of Functional Programming (1995), Haskell: The Craft of Functional Programming (3rd ed. 2011) and Erlang Programming (with Francesco Cesarini, 2009). Apart from the last, which is published by O'Reilly, these are all published by Addison Wesley.

    Twitter: @thompson_si

    Simon Thompson
« back to Presentations

Posted on October 31, 2011