tcg_deprecs = NoDeprecs,
tcg_insts = [],
tcg_rules = [],
- tcg_fords = []
+ tcg_fords = [],
+ tcg_keep = emptyNameSet
} ;
lcl_env = TcLclEnv {
tcl_errs = errs_var,
(warns, errs) <- readMutVar errs_var ;
writeMutVar errs_var (warns `unionBags` m_warns,
errs `unionBags` m_errs) }
+
+discardWarnings :: TcRn a -> TcRn a
+-- Ignore warnings inside the thing inside;
+-- used to ignore-unused-variable warnings inside derived code
+-- With -dppr-debug, the effects is switched off, so you can still see
+-- what warnings derived code would give
+discardWarnings thing_inside
+ | opt_PprStyle_Debug = thing_inside
+ | otherwise
+ = do { errs_var <- newMutVar emptyMessages
+ ; result <- setErrsVar errs_var thing_inside
+ ; (_warns, errs) <- readMutVar errs_var
+ ; addMessages (emptyBag, errs)
+ ; return result }
\end{code}