`Coercible` ought to work for recursive newtypes
The approach (developed by SPJ and me) is to
A) Add a feature to the constraint solver to prevent recursive dictionaries for specially marked instances (for now only used for Coercible
). Rationale: Such dictionaries (which are fine for most classes like Show
) would make coerce
diverge. Implementation: Use the depth counter and do not use lower depths to solver constraints with a higher depth. This is of course a very conservative approximation, but should be sufficient.
B) Use the regular constraint depth bound to prevent looping at compile time. In order for that to be more useful, count constraint solving and type function resolving separately.