[Haskell] ANN: Uniplate 1.2

Neil Mitchell ndmitchell at gmail.com
Tue Jul 8 07:31:14 EDT 2008


I am pleased to announce Uniplate 1.2, available from Hackage:

http://hackage.haskell.org/cgi-bin/hackage-scripts/package/uniplate

Description
===========

Uniplate is a library for reducing boilerplate code, by performing
generic traversals. For example, given a data type with a Uniplate
instance:

data Expr = Var String | Add String String | Mul String String | ...

instance Uniplate Expr where ...

We can write a function to get all the variables in an Expr as:

vars x = [v | Var v <- universe x]

Additionally, Uniplate can work with the built-in deriving
Data/Typeable support in GHC to eliminate the need for writing
Uniplate instances. The library is described in Chapter 3 of my thesis
(http://www-users.cs.york.ac.uk/~ndm/thesis/), complete with simple
examples for most functions.

Most Haskell users working with a moderately complex data type, such
as an abstract syntax tree, should be using some form of boilerplate
removal. Uniplate is used in projects such as Yhc, Hoogle, Reach,
Reduceron, Catch, Supero and many others.


What's New
==========

* Fixed the descendBi function, previously could give the wrong results.

* Add holes, the 1-step version of contexts

* The underlying data type of the library has been changed from a list
to a tree, as suggested by Koen Claessen. This change, plus some other
performance tweaks, gives a 25-50% speed up over Uniplate 1.0.

* A compatibility layer with Compos and SYB has been added. By
importing Data.Generics.Uniplate.Compos/SYB an interface approximating
the other library will be provided, which can be used to help porting
programs to Uniplate. The implementations are not exact duplicates of
the library, but in many examples should be sufficient.

There are some slight API changes, but should be minimal. If your
program hits one of these changes, please email me and I will fix it
for you.

Thanks

Neil


More information about the Haskell mailing list