-- If the source has changed and we're in interactive mode, avoid reading
-- an interface; just return the one we might have been supplied with.
- getGhciMode `thenM` \ ghci_mode ->
- if (ghci_mode == Interactive || ghci_mode == JustTypecheck)
+ getGhcMode `thenM` \ ghc_mode ->
+ if (ghc_mode == Interactive || ghc_mode == JustTypecheck)
&& not source_unchanged then
returnM (outOfDate, maybe_iface)
else
tcHiBootIface mod
= do { traceIf (text "loadHiBootInterface" <+> ppr mod)
- ; mode <- getGhciMode
+ ; mode <- getGhcMode
; if not (isOneShot mode)
-- In --make and interactive mode, if this module has an hs-boot file
-- we'll have compiled it already, and it'll be in the HPT
-- written "module Main where ..."
-- Reason: don't want to complain about 'main' not in scope
-- in interactive mode
- ghci_mode <- getGhciMode
+ ghc_mode <- getGhcMode
real_exports <- case () of
() | explicit_mod
-> return exports
- | ghci_mode == Interactive
+ | ghc_mode == Interactive
-> return Nothing
| otherwise
-> do mainName <- lookupGlobalOccRn main_RDR_Unqual
checkMain :: TcM TcGblEnv
-- If we are in module Main, check that 'main' is defined.
checkMain
- = do { ghci_mode <- getGhciMode ;
+ = do { ghc_mode <- getGhcMode ;
tcg_env <- getGblEnv ;
dflags <- getDOpts ;
let { main_mod = mainModIs dflags ;
Just fn -> mkRdrUnqual (mkVarOccFS (mkFastString fn)) ;
Nothing -> main_RDR_Unqual } } ;
- check_main ghci_mode tcg_env main_mod main_fn
+ check_main ghc_mode tcg_env main_mod main_fn
}
-check_main ghci_mode tcg_env main_mod main_fn
+check_main ghc_mode tcg_env main_mod main_fn
| mod /= main_mod
= traceTc (text "checkMain not" <+> ppr main_mod <+> ppr mod) >>
return tcg_env
where
mod = tcg_mod tcg_env
- complain_no_main | ghci_mode == Interactive = return ()
+ complain_no_main | ghc_mode == Interactive = return ()
| otherwise = failWithTc noMainMsg
-- In interactive mode, don't worry about the absence of 'main'
-- In other modes, fail altogether, so that we don't go on
ifOptM flag thing_inside = do { b <- doptM flag;
if b then thing_inside else return () }
-getGhciMode :: TcRnIf gbl lcl GhcMode
-getGhciMode = do { env <- getTopEnv; return (ghcMode (hsc_dflags env)) }
+getGhcMode :: TcRnIf gbl lcl GhcMode
+getGhcMode = do { env <- getTopEnv; return (ghcMode (hsc_dflags env)) }
\end{code}
\begin{code}