1
1
mirror of https://github.com/github/semantic.git synced 2024-11-30 06:07:23 +03:00
semantic/semantic-python/bench/Bench.hs
2020-07-01 02:17:39 -04:00

21 lines
587 B
Haskell

{-# LANGUAGE TypeApplications #-}
module Main
( main
) where
import Control.Monad
import qualified Data.ByteString as B
import Gauge
import System.Exit (die)
import System.Environment (getArgs)
import qualified Language.Python.AST as Py
import Language.Python.Grammar
import AST.Unmarshal
main :: IO ()
main = do
getArgs >>= defaultMain . map (bench <*> nfIO . (() <$) . parseFile)
parseFile :: FilePath -> IO (Py.Module ())
parseFile = either die pure <=< parseByteString @Py.Module @() tree_sitter_python <=< B.readFile