[Haskell-cafe] ANNOUNCE: Extensible and Modular Generics for the Masses: emgm-0.3

Sean Leather leather at cs.uu.nl
Tue Mar 3 06:57:05 EST 2009

Extensible and Modular Generics for the Masses

Extensible and Modular Generics for the Masses (EMGM) is a library for
generic programming in Haskell using type classes and a
sum-of-products view.


emgm-0.3 is the third major release, and it arrives a little over a
month after emgm-0.2.

Deriving is now greatly improved! Due to recent reports from users, we
realized the current implementation just wasn't going to cut it. EMGM
already supports a wide range of datatypes, so why not make the
deriving code support just as many. Hopefully, it works well for you.
Please let us know if your datatype is not supported.

There are several new functions in the EMGM family. These include:
cast (a type-safe, configurable, generic cast) and everywhere and
everywhere' (functions similar to those of the same name in SYB that
apply a transformation everywhere a certain type is found).


Changes from emgm-0.2 include:

*  Improved deriving can now handle datatype collections like this one:


*  cast function

> cast :: Rep (Map a) b => a -> b

*  everywhere and everywhere'

> everywhere :: Rep (Everywhere a) b => (a -> a) -> b -> b
> everywhere' :: Rep (Everywhere' a) b => (a -> a) -> b -> b

They both perform transformations on a-values in a b-value. The former
does them bottom-up, the latter top-down. The names come from similar
functions in SYB that use rank-2 types. Note the difference.

> everywhere :: (forall a. Data a => a -> a) -> forall a. Data a => a -> a
> everywhere' :: (forall a. Data a => a -> a) -> forall a. Data a => a -> a

Known Issues

Due to a problem with the template-haskell package and Cabal, you
cannot cabal-install the emgm package with GHC 6.8. However, take
heart! EMGM works very well with GHC 6.8. You merely have to download
the tar.gz package from Hackage yourself, build it, and install it.
Since it doesn't require any dependencies beyond what comes with GHC,
installation is a breeze!

General Information

Visit the home page:


General Features

The primary features of EMGM include:

*  Datatype-generic programming using sum-of-product views
*  Large collection of ready-to-use generic functions
*  Included support for standard datatypes: lists, Maybe, tuples
*  Easy to add support for new datatypes
*  Type classes make writing new functions straightforward in a
structurally inductive style
*  Generic functions are extensible with ad-hoc cases for arbitrary datatypes
*  Good performance of generic functions

The features of this distribution include:

*  The API is thoroughly documented with Haddock
*  Fully tested with QuickCheck and HUnit
*  Program coverage ensures that all useful code has been touched by tests
*  Tested on both Mac and Windows systems


EMGM has the following requirements:

*  GHC 6.8.1 - It has been tested with versions 6.8.3 and 6.10.1
*  Cabal library 1.2.1 - It has been tested with versions and

Download & Source

Use caball-install:

 cabal install emgm

Get the package:


Check out the current source with Subversion:

 svn checkout https://svn.cs.uu.nl:12443/repos/dgp-haskell/EMGM/trunk

Or view it online:



Check out the examples:


Bugs & Support

Report issues or request features:


Discuss EMGM with the authors, maintainers, and other interested persons:



The research for EMGM originated with Ralf Hinze. It was extended with
work by Bruno Oliveira and Andres Löh. More details of the library
functionality were explored by Alexey Rodriguez. We are very grateful
to all of these people for the foundation on which this library was

The current authors and maintainers of EMGM are:

*  Sean Leather
*  José Pedro Magalhães
*  Alexey Rodriguez
*  Andres Löh

More information about the Haskell-Cafe mailing list