summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2016-02-12 14:11:41 +0100
committerBen Gamari <ben@smart-cactus.org>2016-02-12 14:17:47 +0100
commit29a47ea6ba125b1e609408edc4ab28d8a858d49f (patch)
tree2184971417fefab09951ebf0afc0a106285c5d81
parente405eb1541c9e8a9ff3be21bb1036b00665def17 (diff)
downloadhaskell-wip/typeable-unwired.tar.gz
Move TyCon generation out of tcAddImplicitswip/typeable-unwired
-rw-r--r--compiler/typecheck/TcRnDriver.hs7
-rw-r--r--compiler/typecheck/TcTyDecls.hs6
2 files changed, 7 insertions, 6 deletions
diff --git a/compiler/typecheck/TcRnDriver.hs b/compiler/typecheck/TcRnDriver.hs
index f40c941b8c..8d0d6cee97 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 314e20c7ae..dce33d3989 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