import Id ( Id )
import Type ( TyThing(..) )
-import Class ( Class, classSelIds, classTyCon )
+import Class ( Class, classSelIds, classTyCon, classATs )
import TyCon ( TyCon, tyConSelIds, tyConDataCons, isNewTyCon, newTyConCo )
import DataCon ( dataConImplicitIds )
import PrelNames ( gHC_PRIM )
-- For classes, add the class TyCon too (and its extras)
-- and the class selector Ids
implicitTyThings (AClass cl) = map AnId (classSelIds cl) ++
- extras_plus (ATyCon (classTyCon cl))
+ extras_plus (ATyCon (classTyCon cl)) ++
+ map ATyCon (classATs cl)
-- For data cons add the worker and wrapper (if any)
implicitTyThings (ADataCon dc) = map AnId (dataConImplicitIds dc)
-- For newtypes, add the implicit coercion tycon
-implicitNewCoTyCon tc | isNewTyCon tc = [ATyCon (newTyConCo tc)]
- | otherwise = []
+implicitNewCoTyCon tc
+ | isNewTyCon tc, Just co_con <- newTyConCo tc = [ATyCon co_con]
+ | otherwise = []
extras_plus thing = thing : implicitTyThings thing