[project @ 2000-10-30 18:13:15 by sewardj]
[ghc-hetmet.git] / ghc / compiler / main / MkIface.lhs
index b16a95a..c837f4c 100644 (file)
@@ -24,7 +24,7 @@ import HscTypes               ( VersionInfo(..), IfaceDecls(..), ModIface(..), ModDetails(..)
                          TyThing(..), DFunId, TypeEnv, isTyClThing, Avails,
                          WhatsImported(..), GenAvailInfo(..), 
                          ImportVersion, AvailInfo, Deprecations(..), 
-                         Finder, ModuleLocation(..)
+                         ModuleLocation(..)
                        )
 
 import CmdLineOpts
@@ -56,6 +56,7 @@ import Type           ( splitSigmaTy, tidyTopType, deNoteType )
 import SrcLoc          ( noSrcLoc )
 import Outputable
 import Module          ( ModuleName, moduleName )
+import Finder          ( findModule )
 
 import List            ( partition )
 import IO              ( IOMode(..), openFile, hClose )
@@ -604,23 +605,15 @@ diffDecls old_vers old_fixities new_fixities old new
 %************************************************************************
 
 \begin{code}
-writeIface :: Finder -> Maybe ModIface -> IO ()
-writeIface finder Nothing
+writeIface :: FilePath -> Maybe ModIface -> IO ()
+writeIface hi_path Nothing
   = return ()
 
-writeIface finder (Just mod_iface)
-  = do { maybe_found <- finder mod_name ;
-       ; case maybe_found of {
-           Nothing -> printErrs (text "Can't write interface file for" <+> ppr mod_name) ;
-           Just (_, locn) ->
-
-    do { let filename = hi_file locn 
-       ; if_hdl <- openFile filename WriteMode
+writeIface hi_path (Just mod_iface)
+  = do { if_hdl <- openFile hi_path WriteMode
        ; printForIface if_hdl (pprIface mod_iface)
        ; hClose if_hdl
-       }}}
-  where
-    mod_name = moduleName (mi_module mod_iface)
+       }
         
 pprIface :: ModIface -> SDoc
 pprIface iface