Commits

Bryan O'Sullivan committed dd2b392

Remove sources of compiler warnings from benchmarks

Comments (0)

Files changed (3)

benchmarks/AesonEncode.hs

 import Control.Exception
 import Control.Monad
 import Data.Aeson
-import Data.Attoparsec
+import Data.Attoparsec (IResult(..), parseWith)
 import Data.Time.Clock
 import System.Environment (getArgs)
 import System.IO

benchmarks/AesonParse.hs

 import Control.Exception
 import Control.Monad
 import Data.Aeson
-import Data.Attoparsec
+import Data.Attoparsec (IResult(..), parseWith)
 import Data.Time.Clock
 import System.Environment (getArgs)
 import System.IO
 import qualified Data.ByteString as B
 
+main :: IO ()
 main = do
   (bs:cnt:args) <- getArgs
   let count = read cnt :: Int
           let refill = B.hGet h blkSize
           result <- parseWith refill json =<< refill
           case result of
-            Done _ r -> loop (good+1) bad
+            Done _ _ -> loop (good+1) bad
             _        -> loop good (bad+1)
     (good, _) <- loop 0 0
     delta <- flip diffUTCTime start `fmap` getCurrentTime
     putStrLn $ "  " ++ show good ++ " good, " ++ show delta
     let rate = fromIntegral count / realToFrac delta :: Double
-    putStrLn $ "  " ++ show (round rate) ++ " per second"
+    putStrLn $ "  " ++ show (round rate :: Int) ++ " per second"

benchmarks/JsonParse.hs

 import Text.JSON
 import Data.Time.Clock
 import System.Environment (getArgs)
-import System.IO
 
 instance NFData JSValue where
     rnf JSNull = ()
     rnf (JSArray vs) = rnf vs
     rnf (JSObject kvs) = rnf (fromJSObject kvs)
 
+main :: IO ()
 main = do
   (cnt:args) <- getArgs
   let count = read cnt :: Int
             | otherwise = do
           s <- readFile arg
           case decodeStrict s of
-            Ok (v::JSValue) -> loop (good+1) 0
+            Ok (_::JSValue) -> loop (good+1) 0
             _ -> loop 0 (bad+1)
     (good, _) <- loop 0 0
     end <- getCurrentTime