X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Fmain%2FHscTypes.lhs;h=e7df0ba787a5ee7271dc8e0274ea81537b021093;hb=14a3631d5b7a49fef47a221f548dc7d021810de9;hp=29e440e45be776adfbda5901e714e66e2aea4ae4;hpb=bb106f283663e9c16a4c72ec9ca57109ae57a0ed;p=ghc-hetmet.git diff --git a/compiler/main/HscTypes.lhs b/compiler/main/HscTypes.lhs index 29e440e..e7df0ba 100644 --- a/compiler/main/HscTypes.lhs +++ b/compiler/main/HscTypes.lhs @@ -82,8 +82,9 @@ import CoreSyn ( CoreBind ) import Id ( Id ) import Type ( TyThing(..) ) -import Class ( Class, classSelIds, classTyCon, classATs ) -import TyCon ( TyCon, tyConSelIds, tyConDataCons, isNewTyCon, newTyConCo ) +import Class ( Class, classSelIds, classATs, classTyCon ) +import TyCon ( TyCon, tyConSelIds, tyConDataCons, isNewTyCon, + newTyConCo_maybe, tyConFamilyCoercion_maybe ) import DataCon ( dataConImplicitIds ) import PrelNames ( gHC_PRIM ) import Packages ( PackageId ) @@ -105,6 +106,7 @@ import FastString ( FastString ) import DATA_IOREF ( IORef, readIORef ) import StringBuffer ( StringBuffer ) +import Maybe ( catMaybes ) import Time ( ClockTime ) \end{code} @@ -626,24 +628,25 @@ implicitTyThings (AnId id) = [] -- and the selectors and generic-programming Ids too -- -- Newtypes don't have a worker Id, so don't generate that? -implicitTyThings (ATyCon tc) = implicitNewCoTyCon tc ++ +implicitTyThings (ATyCon tc) = implicitCoTyCon tc ++ map AnId (tyConSelIds tc) ++ - concatMap (extras_plus . ADataCon) (tyConDataCons tc) + concatMap (extras_plus . ADataCon) + (tyConDataCons tc) -- For classes, add the class TyCon too (and its extras) - -- and the class selector Ids + -- and the class selector Ids and the associated types (they don't + -- have extras as these are only the family decls) implicitTyThings (AClass cl) = map AnId (classSelIds cl) ++ - extras_plus (ATyCon (classTyCon cl)) ++ - map ATyCon (classATs cl) - + map ATyCon (classATs cl) ++ + extras_plus (ATyCon (classTyCon 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, Just co_con <- newTyConCo tc = [ATyCon co_con] - | otherwise = [] + -- For newtypes and indexed data types, add the implicit coercion tycon +implicitCoTyCon tc + = map ATyCon . catMaybes $ [newTyConCo_maybe tc, + tyConFamilyCoercion_maybe tc] extras_plus thing = thing : implicitTyThings thing