summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2017-08-28 13:37:56 +0100
committerSimon Peyton Jones <simonpj@microsoft.com>2017-08-29 09:33:26 +0100
commit6f050d9caa2db8330f73f5ebeee986371e5aa56d (patch)
treeff2cad6c87d2d58a972abdee4ae0edf948c6cbc5 /compiler
parent547e4c03809e082a34d9fd844c59e4844cd323ad (diff)
downloadhaskell-6f050d9caa2db8330f73f5ebeee986371e5aa56d.tar.gz
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.
Diffstat (limited to 'compiler')
-rw-r--r--compiler/typecheck/TcRnMonad.hs7
1 files changed, 6 insertions, 1 deletions
diff --git a/compiler/typecheck/TcRnMonad.hs b/compiler/typecheck/TcRnMonad.hs
index a6a995de1a..b9638edb1f 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)) }