Functions to manage the verbosity of a console program by storing the quietness level in the system environment, specifically in the $QUIETNESS variable. This lets you avoid creating a StateT monad to hold the quietness level. Note that you don't attach a verbosity level to individual message commands, you control the quietness level for entire regions of your program and messages only appear when quietness is less than one.
- ePutStr :: MonadIO m => String -> m ()
- ePutStrLn :: MonadIO m => String -> m ()
- eMessage :: MonadIO m => String -> b -> m b
- eMessageLn :: MonadIO m => String -> b -> m b
- initialQuietness :: MonadIO m => m Int
- quietness :: MonadIO m => m Int
- quieter :: MonadIO m => (Int -> Int) -> m a -> m a
- quieter' :: MonadIO m => (Int -> Int) -> m a -> m a
- qDo :: MonadIO m => m () -> m ()
- qPutStr :: MonadIO m => String -> m ()
- qPutStrLn :: MonadIO m => String -> m ()
- qMessage :: MonadIO m => String -> a -> m a
- qMessageLn :: MonadIO m => String -> a -> m a
- q12 :: MonadIO m => String -> m a -> m a
- q02 :: MonadIO m => String -> m a -> m a
- v1, v3, v2 :: MonadIO m => m a -> m a
- showQ :: MonadIO m => String -> m a -> m a
Get/set quietness levels
Compute an initial value for $QUIETNESS by examining the $QUIETNESS and $VERBOSITY variables and counting the -v and -q options on the command line.
Get the current quietness level from the QUIETNESS environment variable.
Do task with modified quietness level
Perform a task with the quietness level tansformed by f. Use
defaultQuietness >>= modQuietness . const to initialize the --
verbosity for a program.
Dummy version of quieter, sometimes you want to strip out all the quieter calls and see how things look, then restore them gradually. Use this to help remember where they were.
Do a task if quietness < 1
Output to stderr when quietness < 1
If the current quietness level is less than one print a message.
Control the quietness level using
Print a message at quietness +1 and then do a task at quietness +3. This is a pattern which gives the following behaviors: Normally there is no output. With -v only the messages are printed. With -v -v the messages and the shell commands are printed with dots to show progress. With -v -v -v everything is printed.