+
+-- | Optionally print the node list.
+maybePrintNodes :: Maybe [String] -- ^ The field list
+ -> String -- ^ Informational message
+ -> ([String] -> String) -- ^ Function to generate the listing
+ -> IO ()
+maybePrintNodes Nothing _ _ = return ()
+maybePrintNodes (Just fields) msg fn = do
+ hPutStrLn stderr ""
+ hPutStrLn stderr (msg ++ " status:")
+ hPutStrLn stderr $ fn fields
+
+
+-- | Optionally print the instance list.
+maybePrintInsts :: Bool -- ^ Whether to print the instance list
+ -> String -- ^ Type of the instance map (e.g. initial)
+ -> String -- ^ The instance data
+ -> IO ()
+maybePrintInsts do_print msg instdata =
+ when do_print $ do
+ hPutStrLn stderr ""
+ hPutStrLn stderr $ msg ++ " instance map:"
+ hPutStr stderr instdata