1
1
mirror of https://github.com/github/semantic.git synced 2025-01-04 13:34:31 +03:00

Move assign into Control.Abstract.Evaluator.

This commit is contained in:
Rob Rix 2018-03-12 15:19:28 -04:00
parent 49c63fac0a
commit b060a7a83a
2 changed files with 13 additions and 10 deletions

View File

@ -49,16 +49,6 @@ lookupOrAlloc' name v env = do
assign a v
pure (name, a)
-- | Write a value to the given 'Address' in the 'Store'.
assign :: ( Ord (LocationFor value)
, MonadStore value m
, Reducer value (CellFor value)
)
=> Address (LocationFor value) value
-> value
-> m ()
assign address = modifyStore . storeInsert address
-- Instances

View File

@ -1,9 +1,12 @@
{-# LANGUAGE ConstrainedClassMethods, FunctionalDependencies #-}
module Control.Abstract.Evaluator where
import Data.Abstract.Address
import Data.Abstract.Configuration
import Data.Abstract.ModuleTable
import Data.Abstract.Store
import Data.Abstract.Value
import Data.Semigroup.Reducer
import Prelude hiding (fail)
import Prologue
@ -49,6 +52,16 @@ class Monad m => MonadStore value m | m -> value where
modifyStore :: MonadStore value m => (StoreFor value -> StoreFor value) -> m ()
modifyStore f = getStore >>= putStore . f
-- | Write a value to the given 'Address' in the 'Store'.
assign :: ( Ord (LocationFor value)
, MonadStore value m
, Reducer value (CellFor value)
)
=> Address (LocationFor value) value
-> value
-> m ()
assign address = modifyStore . storeInsert address
class Monad m => MonadModuleTable term value m | m -> term, m -> value where
-- | Retrieve the table of evaluated modules.