[commit: ghc] master: Add TcRnMonad.unlessXOptM (6f050d9)

git at git.haskell.org git at git.haskell.org
Tue Aug 29 08:37:38 UTC 2017


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/6f050d9caa2db8330f73f5ebeee986371e5aa56d/ghc

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

commit 6f050d9caa2db8330f73f5ebeee986371e5aa56d
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Mon Aug 28 13:37:56 2017 +0100

    Add TcRnMonad.unlessXOptM
    
    This usefully joins whenXOptM; there are probably lots of places
    we should use it!
    
    This patch does not use new new function at all; but it's preparing
    for an upcoming patch when I do use it.


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

6f050d9caa2db8330f73f5ebeee986371e5aa56d
 compiler/typecheck/TcRnMonad.hs | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/compiler/typecheck/TcRnMonad.hs b/compiler/typecheck/TcRnMonad.hs
index a6a995d..b9638ed 100644
--- a/compiler/typecheck/TcRnMonad.hs
+++ b/compiler/typecheck/TcRnMonad.hs
@@ -19,7 +19,8 @@ module TcRnMonad(
   getEnvs, setEnvs,
   xoptM, doptM, goptM, woptM,
   setXOptM, unsetXOptM, unsetGOptM, unsetWOptM,
-  whenDOptM, whenGOptM, whenWOptM, whenXOptM,
+  whenDOptM, whenGOptM, whenWOptM,
+  whenXOptM, unlessXOptM,
   getGhcMode,
   withDoDynamicToo,
   getEpsVar,
@@ -499,6 +500,10 @@ whenXOptM :: LangExt.Extension -> TcRnIf gbl lcl () -> TcRnIf gbl lcl ()
 whenXOptM flag thing_inside = do b <- xoptM flag
                                  when b thing_inside
 
+unlessXOptM :: LangExt.Extension -> TcRnIf gbl lcl () -> TcRnIf gbl lcl ()
+unlessXOptM flag thing_inside = do b <- xoptM flag
+                                   unless b thing_inside
+
 getGhcMode :: TcRnIf gbl lcl GhcMode
 getGhcMode = do { env <- getTopEnv; return (ghcMode (hsc_dflags env)) }
 



More information about the ghc-commits mailing list