Commits

Bryan O'Sullivan  committed 127e874

Record verbosity config correctly.

  • Participants
  • Parent commits 03cebf7

Comments (0)

Files changed (3)

File Criterion/Config.hs

                | Verbose
                  deriving (Eq, Ord, Bounded, Enum, Read, Show)
 
-instance Monoid Verbosity where
-    mempty        = Normal
-    _ `mappend` b = b
-                   
 data PrintExit = Nada
                | Version
                | Help
     , cfgPrintExit    :: PrintExit
     , cfgResamples    :: Last Int
     , cfgSamples      :: Last Int
-    , cfgVerbosity    :: Verbosity
+    , cfgVerbosity    :: Last Verbosity
     } deriving (Eq, Read, Show, Typeable)
 
 emptyConfig :: Config
                 , cfgPrintExit    = Nada
                 , cfgResamples    = ljust (100 * 1000)
                 , cfgSamples      = ljust 100
-                , cfgVerbosity    = Normal
+                , cfgVerbosity    = ljust Normal
                 }
 
 ljust :: a -> Last a

File Criterion/IO.hs

     , prolix
     ) where
 
-import Criterion.Config (Config, Verbosity(..), cfgVerbosity)
+import Criterion.Config (Config, Verbosity(..), cfgVerbosity, fromLJ)
 import System.IO (Handle, IOMode(..), openBinaryFile, stderr, stdout)
 import System.IO.Unsafe (unsafePerformIO)
 import Text.Printf (HPrintfType, hPrintf)
 {-# NOINLINE nullDev #-}
 
 note :: (HPrintfType r) => Config -> String -> r
-note cfg msg = if cfgVerbosity cfg > Quiet
+note cfg msg = if fromLJ cfgVerbosity cfg > Quiet
                then hPrintf stdout msg
                else hPrintf nullDev msg
 
 prolix :: (HPrintfType r) => Config -> String -> r
-prolix cfg msg = if cfgVerbosity cfg == Verbose
+prolix cfg msg = if fromLJ cfgVerbosity cfg == Verbose
                  then hPrintf stdout msg
                  else hPrintf nullDev msg
 

File Criterion/Main.hs

           "bootstrap confidence interval"
  , Option ['k'] ["plot-kde"] (ReqArg (plot KernelDensity) "TYPE")
           "plot kernel density"
- , Option ['q'] ["quiet"] (noArg mempty { cfgVerbosity = Quiet })
+ , Option ['q'] ["quiet"] (noArg mempty { cfgVerbosity = ljust Quiet })
           "print less output"
  , Option [] ["resamples"]
           (ReqArg (pos "resample count"$ \n -> mempty { cfgResamples = n }) "N")
           "plot timings"
  , Option ['V'] ["version"] (noArg mempty { cfgPrintExit = Version })
           "display version, then exit"
- , Option ['v'] ["verbose"] (noArg mempty { cfgVerbosity = Verbose })
+ , Option ['v'] ["verbose"] (noArg mempty { cfgVerbosity = ljust Verbose })
           "print more output"
  ]