X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Fmain%2FHscTypes.lhs;h=b142d19ac39805953dada93a19bff51362d32566;hb=d76c18e05f6366c23144624b696a02fbaa6d26e8;hp=793b56de5b73e93f13d54678593a45115281d95d;hpb=20f9bf2e066bd22d15a72d6e5efe92c6323bcdbe;p=ghc-hetmet.git diff --git a/compiler/main/HscTypes.lhs b/compiler/main/HscTypes.lhs index 793b56d..b142d19 100644 --- a/compiler/main/HscTypes.lhs +++ b/compiler/main/HscTypes.lhs @@ -83,7 +83,8 @@ import Id ( Id ) import Type ( TyThing(..) ) import Class ( Class, classSelIds, classTyCon ) -import TyCon ( TyCon, tyConSelIds, tyConDataCons ) +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} @@ -618,14 +620,18 @@ mkPrintUnqualified env = (qual_name, qual_mod) \begin{code} implicitTyThings :: TyThing -> [TyThing] +-- If you change this, make sure you change LoadIface.ifaceDeclSubBndrs in sync + implicitTyThings (AnId id) = [] -- For type constructors, add the data cons (and their extras), -- and the selectors and generic-programming Ids too -- -- Newtypes don't have a worker Id, so don't generate that? -implicitTyThings (ATyCon tc) = map AnId (tyConSelIds tc) ++ - concatMap (extras_plus . ADataCon) (tyConDataCons tc) +implicitTyThings (ATyCon tc) = implicitCoTyCon tc ++ + map AnId (tyConSelIds tc) ++ + concatMap (extras_plus . ADataCon) + (tyConDataCons tc) -- For classes, add the class TyCon too (and its extras) -- and the class selector Ids @@ -636,6 +642,11 @@ implicitTyThings (AClass cl) = map AnId (classSelIds cl) ++ -- For data cons add the worker and wrapper (if any) implicitTyThings (ADataCon dc) = map AnId (dataConImplicitIds dc) + -- 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 extendTypeEnvWithIds :: TypeEnv -> [Id] -> TypeEnv