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