[commit: ghc] wip/typeable-unwired: Move TyCon generation out of tcAddImplicits (29a47ea)

git at git.haskell.org git at git.haskell.org
Fri Feb 12 13:19:17 UTC 2016


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

On branch  : wip/typeable-unwired
Link       : http://ghc.haskell.org/trac/ghc/changeset/29a47ea6ba125b1e609408edc4ab28d8a858d49f/ghc

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

commit 29a47ea6ba125b1e609408edc4ab28d8a858d49f
Author: Ben Gamari <ben at smart-cactus.org>
Date:   Fri Feb 12 14:11:41 2016 +0100

    Move TyCon generation out of tcAddImplicits


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

29a47ea6ba125b1e609408edc4ab28d8a858d49f
 compiler/typecheck/TcRnDriver.hs | 7 ++++++-
 compiler/typecheck/TcTyDecls.hs  | 6 +-----
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/compiler/typecheck/TcRnDriver.hs b/compiler/typecheck/TcRnDriver.hs
index f40c941..8d0d6ce 100644
--- a/compiler/typecheck/TcRnDriver.hs
+++ b/compiler/typecheck/TcRnDriver.hs
@@ -71,7 +71,7 @@ import TcType
 import MkIface
 import TcSimplify
 import TcTyClsDecls
-import TcTypeable( mkModIdBindings, mkPrimTypeableBinds )
+import TcTypeable( mkModIdBindings, mkTypeableBinds, mkPrimTypeableBinds )
 import LoadIface
 import TidyPgm    ( mkBootModDetailsTc )
 import RnNames
@@ -485,7 +485,12 @@ tcRnSrcDecls explicit_mod_hdr decls
         -- Do this before processing any data type declarations,
         -- which need tcg_tr_module to be initialised
       ; tcg_env <- mkModIdBindings
+        -- Now we can generate the TyCon representations
       ; tcg_env <- setGblEnv tcg_env mkPrimTypeableBinds
+      ; tcg_env <- setGblEnv tcg_env $
+            let tycons = typeEnvTyCons $ tcg_type_env tcg_env
+            in mkTypeableBinds tycons
+
       ; setGblEnv tcg_env $ do {
 
 #ifdef GHCI
diff --git a/compiler/typecheck/TcTyDecls.hs b/compiler/typecheck/TcTyDecls.hs
index 314e20c..dce33d3 100644
--- a/compiler/typecheck/TcTyDecls.hs
+++ b/compiler/typecheck/TcTyDecls.hs
@@ -30,7 +30,6 @@ module TcTyDecls(
 
 import TcRnMonad
 import TcEnv
-import TcTypeable( mkTypeableBinds )
 import TcBinds( tcRecSelBinds )
 import TyCoRep( Type(..), TyBinder(..), delBinderVar )
 import TcType
@@ -863,10 +862,7 @@ tcAddImplicits tycons
     do { traceTc "tcAddImplicits" $ vcat
             [ text "tycons" <+> ppr tycons
             , text "implicits" <+> ppr implicit_things ]
-       ; gbl_env <- mkTypeableBinds tycons
-       ; gbl_env <- setGblEnv gbl_env $
-                    tcRecSelBinds (mkRecSelBinds tycons)
-       ; return gbl_env }
+       ; tcRecSelBinds (mkRecSelBinds tycons) }
  where
    implicit_things = concatMap implicitTyConThings tycons
    def_meth_ids    = mkDefaultMethodIds tycons



More information about the ghc-commits mailing list