-----------------------------------------------------------------------------
--- $Id: DriverFlags.hs,v 1.17 2000/11/10 14:29:21 simonmar Exp $
+-- $Id: DriverFlags.hs,v 1.18 2000/11/13 16:16:05 sewardj Exp $
--
-- Driver flags
--
import CmdLineOpts
import Config
import Util
-import CmdLineOpts
import Exception
import IOExts
, ( "dverbose-core2core", NoArg (setDynFlag Opt_D_verbose_core2core) )
, ( "dverbose-stg2stg", NoArg (setDynFlag Opt_D_verbose_stg2stg) )
, ( "ddump-hi-diffs", NoArg (setDynFlag Opt_D_dump_hi_diffs) )
+ , ( "ddump-hi", NoArg (setDynFlag Opt_D_dump_hi) )
, ( "ddump-minimal-imports", NoArg (setDynFlag Opt_D_dump_minimal_imports) )
, ( "dcore-lint", NoArg (setDynFlag Opt_DoCoreLinting) )
, ( "dstg-lint", NoArg (setDynFlag Opt_DoStgLinting) )
import PrelInfo ( wiredInThingEnv, wiredInThings )
import PrelNames ( knownKeyNames )
import MkIface ( completeIface, mkModDetailsFromIface, mkModDetails,
- writeIface )
+ writeIface, pprIface )
import TcModule ( TcResults(..), typecheckModule )
import InstEnv ( emptyInstEnv )
import Desugar ( deSugar )
import Name ( emptyNameEnv )
import Module ( Module, lookupModuleEnvByName )
+import Monad ( when )
\end{code}
; maybe_tc_result <- typecheckModule dflags this_mod pcs_rn hst new_iface
print_unqualified rn_hs_decls
; case maybe_tc_result of {
- Nothing -> do { hPutStrLn stderr "Typechecked failed"
+ Nothing -> do { hPutStrLn stderr "Typecheck failed"
; return (HscFail pcs_rn) } ;
Just tc_result -> do {
mkFinalIface dflags location maybe_old_iface new_iface new_details
= case completeIface maybe_old_iface new_iface new_details of
(new_iface, Nothing) -- no change in the interfacfe
- -> do if dopt Opt_D_dump_hi_diffs dflags then
- printDump (text "INTERFACE UNCHANGED")
- else return ()
+ -> do when (dopt Opt_D_dump_hi_diffs dflags)
+ (printDump (text "INTERFACE UNCHANGED"))
+ dumpIfSet_dyn dflags Opt_D_dump_hi
+ "UNCHANGED FINAL INTERFACE" (pprIface new_iface)
return new_iface
- (new_iface, Just sdoc)
- -> do dumpIfSet_dyn dflags Opt_D_dump_hi_diffs "NEW INTERFACE" sdoc
+ (new_iface, Just sdoc_diffs)
+ -> do dumpIfSet_dyn dflags Opt_D_dump_hi_diffs "INTERFACE HAS CHANGED" sdoc_diffs
+ dumpIfSet_dyn dflags Opt_D_dump_hi "NEW FINAL INTERFACE" (pprIface new_iface)
-- Write the interface file
writeIface (unJust (ml_hi_file location) "hscRecomp:hi") new_iface
return new_iface