For the "minor point", you'd like for example the following equivalence (modulo decomposing the Attr type)?
toAttrs (FooD 7,BarD True,BazD 'X') == (Attr FooT Int,Attr BarT Bool,Attr BazT Char)
If I understood correctly, take a look at the most recent edit of
http://lpaste.net/97165 The code gets hairier, but you can now say
> example = let (a,_,_) = toAttrs (FooD 7,BarD True,BazD 'X') in a
If you do not specify the "container type" of the result (the pattern suffices in my example), there will be a type-error. Loosening that requirement would require a mapping that includes
f a b goes to f Attr Attr where for example f = (,)
f a b c goes to f Attr Attr Attr where for example f = (,,)
f a b c d goes to f Attr Attr Attr Attr where for example f = (,,,)
and so on
But I don't know how to specify such a general one, since all (instances of) tuple types are distinct types that are not formally related to one another within the GHC type system.
So:
1) Have I understood your specification correctly?
2) Other experts: is there safe trickery to generally specify this map? I think it might actually be doable in 7.4, but as far as I know, that was accidental generally-unsound functionality that was removed in 7.6+.
HTH also.