This library (formerly known as 'Play') provides a framework for generic traversals, and is intended to be used in a similar manner to the original Scrap Your Boilerplate paper.
An example of how Uniplate can reduce boilerplate:
data Expr = Add Expr Expr | Val Int | Sub Expr Expr | Var String | Mul Expr Expr | Neg Expr | Div Expr Expr variables :: Expr -> [String] variables (Var x ) = [x] variables (Val x ) =  variables (Neg x ) = variables x variables (Add x y) = variables x ++ variables y variables (Sub x y) = variables x ++ variables y variables (Mul x y) = variables x ++ variables y variables (Div x y) = variables x ++ variables y
The code for variables is not very nice, however, using Uniplate we can rewrite this as:
variables :: Expr -> [String] variables x = [y | Var y <- universe x]
- Geniplate, by Lennart Augustsson, Uniplate compatible but implemented using Template Haskell.
- Refactoring Uniplate, by Sebastian Fischer - proposing a slightly different Uniplate API, but with the same underlying concepts.
- Uniplate for Curry, by Sebastian Fischer - using his revised API as above.
- Uniplate for ML (in MLton), it used to be under mltonlib/trunk/com/ssh/generic/, but I can't find it anymore.
- Uniplate for data types with embedded monads, by Tom Schrijvers
- Multiplate, by Russell O'Connor, similar ideas to Uniplate but with a very different underlying substrate.
- Released version
- Related blog posts
- Uniform Boilerplate and List Processing - from Haskell Workshop 2007 (abstract) (bibtex)
- Playing with Haskell Data - from PLASMA (bibtex)