1
1
mirror of https://github.com/github/semantic.git synced 2024-12-26 08:25:19 +03:00

Define a type synonym for evaluating results.

This commit is contained in:
Rob Rix 2019-10-23 10:16:46 -04:00
parent fa02ff0a45
commit 0651d21e63
No known key found for this signature in database
GPG Key ID: F188A01508EA1CF7

View File

@ -18,6 +18,7 @@ module SpecHelpers
, lookupDeclaration , lookupDeclaration
, lookupMembers , lookupMembers
, EdgeLabel(..) , EdgeLabel(..)
, TestEvaluatingResult
, evaluateProject , evaluateProject
) where ) where
@ -142,11 +143,14 @@ type TestEvaluatingErrors term
, BaseError (UnspecializedError Precise (Val term)) , BaseError (UnspecializedError Precise (Val term))
, BaseError (LoadError Precise (Val term)) , BaseError (LoadError Precise (Val term))
] ]
type TestEvaluatingResult term a
= ( ScopeGraph Precise
, ( Heap Precise Precise (Value term Precise)
, Either (SomeError (Sum.Sum (TestEvaluatingErrors term))) a
)
)
testEvaluating :: Evaluator term Precise (Val term) (TestEvaluatingC term) a testEvaluating :: Evaluator term Precise (Val term) (TestEvaluatingC term) a
-> IO -> IO (TestEvaluatingResult term a)
(ScopeGraph Precise,
(Heap Precise Precise (Value term Precise),
Either (SomeError (Sum.Sum (TestEvaluatingErrors term))) a))
testEvaluating testEvaluating
= runM = runM
. runTraceByIgnoring . runTraceByIgnoring
@ -166,7 +170,7 @@ testEvaluating
type Val term = Value term Precise type Val term = Value term Precise
evaluateProject :: (HasPrelude lang, SLanguage lang) => TaskSession -> Proxy lang -> [FilePath] -> IO (ScopeGraph Precise, (Heap Precise Precise (Value Any Precise), Either (SomeError (Sum.Sum (TestEvaluatingErrors Any))) (ModuleTable (Module (ModuleResult Precise (Value Any Precise)))))) evaluateProject :: (HasPrelude lang, SLanguage lang) => TaskSession -> Proxy lang -> [FilePath] -> IO (TestEvaluatingResult Any a)
evaluateProject session proxy = case Map.lookup lang analysisParsers of evaluateProject session proxy = case Map.lookup lang analysisParsers of
Just (SomeParser parser) -> unsafeCoerce . testEvaluating <=< evaluateProject' session proxy parser Just (SomeParser parser) -> unsafeCoerce . testEvaluating <=< evaluateProject' session proxy parser
_ -> error $ "analysis not supported for " <> show lang _ -> error $ "analysis not supported for " <> show lang