</blockquote><div><br>You can use the Template Haskell deriving in EMGM to get that structure pretty efficiently.<br><br> <a href="http://www.cs.uu.nl/wiki/GenericProgramming/EMGM">http://www.cs.uu.nl/wiki/GenericProgramming/EMGM</a><br>