Add data type information to VectInfo
[ghc-hetmet.git] / compiler / iface / MkIface.lhs
index 811af49..22fd309 100644 (file)
@@ -339,8 +339,19 @@ mkIface hsc_env maybe_old_iface
      deliberatelyOmitted x = panic ("Deliberately omitted: " ++ x)
      ifFamInstTcName = ifaceTyConName . ifFamInstTyCon
 
-     flattenVectInfo (VectInfo ccVar) = 
-       IfaceVectInfo [Var.varName v | (v, _) <- varEnvElts ccVar]
+     flattenVectInfo (VectInfo { vectInfoCCVar   = ccVar
+                               , vectInfoCCTyCon = ccTyCon
+                               }) = 
+       IfaceVectInfo { 
+         ifaceVectInfoCCVar        = [ Var.varName v 
+                                     | (v, _) <- varEnvElts ccVar],
+         ifaceVectInfoCCTyCon      = [ tyConName t 
+                                     | (t, t_CC) <- nameEnvElts ccTyCon
+                                     , t /= t_CC],
+         ifaceVectInfoCCTyConReuse = [ tyConName t
+                                     | (t, t_CC) <- nameEnvElts ccTyCon
+                                     , t == t_CC]
+       } 
 
 -----------------------------
 writeIfaceFile :: DynFlags -> ModLocation -> ModIface -> IO ()
@@ -1070,10 +1081,12 @@ tyThingToIfaceDecl (AClass clas)
 
 tyThingToIfaceDecl (ATyCon tycon)
   | isSynTyCon tycon
-  = IfaceSyn { ifName   = getOccName tycon,
-               ifTyVars = toIfaceTvBndrs tyvars,
+  = IfaceSyn { ifName    = getOccName tycon,
+               ifTyVars  = toIfaceTvBndrs tyvars,
                ifOpenSyn = syn_isOpen,
-               ifSynRhs  = toIfaceType syn_tyki }
+               ifSynRhs  = toIfaceType syn_tyki,
+                ifFamInst = famInstToIface (tyConFamInst_maybe tycon)
+             }
 
   | isAlgTyCon tycon
   = IfaceData {        ifName    = getOccName tycon,
@@ -1100,8 +1113,7 @@ tyThingToIfaceDecl (ATyCon tycon)
       IfNewTyCon  (ifaceConDecl con)
     ifaceConDecls (DataTyCon { data_cons = cons })  = 
       IfDataTyCon (map ifaceConDecl cons)
-    ifaceConDecls OpenTyCon { otIsNewtype = False } = IfOpenDataTyCon
-    ifaceConDecls OpenTyCon { otIsNewtype = True  } = IfOpenNewTyCon
+    ifaceConDecls OpenTyCon {}                      = IfOpenDataTyCon
     ifaceConDecls AbstractTyCon                            = IfAbstractTyCon
        -- The last case happens when a TyCon has been trimmed during tidying
        -- Furthermore, tyThingToIfaceDecl is also used