[commit: ghc] wip/T9858-typeable-spj: tcRnDeclsi can use tcRnSrcDecls (021e6f5)

git at git.haskell.org git at git.haskell.org
Thu Mar 26 12:41:11 UTC 2015


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

On branch  : wip/T9858-typeable-spj
Link       : http://ghc.haskell.org/trac/ghc/changeset/021e6f583a1159b0a3581ab1713d560cadc2bdf7/ghc

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

commit 021e6f583a1159b0a3581ab1713d560cadc2bdf7
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.


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

021e6f583a1159b0a3581ab1713d560cadc2bdf7
 compiler/typecheck/TcRnDriver.hs | 42 +++-------------------------------------
 1 file changed, 3 insertions(+), 39 deletions(-)

diff --git a/compiler/typecheck/TcRnDriver.hs b/compiler/typecheck/TcRnDriver.hs
index dca128e..821fa7a 100644
--- a/compiler/typecheck/TcRnDriver.hs
+++ b/compiler/typecheck/TcRnDriver.hs
@@ -1850,45 +1850,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 emptyModDetails 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 --global_ids = map globaliseAndTidyId bind_ids
-        final_type_env = extendTypeEnvWithIds type_env bind_ids --global_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 emptyModDetails emptyBag local_decls
 #endif /* GHCi */
 
 {-



More information about the ghc-commits mailing list