1
1
mirror of https://github.com/github/semantic.git synced 2024-11-23 16:37:50 +03:00

Fix benchmarks.

The interface in Semantic.Util had changed.
Also removes the old `evalRubyFile` and `evalPythonFile` functions,
since they did not typecheck in ghci and do nothing that the project
equivalents don't.
This commit is contained in:
Patrick Thomson 2018-05-04 13:48:55 -04:00
parent 7f809b8d2b
commit 926e81b8a0
2 changed files with 2 additions and 6 deletions

View File

@ -11,10 +11,10 @@ import Control.Monad
-- project—coercing the result into a string will suffice, though it throws off the -- project—coercing the result into a string will suffice, though it throws off the
-- memory allocation results a bit. -- memory allocation results a bit.
pyEval :: FilePath -> Benchmarkable pyEval :: FilePath -> Benchmarkable
pyEval = whnfIO . fmap show . evaluatePythonFile . ("bench/bench-fixtures/python/" <>) pyEval = whnfIO . fmap show . evalPythonProject . ("bench/bench-fixtures/python/" <>)
rbEval :: FilePath -> Benchmarkable rbEval :: FilePath -> Benchmarkable
rbEval = whnfIO . fmap show . evaluateRubyFile . ("bench/bench-fixtures/ruby/" <>) rbEval = whnfIO . fmap show . evalRubyProject . ("bench/bench-fixtures/ruby/" <>)
main :: IO () main :: IO ()
main = defaultMain main = defaultMain

View File

@ -80,10 +80,6 @@ pythonPrelude = Just $ File (TypeLevel.symbolVal (Proxy :: Proxy (PreludePath Py
-- Evaluate a project, starting at a single entrypoint. -- Evaluate a project, starting at a single entrypoint.
evaluateProject parser lang prelude path = evaluatePackage <$> runTask (readProject Nothing path lang [] >>= parsePackage parser prelude) evaluateProject parser lang prelude path = evaluatePackage <$> runTask (readProject Nothing path lang [] >>= parsePackage parser prelude)
evalRubyFile path = interpret @(JustEvaluating Ruby.Term) <$> evaluateFile rubyParser path
evaluateFile parser path = evaluateModule <$> runTask (parseModule parser Nothing (file path))
parseFile :: Parser term -> FilePath -> IO term parseFile :: Parser term -> FilePath -> IO term
parseFile parser = runTask . (parse parser <=< readBlob . file) parseFile parser = runTask . (parse parser <=< readBlob . file)