[project @ 2003-11-05 11:39:38 by simonpj]
[ghc-hetmet.git] / ghc / compiler / typecheck / TcRnDriver.lhs
index b1dd133..92526ee 100644 (file)
@@ -637,6 +637,8 @@ tc_rn_src_decls ds
        -- Rename the splice expression, and get its supporting decls
        (rn_splice_expr, splice_fvs) <- addSrcLoc splice_loc $
                                        rnExpr splice_expr ;
+       failIfErrsM ;   -- Don't typecheck if renaming failed
+
        -- Execute the splice
        spliced_decls <- tcSpliceDecls rn_splice_expr ;
 
@@ -786,12 +788,15 @@ tcTopSrcDecls
 \begin{code}
 #ifdef GHCI
 mkExportEnv :: HscEnv -> [ModuleName]  -- Expose these modules' exports only
-           -> IO (Maybe GlobalRdrEnv)
+           -> IO GlobalRdrEnv
 
 mkExportEnv hsc_env exports
-  = initTc hsc_env iNTERACTIVE $ do {
-    export_envs <- mappM getModuleExports exports ;
-    returnM (foldr plusGlobalRdrEnv emptyGlobalRdrEnv export_envs)
+  = do { mb_envs <- initTc hsc_env iNTERACTIVE $
+                    mappM getModuleExports exports 
+       ; case mb_envs of
+            Just envs -> return (foldr plusGlobalRdrEnv emptyGlobalRdrEnv envs)
+            Nothing   -> return emptyGlobalRdrEnv
+                            -- Some error; initTc will have printed it
     }
 
 getModuleExports :: ModuleName -> TcM GlobalRdrEnv
@@ -887,7 +892,7 @@ checkMain
         let { main_mod = case mb_main_mod of {
                                Just mod -> mkModuleName mod ;
                                Nothing  -> mAIN_Name } ;
-               main_fn  = case mb_main_fn of {
+              main_fn  = case mb_main_fn of {
                                Just fn -> mkRdrUnqual (mkVarOcc (mkFastString fn)) ;
                                Nothing -> main_RDR_Unqual } } ;