deriving instances for "hidden" types
Simon Peyton-Jones
simonpj@microsoft.com
Mon, 29 Jul 2002 10:26:47 +0100
| I've often felt a tinge of disappointment not being able to=20
| derive classes over data structures that are defined in the=20
| libraries (DeepSeq FiniteMap, for instance). I was wondering=20
| if any of the tools (drift, etc.) or GHCs built-in meta=20
| programming would allow you to say something like:
|=20
| derive (DeepSeq a, DeepSeq b) =3D> DeepSeq (FiniteMap a b)
I think Hal was only suggesting doing this in case where
the representation of the data structure was visible to the library
client. (As others have said, it's not a good idea if the rep is=20
abstract.)
Template Haskell will be able to do this. Heart transplant operation
is in progress. Blood on floor, but patient still alive.
Simon