
Nicolas Frisby
writes: Disclaimer: I didn't read all of the previous emails. Does this do what you need?
I'm on GHC 7.4 at the moment, but I think this will work with later versions.
HTH.
Thank you Nicolas (and yes it works on GHC 7.6). It does look 'cleaner' than the version I posted. But I still see plenty of pileups of (type and data) constructors. However, perhaps it looks 'cleaner' because it doesn't work in the corner cases you could have seen discussed in the previous emails? * There's no instance for the unit tuple `toAttrs ()` -- that's easily fixed: instance ToAttrsR U1 where toAttrsR _ = [] * It crashes '*** Exception: Prelude.undefined' when toAttrs' argument is undefined. I tried a quick fix to the (:*:) instance, similar to my version, but that wasn't enough. * (And a minor point: I wanted to be able to go feed toAttrs' output tuple into itself. -- that's fixable easily enough. My version for a bonus also grabbed the newtype's data constructor. -- that's also fixable, I think.) AntC