Interface file optimisation and removal of nameParent
[ghc-hetmet.git] / compiler / typecheck / TcTyDecls.lhs
index f45af9e..7d4ebfa 100644 (file)
@@ -20,10 +20,11 @@ import TypeRep          ( Type(..), TyNote(..), PredType(..) )  -- friend
 import HsSyn           ( TyClDecl(..), HsPred(..), LTyClDecl, isClassDecl )
 import RnHsSyn         ( extractHsTyNames )
 import Type            ( predTypeRep, tcView )
-import HscTypes                ( TyThing(..), ModDetails(..) )
+import HscTypes                ( TyThing(..), ModDetails(..), availsToNameSet )
 import TyCon            ( TyCon, tyConArity, tyConDataCons, tyConTyVars,
-                          synTyConDefn, isSynTyCon, isAlgTyCon, 
-                         tyConName, isNewTyCon, isProductTyCon, newTyConRhs )
+                          isSynTyCon, isAlgTyCon, 
+                         tyConName, isNewTyCon, isProductTyCon, newTyConRhs,
+                         isOpenTyCon )
 import Class           ( classTyCon )
 import DataCon          ( dataConOrigArgTys )
 import Var              ( TyVar )
@@ -214,7 +215,7 @@ calcRecFlags boot_details tyclss
     is_rec n | n `elemNameSet` rec_names = Recursive
             | otherwise                 = NonRecursive
 
-    boot_name_set = md_exports boot_details
+    boot_name_set = availsToNameSet (md_exports boot_details)
     rec_names = boot_name_set    `unionNameSets` 
                nt_loop_breakers  `unionNameSets`
                prod_loop_breakers
@@ -238,7 +239,8 @@ calcRecFlags boot_details tyclss
        -- rather less nice, so I'm not going to do that yet.
 
        --------------- Newtypes ----------------------
-    new_tycons = filter isNewTyCon all_tycons
+    new_tycons = filter isNewTyConAndNotOpen all_tycons
+    isNewTyConAndNotOpen tycon = isNewTyCon tycon && not (isOpenTyCon tycon)
     nt_loop_breakers = mkNameSet (findLoopBreakers nt_edges)
     is_rec_nt tc = tyConName tc  `elemNameSet` nt_loop_breakers
        -- is_rec_nt is a locally-used helper function