[project @ 2001-06-29 15:37:52 by simonmar]
[ghc-hetmet.git] / ghc / compiler / main / MkIface.lhs
index 49c1cb1..508ec26 100644 (file)
@@ -21,14 +21,13 @@ import BasicTypes   ( Fixity(..), NewOrData(..),
 import RnMonad
 import RnHsSyn         ( RenamedInstDecl, RenamedTyClDecl )
 import HscTypes                ( VersionInfo(..), ModIface(..), ModDetails(..),
-                         ModuleLocation(..), 
+                         ModuleLocation(..), GhciMode(..),
                          IfaceDecls, mkIfaceDecls, dcl_tycl, dcl_rules, dcl_insts,
                          TyThing(..), DFunId, Avails,
                          WhatsImported(..), GenAvailInfo(..), 
                          ImportVersion, AvailInfo, Deprecations(..),
                          lookupVersion,
                        )
-import CmStaticInfo    ( GhciMode(..) )
 
 import CmdLineOpts
 import Id              ( idType, idInfo, isImplicitId, idCgInfo,
@@ -46,15 +45,16 @@ import NameEnv
 import NameSet
 import OccName         ( pprOccName )
 import TyCon           ( TyCon, getSynTyConDefn, isSynTyCon, isNewTyCon, isAlgTyCon, tyConGenIds,
-                         tyConTheta, tyConTyVars, tyConDataCons, tyConFamilySize, isClassTyCon
+                         tyConTheta, tyConTyVars, tyConDataCons, tyConFamilySize, 
+                         isClassTyCon, isForeignTyCon
                        )
 import Class           ( classExtraBigSig, classTyCon, DefMeth(..) )
 import FieldLabel      ( fieldLabelType )
-import Type            ( splitSigmaTy, tidyTopType, deNoteType, namesOfDFunHead )
+import TcType          ( tcSplitSigmaTy, tidyTopType, deNoteType, namesOfDFunHead )
 import SrcLoc          ( noSrcLoc )
 import Outputable
 import Module          ( ModuleName )
-import Util            ( sortLt, unJust )
+import Util            ( sortLt )
 import ErrUtils                ( dumpIfSet_dyn )
 
 import Monad           ( when )
@@ -111,7 +111,7 @@ mkFinalIface ghci_mode dflags location
                --     so there's no need to write a new interface file.  But even if 
                --     the usages have changed, the module version may not have.
 
-     hi_file_path = unJust "mkFinalIface" (ml_hi_file location)
+     hi_file_path = ml_hi_file location
      new_decls    = mkIfaceDecls ty_cls_dcls rule_dcls inst_dcls
      inst_dcls    = map ifaceInstance (md_insts new_details)
      ty_cls_dcls  = foldNameEnv ifaceTyCls [] (md_types new_details)
@@ -160,7 +160,7 @@ ifaceTyCls (AClass clas) so_far
        = ASSERT(sel_tyvars == clas_tyvars)
          ClassOpSig (getName sel_id) def_meth' (toHsType op_ty) noSrcLoc
        where
-         (sel_tyvars, _, op_ty) = splitSigmaTy (idType sel_id)
+         (sel_tyvars, _, op_ty) = tcSplitSigmaTy (idType sel_id)
          def_meth' = case def_meth of
                         NoDefMeth  -> NoDefMeth
                         GenDefMeth -> GenDefMeth
@@ -187,6 +187,11 @@ ifaceTyCls (ATyCon tycon) so_far
                        tcdSysNames  = map getName (tyConGenIds tycon),
                        tcdLoc       = noSrcLoc }
 
+           | isForeignTyCon tycon
+           = ForeignType { tcdName   = getName tycon,
+                           tcdFoType = DNType, -- The only case at present
+                           tcdLoc    = noSrcLoc }
+
            | otherwise = pprPanic "ifaceTyCls" (ppr tycon)
 
     tyvars      = tyConTyVars tycon