Fix scoped type variables for expression type signatures
[ghc-hetmet.git] / compiler / main / TidyPgm.lhs
index 7b98bcd..4e01fd3 100644 (file)
@@ -39,13 +39,16 @@ import Type         ( tidyTopType )
 import TcType          ( isFFITy )
 import DataCon         ( dataConName, dataConFieldLabels, dataConWrapId_maybe )
 import TyCon           ( TyCon, makeTyConAbstract, tyConDataCons, isNewTyCon, 
-                         newTyConRep, tyConSelIds, isAlgTyCon, isEnumerationTyCon )
+                         newTyConRep, tyConSelIds, isAlgTyCon,
+                         isEnumerationTyCon, isOpenTyCon )
 import Class           ( classSelIds )
 import Module          ( Module )
 import HscTypes                ( HscEnv(..), NameCache( nsUniqs ), CgGuts(..),
                          TypeEnv, typeEnvIds, typeEnvElts, typeEnvTyCons, 
                          extendTypeEnvWithIds, lookupTypeEnv,
-                         ModGuts(..), TyThing(..), ModDetails(..), Dependencies(..)
+                         mkDetailsFamInstCache,
+                         ModGuts(..), TyThing(..), ModDetails(..),
+                         Dependencies(..)
                        )
 import Maybes          ( orElse, mapCatMaybes )
 import ErrUtils                ( showPass, dumpIfSet_core )
@@ -134,10 +137,11 @@ mkBootModDetails hsc_env (ModGuts { mg_module = mod,
              ; type_env' = extendTypeEnvWithIds type_env2
                                (map instanceDFunId ispecs')
              }
-       ; return (ModDetails { md_types = type_env',
-                              md_insts = ispecs',
-                              md_rules = [],
-                              md_exports = exports })
+       ; return (ModDetails { md_types     = type_env',
+                              md_insts     = ispecs',
+                              md_fam_insts = mkDetailsFamInstCache type_env',
+                              md_rules     = [],
+                              md_exports   = exports })
        }
   where
 
@@ -289,6 +293,8 @@ tidyProgram hsc_env
                   ModDetails { md_types = tidy_type_env,
                                md_rules = tidy_rules,
                                md_insts = tidy_ispecs,
+                               md_fam_insts = mkDetailsFamInstCache 
+                                                tidy_type_env,
                                md_exports = exports })
        }
 
@@ -351,6 +357,8 @@ mustExposeTyCon exports tc
   | isEnumerationTyCon tc      -- For an enumeration, exposing the constructors
   = True                       -- won't lead to the need for further exposure
                                -- (This includes data types with no constructors.)
+  | isOpenTyCon tc             -- open type family
+  = True
   | otherwise                  -- Newtype, datatype
   = any exported_con (tyConDataCons tc)
        -- Expose rep if any datacon or field is exported