tcl_ctxt = [],
tcl_rdr = emptyLocalRdrEnv,
tcl_th_ctxt = topStage,
- tcl_arrow_ctxt = panic "initTc:arrow", -- only used inside proc
+ tcl_arrow_ctxt = NoArrowCtxt,
tcl_env = emptyNameEnv,
tcl_tyvars = tvs_var,
tcl_lie = panic "initTc:LIE", -- LIE only valid inside a getLIE
ThLevel, impLevel, topLevel,
-- Arrows
- newArrowScope, escapeArrowScope,
+ ArrowCtxt(NoArrowCtxt), newArrowScope, escapeArrowScope,
-- Insts
Inst(..), InstOrigin(..), InstLoc(..), pprInstLoc,
head of (|..|).
-}
-newtype ArrowCtxt = ArrowCtxt { arr_proc_env :: Env TcGblEnv TcLclEnv }
+data ArrowCtxt
+ = NoArrowCtxt
+ | ArrowCtxt (Env TcGblEnv TcLclEnv)
-- Record the current environment (outside a proc)
newArrowScope :: TcM a -> TcM a
-- Return to the stored environment (from the enclosing proc)
escapeArrowScope :: TcM a -> TcM a
-escapeArrowScope = updEnv (arr_proc_env . tcl_arrow_ctxt . env_lcl)
+escapeArrowScope
+ = updEnv $ \ env -> case tcl_arrow_ctxt (env_lcl env) of
+ NoArrowCtxt -> env
+ ArrowCtxt env' -> env'
---------------------------
-- TcTyThing