
Hi Thinking about this slightly further...
For the implementation, Data.Derive has a special case for lists, tuples and Maybe. Its a shame that only a restricted number of types are supported - things like Data.Map/Data.Set can be supported perfectly, apart from restrictions in Template Haskell.
There are two cases. 1) The data structure contains values, in specific places. Lists, tuples, Either etc. are all like this. The rules in the paper cover all these situations. 2) The data structure contains values, but their place is a feature of the data structure - i.e. Map/Set. In this case the right thing to do is probably to do fromList/toList pairs on them. I'll modify the derive tool to take this into account. I've never seen any comments on the effect of using SYB with data structures containing invariants such as Map's. I guess SYB can break these invariants quite easily, so should be used with care in some places. Thanks Neil