[commit: ghc] wip/T9858-typeable-ben: tcRnDeclsi can use tcRnSrcDecls (bd0ad08)

git at git.haskell.org git at git.haskell.org
Wed Aug 26 14:12:35 UTC 2015


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/T9858-typeable-ben
Link       : http://ghc.haskell.org/trac/ghc/changeset/bd0ad08d6c2a9d563ee9c0e904e1e672ebb0b255/ghc

>---------------------------------------------------------------

commit bd0ad08d6c2a9d563ee9c0e904e1e672ebb0b255
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Mon Mar 23 14:32:31 2015 +0000

    tcRnDeclsi can use tcRnSrcDecls
    
    I'm not sure why tcRnDeclsi didn't call tcRnSrcDecls before, but now it
    does.  About 20 lines of code vanish. Hooray.


>---------------------------------------------------------------

bd0ad08d6c2a9d563ee9c0e904e1e672ebb0b255
 compiler/typecheck/TcRnDriver.hs | 41 +++-------------------------------------
 1 file changed, 3 insertions(+), 38 deletions(-)

diff --git a/compiler/typecheck/TcRnDriver.hs b/compiler/typecheck/TcRnDriver.hs
index e361dcb..6e3fd81 100644
--- a/compiler/typecheck/TcRnDriver.hs
+++ b/compiler/typecheck/TcRnDriver.hs
@@ -1900,44 +1900,9 @@ tcRnDeclsi exists to allow class, data, and other declarations in GHCi.
 tcRnDeclsi :: HscEnv
            -> [LHsDecl RdrName]
            -> IO (Messages, Maybe TcGblEnv)
-
-tcRnDeclsi hsc_env local_decls =
-  runTcInteractive hsc_env $ do
-
-    ((tcg_env, tclcl_env), lie) <- captureConstraints $
-                                   tc_rn_src_decls local_decls
-    setEnvs (tcg_env, tclcl_env) $ do
-
-    -- wanted constraints from static forms
-    stWC <- tcg_static_wc <$> getGblEnv >>= readTcRef
-
-    new_ev_binds <- simplifyTop (andWC stWC lie)
-
-    failIfErrsM
-    let TcGblEnv { tcg_type_env  = type_env,
-                   tcg_binds     = binds,
-                   tcg_sigs      = sig_ns,
-                   tcg_ev_binds  = cur_ev_binds,
-                   tcg_imp_specs = imp_specs,
-                   tcg_rules     = rules,
-                   tcg_vects     = vects,
-                   tcg_fords     = fords } = tcg_env
-        all_ev_binds = cur_ev_binds `unionBags` new_ev_binds
-
-    (bind_ids, ev_binds', binds', fords', imp_specs', rules', vects')
-        <- zonkTopDecls all_ev_binds binds Nothing sig_ns rules vects
-                        imp_specs fords
-
-    let final_type_env = extendTypeEnvWithIds type_env bind_ids
-        tcg_env' = tcg_env { tcg_binds     = binds',
-                             tcg_ev_binds  = ev_binds',
-                             tcg_imp_specs = imp_specs',
-                             tcg_rules     = rules',
-                             tcg_vects     = vects',
-                             tcg_fords     = fords' }
-
-    setGlobalTypeEnv tcg_env' final_type_env
-
+tcRnDeclsi hsc_env local_decls
+  = runTcInteractive hsc_env $
+    tcRnSrcDecls False Nothing local_decls
 
 externaliseAndTidyId :: Module -> Id -> TcM Id
 externaliseAndTidyId this_mod id



More information about the ghc-commits mailing list