X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Ftypecheck%2FTcRnMonad.lhs;h=79282899418541fd227e912652a94f9e934db244;hb=a01188d12783adf93b1b6c5a08de1dfa0abf55f2;hp=6a7f4fb3d5cfc93af91cbfe873c728c03d95ae14;hpb=3a99fa889bdff0c86df20cb18c71d30e30a79b43;p=ghc-hetmet.git diff --git a/compiler/typecheck/TcRnMonad.lhs b/compiler/typecheck/TcRnMonad.lhs index 6a7f4fb..7928289 100644 --- a/compiler/typecheck/TcRnMonad.lhs +++ b/compiler/typecheck/TcRnMonad.lhs @@ -14,14 +14,6 @@ module TcRnMonad( import TcRnTypes -- Re-export all import IOEnv -- Re-export all -#if defined(GHCI) -import TypeRep -import IdInfo -import TysWiredIn -import PrelNames -import {-#SOURCE#-} TcEnv -#endif - import HsSyn hiding (LIE) import HscTypes import Module @@ -71,13 +63,14 @@ ioToTcRn = ioToIOEnv initTc :: HscEnv -> HscSource + -> Bool -- True <=> retain renamed syntax trees -> Module -> TcM r -> IO (Messages, Maybe r) -- Nothing => error thrown by the thing inside -- (error messages should have been printed already) -initTc hsc_env hsc_src mod do_this +initTc hsc_env hsc_src keep_rn_syntax mod do_this = do { errs_var <- newIORef (emptyBag, emptyBag) ; tvs_var <- newIORef emptyVarSet ; type_env_var <- newIORef emptyNameEnv ; @@ -86,6 +79,10 @@ initTc hsc_env hsc_src mod do_this th_var <- newIORef False ; dfun_n_var <- newIORef 1 ; let { + maybe_rn_syntax empty_val + | keep_rn_syntax = Just empty_val + | otherwise = Nothing ; + gbl_env = TcGblEnv { tcg_mod = mod, tcg_src = hsc_src, @@ -101,9 +98,11 @@ initTc hsc_env hsc_src mod do_this tcg_exports = [], tcg_imports = emptyImportAvails, tcg_dus = emptyDUs, - tcg_rn_imports = Nothing, - tcg_rn_exports = Nothing, - tcg_rn_decls = Nothing, + + tcg_rn_imports = maybe_rn_syntax [], + tcg_rn_exports = maybe_rn_syntax [], + tcg_rn_decls = maybe_rn_syntax emptyRnGroup, + tcg_binds = emptyLHsBinds, tcg_deprecs = NoDeprecs, tcg_insts = [], @@ -152,7 +151,7 @@ initTcPrintErrors -- Used from the interactive loop only -> TcM r -> IO (Maybe r) initTcPrintErrors env mod todo = do - (msgs, res) <- initTc env HsSrcFile mod todo + (msgs, res) <- initTc env HsSrcFile False mod todo printErrorsAndWarnings (hsc_dflags env) msgs return res \end{code} @@ -160,28 +159,7 @@ initTcPrintErrors env mod todo = do \begin{code} addBreakpointBindings :: TcM a -> TcM a addBreakpointBindings thing_inside -#if defined(GHCI) - = do { unique <- newUnique - ; let { var = mkInternalName unique (mkOccName tvName "a") noSrcLoc; - tyvar = mkTyVar var liftedTypeKind; - basicType extra = (FunTy intTy - (FunTy (mkListTy unitTy) - (FunTy stringTy - (ForAllTy tyvar - (extra - (FunTy (TyVarTy tyvar) - (TyVarTy tyvar))))))); - breakpointJumpId - = Id.mkGlobalId VanillaGlobal breakpointJumpName - (basicType id) vanillaIdInfo; - breakpointCondJumpId - = Id.mkGlobalId VanillaGlobal breakpointCondJumpName - (basicType (FunTy boolTy)) vanillaIdInfo - } - ; tcExtendIdEnv [breakpointJumpId, breakpointCondJumpId] thing_inside} -#else = thing_inside -#endif \end{code} %************************************************************************ @@ -425,8 +403,8 @@ extendFixityEnv new_bit = updGblEnv (\env@(TcGblEnv { tcg_fix_env = old_fix_env }) -> env {tcg_fix_env = extendNameEnvList old_fix_env new_bit}) -getDefaultTys :: TcRn (Maybe [Type]) -getDefaultTys = do { env <- getGblEnv; return (tcg_default env) } +getDeclaredDefaultTys :: TcRn (Maybe [Type]) +getDeclaredDefaultTys = do { env <- getGblEnv; return (tcg_default env) } \end{code} %************************************************************************