Using associated data types to create unpacked data structures

Bryan O'Sullivan bos at
Wed Aug 11 12:25:03 EDT 2010

On Wed, Aug 11, 2010 at 9:03 AM, Johan Tibell <johan.tibell at>wrote:

> However, if we try to apply this method to large programs we run into
> problems: we need to defined instances for a large number of combinations of
> keys/values. We could generate a large number of instances, hoping that
> these will be enough for most users' needs, using Template Haskell or CPP.
> However, the potential number of instances is very large, about a hundred if
> you consider only Prelude types and tens of thousands if you include tuples.
> We cannot add instances for types not defined in base without adding a
> dependency on all libraries which data types we want to add instances for.

This is more or less the type-level version of the "I have to write how many
boilerplate instances?" problem that dogs typeclasses. I agree that it's
quite painful, and that it effectively keeps type families from being nearly
as practically useful as they could be. Like you, I'd love to see an
effective solution.
-------------- next part --------------
An HTML attachment was scrubbed...

More information about the Glasgow-haskell-users mailing list