+
+\begin{code}
+doIfSet :: Bool -> IO () -> IO ()
+doIfSet flag action | flag = action
+ | otherwise = return ()
+\end{code}
+
+\begin{code}
+dumpIfSet :: Bool -> String -> Doc -> IO ()
+dumpIfSet flag hdr doc
+ | not flag = return ()
+ | otherwise = printErrs dump
+ where
+ dump = (line <+> text hdr <+> line)
+ $$
+ doc
+ $$
+ text ""
+ line = text (take 20 (repeat '='))
+\end{code}