1
1
mirror of https://github.com/github/semantic.git synced 2024-12-25 16:02:43 +03:00

Add askRoots to the MonadEvaluator interface with a default definition.

This commit is contained in:
Rob Rix 2018-03-06 17:24:14 -05:00
parent 6650e4de4e
commit f6cd19ddb9

View File

@ -1,4 +1,4 @@
{-# LANGUAGE DataKinds, FunctionalDependencies, GeneralizedNewtypeDeriving, RankNTypes, StandaloneDeriving, UndecidableInstances #-}
{-# LANGUAGE DataKinds, DefaultSignatures, FunctionalDependencies, GeneralizedNewtypeDeriving, RankNTypes, StandaloneDeriving, UndecidableInstances #-}
module Control.Abstract.Evaluator where
import Control.Applicative
@ -10,6 +10,7 @@ import Control.Monad.Effect.Reader
import Control.Monad.Effect.State
import Data.Abstract.Configuration
import Data.Abstract.Linker
import Data.Abstract.Live
import Data.Abstract.Value
import Prelude hiding (fail)
@ -45,6 +46,10 @@ class MonadFail m => MonadEvaluator term value m | m -> term, m -> value where
-- | Run an action with a locally-modified table of unevaluated modules.
localModuleTable :: (Linker term -> Linker term) -> m a -> m a
-- | Retrieve the current root set.
askRoots :: Ord (LocationFor value) => m (Live (LocationFor value) value)
askRoots = pure mempty
-- | Get the current 'Configuration' with a passed-in term.
getConfiguration :: Ord (LocationFor value) => term -> m (Configuration (LocationFor value) term value)
getConfiguration term = Configuration term mempty <$> askLocalEnv <*> getStore