+ -- For each AT argument compute the position of the corresponding class
+ -- parameter in the class head. This will later serve as a permutation
+ -- vector when checking the validity of instance declarations.
+ setTyThingPoss [ATyCon tycon] atTyVars =
+ let classTyVars = hsLTyVarNames tvs
+ poss = catMaybes
+ . map (`elemIndex` classTyVars)
+ . hsLTyVarNames
+ $ atTyVars
+ -- There will be no Nothing, as we already passed renaming
+ in
+ ATyCon (setTyConArgPoss tycon poss)
+ setTyThingPoss _ _ = panic "TcTyClsDecls.setTyThingPoss"