+printErrorsAndWarnings :: (Bag WarnMsg, Bag ErrMsg) -> IO ()
+ -- Don't print any warnings if there are errors
+printErrorsAndWarnings (warns, errs)
+ | no_errs && no_warns = return ()
+ | no_errs = printErrs (pprBagOfWarnings warns)
+ | otherwise = printErrs (pprBagOfErrors errs)
+ where
+ no_warns = isEmptyBag warns
+ no_errs = isEmptyBag errs
+