Principled subst determination with re-exported Dict module
substituting let variables need some analysis on the nature of the target expressions. Especially, if the expression is Dict type, then we need to have special cares. Unfortunately, Dict can come from different modules from re-export and there are no easy ways to check the equality of those definitions. So in 15465, we have hard-coded two modules Data.Constraint and Barbies.Internal,Dicts, but some other cases may happen in the future, so this should be handled correctly.This may require some change in the ordering of our categorization steps and further module export analysis. So we want to postpone the work until when the approach becomes more clear.
AC:
No more hard-coded re-exported module check in isDictOrBarbiesDictTyCon but detecting such re-export in general way.
(Extricated from https://kitty-hawk.atlassian.net/browse/SW-3418)
Would it be possible to somehow apply Client.Rep and check that type? Barbies.Dict (and any other Dict-like that appears) should have Constraint.Dict as its Rep.
Also, point of clarity – Barbies.Dict isn't a re-export. They're different, roughly
ConstraintDict :: a => ConstraintDict a
BarbiesDict :: c a => BarbiesDict c a
An actual re-export should be trivially seen as Constraint.Dict.