Commit 66ce7de1 authored by Simon Peyton Jones's avatar Simon Peyton Jones

Tiny refactor to tcExtendRecEnv

In tcExtendRecEnv, there is no need to us setGlobalTypeEnv
(which side-effects the tcg_type_env_var).  tcExtendRecEnv
is used only when kind-checking a group of type/class decls
and no knot-tying via tcg_type_env_var is needed.

There is no change in functionality.
parent 28188e06
......@@ -378,8 +378,13 @@ tcExtendRecEnv :: [(Name,TyThing)] -> TcM r -> TcM r
-- Just like tcExtendGlobalEnv, except the argument is a list of pairs
tcExtendRecEnv gbl_stuff thing_inside
= do { tcg_env <- getGblEnv
; let ge' = extendNameEnvList (tcg_type_env tcg_env) gbl_stuff
; tcg_env' <- setGlobalTypeEnv tcg_env ge'
; let ge' = extendNameEnvList (tcg_type_env tcg_env) gbl_stuff
tcg_env' = tcg_env { tcg_type_env = ge' }
-- No need for setGlobalTypeEnv (which side-effects the
-- tcg_type_env_var); tcExtendRecEnv is used just
-- when kind-check a group of type/class decls. It would
-- in any case be wrong for an interface-file decl to end up
-- with a TcTyCon in it!
; setGblEnv tcg_env' thing_inside }
{-
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment