-isTyConAssoc = isJust . assocTyConArgPoss_maybe
-
--- | Set the AssocFamilyPermutation structure in an
--- associated data or type synonym. The [TyVar] are the
--- class type variables. Remember, the tyvars of an associated
--- data/type are a subset of the class tyvars; except that an
--- associated data type can have extra type variables at the
--- end (see Note [Avoid name clashes for associated data types] in TcHsType)
-setTyConArgPoss :: [TyVar] -> TyCon -> TyCon
-setTyConArgPoss clas_tvs tc
- = case tc of
- AlgTyCon { algTcRhs = rhs } -> tc { algTcRhs = rhs {otArgPoss = Just ps} }
- SynTyCon { synTcRhs = OpenSynTyCon ki _ } -> tc { synTcRhs = OpenSynTyCon ki (Just ps) }
- _ -> pprPanic "setTyConArgPoss" (ppr tc)
- where
- ps = catMaybes [tv `elemIndex` clas_tvs | tv <- tyConTyVars tc]
- -- We will get Nothings for the "extra" type variables in an
- -- associated data type