[commit: ghc] ghc-7.10: TcRnMonad: Backport pushLevelAndCaptureConstraints (9359dbc)

git at git.haskell.org git at git.haskell.org
Tue Oct 27 23:25:41 UTC 2015


Repository : ssh://git@git.haskell.org/ghc

On branch  : ghc-7.10
Link       : http://ghc.haskell.org/trac/ghc/changeset/9359dbcc2d01db19d251e68adf6c428eac7c7144/ghc

>---------------------------------------------------------------

commit 9359dbcc2d01db19d251e68adf6c428eac7c7144
Author: Ben Gamari <ben at smart-cactus.org>
Date:   Tue Oct 27 20:10:46 2015 +0100

    TcRnMonad: Backport pushLevelAndCaptureConstraints


>---------------------------------------------------------------

9359dbcc2d01db19d251e68adf6c428eac7c7144
 compiler/typecheck/TcRnMonad.hs | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/compiler/typecheck/TcRnMonad.hs b/compiler/typecheck/TcRnMonad.hs
index 74f8099..dd70011 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



More information about the ghc-commits mailing list