mirror of
https://github.com/github/semantic.git
synced 2025-01-06 23:46:21 +03:00
Define evaluateModules in terms of evaluatePackage.
This commit is contained in:
parent
52fa4c9c0f
commit
4e3c607c37
@ -26,7 +26,7 @@ import Data.Abstract.FreeVariables as X
|
||||
import Data.Abstract.Module
|
||||
import Data.Abstract.ModuleTable as ModuleTable
|
||||
import Data.Abstract.Origin (SomeOrigin, packageOrigin)
|
||||
import Data.Abstract.Package
|
||||
import Data.Abstract.Package as Package
|
||||
import Data.Semigroup.App
|
||||
import Data.Semigroup.Foldable
|
||||
import Data.Semigroup.Reducer hiding (unit)
|
||||
@ -181,11 +181,13 @@ withModules :: MonadEvaluatable location term value m
|
||||
withModules = localModuleTable . const . ModuleTable.fromModules
|
||||
|
||||
-- | Evaluate with a list of modules in scope, taking the head module as the entry point.
|
||||
evaluateModules :: MonadEvaluatable location term value m
|
||||
evaluateModules :: ( Effectful m
|
||||
, Member (Reader (SomeOrigin term)) effects
|
||||
, MonadEvaluatable location term value (m effects)
|
||||
)
|
||||
=> [Module term]
|
||||
-> m value
|
||||
evaluateModules [] = fail "evaluateModules: empty list"
|
||||
evaluateModules (m:ms) = withModules ms (evaluateModule m)
|
||||
-> m effects [value]
|
||||
evaluateModules = evaluatePackage . Package.fromModules
|
||||
|
||||
evaluatePackage :: ( Effectful m
|
||||
, Member (Reader (SomeOrigin term)) effects
|
||||
|
@ -130,7 +130,7 @@ evaluateFiles :: forall term effects
|
||||
)
|
||||
=> Parser term
|
||||
-> [FilePath]
|
||||
-> IO (Final effects (Value Precise))
|
||||
-> IO (Final effects [Value Precise])
|
||||
evaluateFiles parser paths = runAnalysis @(Evaluating Precise term (Value Precise)) . evaluateModules <$> parseFiles parser paths
|
||||
|
||||
-- | Evaluate terms and an entry point to a value with a given prelude.
|
||||
|
Loading…
Reference in New Issue
Block a user