Bryan O'Sullivan avatar Bryan O'Sullivan committed 318020c

Fix compilation warnings.

Comments (0)

Files changed (6)

 -- executing it.
 runBenchmark :: Benchmarkable b => Environment -> b -> Criterion Sample
 runBenchmark env b = do
-  liftIO $ runForAtLeast 0.1 10000 (`replicateM_` getTime)
+  _ <- liftIO $ runForAtLeast 0.1 10000 (`replicateM_` getTime)
   let minTime = envClockResolution env * 1000
   (testTime, testIters, _) <- liftIO $ runForAtLeast (min minTime 0.1) 1 (run b)
-  prolix "ran %d iterations in %s\n" testIters (secs testTime)
+  _ <- prolix "ran %d iterations in %s\n" testIters (secs testTime)
   cfg <- getConfig
   let newIters    = ceiling $ minTime * testItersD / testTime
       sampleCount = fromLJ cfgSamples cfg
       newItersD   = fromIntegral newIters
       testItersD  = fromIntegral testIters
-  note "collecting %d samples, %d iterations each, in estimated %s\n"
+  _ <- note "collecting %d samples, %d iterations each, in estimated %s\n"
        sampleCount newIters (secs (fromIntegral sampleCount * newItersD *
                                    testTime / testItersD))
   times <- liftIO . fmap (U.map ((/ newItersD) . subtract (envClockCost env))) .
   let numSamples = U.length times
   let ests = [mean,stdDev]
   numResamples <- getConfigItem $ fromLJ cfgResamples
-  note "bootstrapping with %d resamples\n" numResamples
+  _ <- note "bootstrapping with %d resamples\n" numResamples
   res <- liftIO . withSystemRandom $ \gen ->
          resample gen ests numResamples times :: IO [Resample]
   ci <- getConfigItem $ fromLJ cfgConfInterval
   bs "std dev" es
   summary "\n"
   noteOutliers (classifyOutliers times)
-  note "variance introduced by outliers: %.3f%%\n" (v * 100)
-  note "variance is %s by outliers\n" wibble
+  _ <- note "variance introduced by outliers: %.3f%%\n" (v * 100)
+  _ <- note "variance is %s by outliers\n" wibble
   return times
   where bs :: String -> Estimate -> Criterion ()
-        bs d e = do note "%s: %s, lb %s, ub %s, ci %.3f\n" d
+        bs d e = do _ <- note "%s: %s, lb %s, ub %s, ci %.3f\n" d
                       (secs $ estPoint e)
                       (secs $ estLowerBound e) (secs $ estUpperBound e)
                       (estConfidenceLevel e)
               -> Criterion ()
 runAndAnalyse p env = plotAll <=< go ""
   where go pfx (Benchmark desc b)
-            | p desc'   = do note "\nbenchmarking %s\n" desc'
+            | p desc'   = do _ <- note "\nbenchmarking %s\n" desc'
                              summary (show desc' ++ ",") -- String will be quoted
                              x <- runAndAnalyseOne env desc' b
                              sameAxis <- getConfigItem $ fromLJ cfgPlotSameAxis

Criterion/Analysis.hs

             -> Criterion Double
 analyseMean a iters = do
   let µ = mean a
-  note "mean is %s (%d iterations)\n" (secs µ) iters
+  _ <- note "mean is %s (%d iterations)\n" (secs µ) iters
   noteOutliers . classifyOutliers $ a
   return µ
 
                     note "  %d (%.1g%%) %s\n" k (frac k) d
       outCount = countOutliers o
   when (outCount > 0) $ do
-    note "found %d outliers among %d samples (%.1g%%)\n"
+    _ <- note "found %d outliers among %d samples (%.1g%%)\n"
          outCount (samplesSeen o) (frac outCount)
     check (lowSevere o) 0 "low severe"
     check (lowMild o) 1 "low mild"

Criterion/Environment.hs

 -- | Measure the execution environment.
 measureEnvironment :: Criterion Environment
 measureEnvironment = do
-  note "warming up\n"
+  _ <- note "warming up\n"
   (_, seed, _) <- liftIO $ runForAtLeast 0.1 10000 resolution
-  note "estimating clock resolution...\n"
+  _ <- note "estimating clock resolution...\n"
   clockRes <- thd3 `fmap` liftIO (runForAtLeast 0.5 seed resolution) >>=
               uncurry analyseMean
-  note "estimating cost of a clock call...\n"
+  _ <- note "estimating cost of a clock call...\n"
   clockCost <- cost (min (100000 * clockRes) 1) >>= uncurry analyseMean
   return $ Environment {
                envClockResolution = clockRes
               U.length times)
     cost timeLimit = liftIO $ do
       let timeClock k = time_ (replicateM_ k getTime)
-      timeClock 1
+      _ <- timeClock 1
       (_, iters, elapsed) <- runForAtLeast 0.01 10000 timeClock
       times <- create (ceiling (timeLimit / elapsed)) $ \_ -> timeClock iters
       return (U.map (/ fromIntegral iters) times, U.length times)

Criterion/Main.hs

     `mplus` try (dim "svg" SVG 432 324)
     `mplus` (string "csv" >> return CSV)
   where dim s c dx dy = do
-          string s
+          _ <- string s
           try (uncurry c `fmap` dimensions) `mplus`
               (eof >> return (c dx dy))
         dimensions = do
-            char ':'
+            _ <- char ':'
             a <- many1 digit
-            char 'x'
+            _ <- char 'x'
             b <- many1 digit
             case (reads a, reads b) of
               ([(x,[])],[(y,[])]) -> return (x, y)
   withConfig cfg $
    if cfgPrintExit cfg == List
     then do
-      note "Benchmarks:\n"
+      _ <- note "Benchmarks:\n"
       mapM_ (note "  %s\n") (sort $ concatMap benchNames bs)
     else do
       case getLast $ cfgSummaryFile cfg of
 -- exit.
 parseError :: String -> IO a
 parseError msg = do
-  printError "Error: %s" msg
-  printError "Run \"%s --help\" for usage information\n" =<< getProgName
+  _ <- printError "Error: %s" msg
+  _ <- printError "Run \"%s --help\" for usage information\n" =<< getProgName
   exitWith (ExitFailure 64)
 
 -- $bench

Criterion/Measurement.hs

 time_ :: IO a -> IO Double
 time_ act = do
   start <- getTime
-  act
+  _ <- act
   end <- getTime
   return $! end - start
 
   ghc-options: -Wall -funbox-strict-fields
   if impl(ghc >= 6.8)
     ghc-options: -fwarn-tabs
-  if impl(ghc >= 6.12)
-    ghc-options: -fno-warn-unused-do-bind
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.