Fixes to datacon wrappers for indexed data types
nominolo@gmail.com pointed out (Trac #1204) that indexed data types
aren't quite right. I investigated and found that the wrapper
functions for indexed data types, generated in MkId, are really very
confusing. In particular, we'd like these combinations to work
newtype + indexed data type
GADT + indexted data type
The wrapper situation gets a bit complicated!
I did a bit of refactoring, and improved matters, I think. I am not
certain that I have gotten it right yet, but I think it's better.
I'm committing it now becuase it's been on my non-backed-up laptop for
a month and I want to get it into the repo. I don't think I've broken
anything, but I don't regard it as 'done'.