diff --git a/compiler/typecheck/TcRnMonad.hs b/compiler/typecheck/TcRnMonad.hs index 74f80996b72505681b07d681e30cc95114ceb4ac..dd700111bda7629355f32b8b20fdd223ecc76bcf 100644 --- a/compiler/typecheck/TcRnMonad.hs +++ b/compiler/typecheck/TcRnMonad.hs @@ -1170,6 +1170,17 @@ captureTcLevel thing_inside thing_inside ; return (res, tclvl') } +pushLevelAndCaptureConstraints :: TcM a -> TcM (a, TcLevel, WantedConstraints) +pushLevelAndCaptureConstraints thing_inside + = do { env <- getLclEnv + ; lie_var <- newTcRef emptyWC ; + ; let tclvl' = pushTcLevel (tcl_tclvl env) + ; res <- setLclEnv (env { tcl_tclvl = tclvl' + , tcl_lie = lie_var }) + thing_inside + ; lie <- readTcRef lie_var + ; return (res, tclvl', lie) } + pushTcLevelM :: TcM a -> TcM a pushTcLevelM thing_inside = do { env <- getLclEnv