X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=compiler%2Ftypecheck%2FTcRnMonad.lhs;h=af75fe6e4996e9e9abb1decd37ef6ed3c8a88253;hp=0b5e4fc72a1a1f0c443d0ad6f1cf07c3cb74aae4;hb=3e83dfb21b2f2220dce97427fff5c19459ae68d1;hpb=b360db770ca5e147066b7647b225208d531a6eaf diff --git a/compiler/typecheck/TcRnMonad.lhs b/compiler/typecheck/TcRnMonad.lhs index 0b5e4fc..af75fe6 100644 --- a/compiler/typecheck/TcRnMonad.lhs +++ b/compiler/typecheck/TcRnMonad.lhs @@ -132,33 +132,8 @@ initTc hsc_env hsc_src mod do_this -- OK, here's the business end! maybe_res <- initTcRnIf 'a' hsc_env gbl_env lcl_env $ - do { -#if defined(GHCI) && defined(BREAKPOINT) - unique <- newUnique ; - let { var = mkInternalName unique (mkOccName tvName "a") noSrcLoc; - tyvar = mkTyVar var liftedTypeKind; - basicType extra = (FunTy intTy - (FunTy (mkListTy unitTy) - (FunTy stringTy - (ForAllTy tyvar - (extra - (FunTy (TyVarTy tyvar) - (TyVarTy tyvar))))))); - breakpointJumpType - = mkGlobalId VanillaGlobal breakpointJumpName - (basicType id) vanillaIdInfo; - breakpointCondJumpType - = mkGlobalId VanillaGlobal breakpointCondJumpName - (basicType (FunTy boolTy)) vanillaIdInfo; - new_env = mkNameEnv [(breakpointJumpName - , ATcId breakpointJumpType topLevel False) - ,(breakpointCondJumpName - , ATcId breakpointCondJumpType topLevel False)]; - }; - r <- tryM (updLclEnv (\gbl -> gbl{tcl_env=new_env}) do_this) -#else - r <- tryM do_this -#endif + addBreakpointBindings $ + do { r <- tryM do_this ; case r of Right res -> return (Just res) Left _ -> return Nothing } ; @@ -191,6 +166,32 @@ initTcPrintErrors env mod todo = do return res \end{code} +\begin{code} +addBreakpointBindings :: TcM a -> TcM a +addBreakpointBindings thing_inside +#if defined(GHCI) && defined(BREAKPOINT) + = do { unique <- newUnique + ; let { var = mkInternalName unique (mkOccName tvName "a") noSrcLoc; + tyvar = mkTyVar var liftedTypeKind; + basicType extra = (FunTy intTy + (FunTy (mkListTy unitTy) + (FunTy stringTy + (ForAllTy tyvar + (extra + (FunTy (TyVarTy tyvar) + (TyVarTy tyvar))))))); + breakpointJumpId + = mkGlobalId VanillaGlobal breakpointJumpName + (basicType id) vanillaIdInfo; + breakpointCondJumpId + = mkGlobalId VanillaGlobal breakpointCondJumpName + (basicType (FunTy boolTy)) vanillaIdInfo + } + ; extendIdEnv [breakpoingJumpId, breakpointCondJumpId] thing_inside} +#else + = thing_inside +#endif +\end{code} %************************************************************************ %* *