File: benchmarker.hs

package info (click to toggle)
haskell-toml-parser 2.0.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 320 kB
  • sloc: haskell: 3,364; yacc: 131; makefile: 3
file content (19 lines) | stat: -rw-r--r-- 484 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19


import Control.Exception (evaluate)
import qualified Data.Text.IO
import Data.Time (diffUTCTime, getCurrentTime)
import System.Environment (getArgs)
import Toml (parse)

main :: IO ()
main =
 do args <- getArgs
    filename <- case args of
      [filename] -> pure filename
      _ -> fail "Usage: benchmarker <file.toml>"
    txt <- Data.Text.IO.readFile filename
    start <- getCurrentTime
    evaluate (parse txt)
    stop <- getCurrentTime
    print (stop `diffUTCTime` start)