1
1
mirror of https://github.com/github/semantic.git synced 2024-11-24 17:04:47 +03:00

Move the evaluated module table accessors into their own module.

This commit is contained in:
Rob Rix 2018-05-07 12:20:23 -04:00
parent f2288e3d69
commit eabb3b79a1
4 changed files with 25 additions and 21 deletions

View File

@ -42,6 +42,7 @@ library
, Control.Abstract.Heap , Control.Abstract.Heap
, Control.Abstract.Label , Control.Abstract.Label
, Control.Abstract.Matching , Control.Abstract.Matching
, Control.Abstract.ModuleTable
, Control.Abstract.Roots , Control.Abstract.Roots
, Control.Abstract.Value , Control.Abstract.Value
-- Control flow -- Control flow

View File

@ -10,5 +10,6 @@ import Control.Abstract.Evaluator as X
import Control.Abstract.Exports as X import Control.Abstract.Exports as X
import Control.Abstract.Heap as X import Control.Abstract.Heap as X
import Control.Abstract.Label as X import Control.Abstract.Label as X
import Control.Abstract.ModuleTable as X
import Control.Abstract.Roots as X import Control.Abstract.Roots as X
import Control.Abstract.Value as X import Control.Abstract.Value as X

View File

@ -1,12 +1,6 @@
{-# LANGUAGE GADTs, GeneralizedNewtypeDeriving, RankNTypes, ScopedTypeVariables, TypeFamilies, TypeOperators #-} {-# LANGUAGE GADTs, GeneralizedNewtypeDeriving, RankNTypes, ScopedTypeVariables, TypeFamilies, TypeOperators #-}
module Control.Abstract.Evaluator module Control.Abstract.Evaluator
( Evaluator(..) ( Evaluator(..)
-- * State
, ModuleTable
-- * Module tables
, getModuleTable
, putModuleTable
, modifyModuleTable
-- * Effects -- * Effects
, EvalClosure(..) , EvalClosure(..)
, evaluateClosureBody , evaluateClosureBody
@ -53,21 +47,6 @@ newtype Evaluator location term value effects a = Evaluator { runEvaluator :: Ef
deriving instance Member NonDet effects => Alternative (Evaluator location term value effects) deriving instance Member NonDet effects => Alternative (Evaluator location term value effects)
-- Module table
-- | Retrieve the table of evaluated modules.
getModuleTable :: Member (State (ModuleTable (Environment location value, value))) effects => Evaluator location term value effects (ModuleTable (Environment location value, value))
getModuleTable = raise get
-- | Set the table of evaluated modules.
putModuleTable :: Member (State (ModuleTable (Environment location value, value))) effects => ModuleTable (Environment location value, value) -> Evaluator location term value effects ()
putModuleTable = raise . put
-- | Update the evaluated module table.
modifyModuleTable :: Member (State (ModuleTable (Environment location value, value))) effects => (ModuleTable (Environment location value, value) -> ModuleTable (Environment location value, value)) -> Evaluator location term value effects ()
modifyModuleTable = raise . modify'
-- Effects -- Effects
-- | An effect to evaluate a closures body. -- | An effect to evaluate a closures body.

View File

@ -0,0 +1,23 @@
module Control.Abstract.ModuleTable
( ModuleTable
, getModuleTable
, putModuleTable
, modifyModuleTable
) where
import Control.Abstract.Evaluator
import Data.Abstract.Environment
import Data.Abstract.ModuleTable
import Prologue
-- | Retrieve the table of evaluated modules.
getModuleTable :: Member (State (ModuleTable (Environment location value, value))) effects => Evaluator location term value effects (ModuleTable (Environment location value, value))
getModuleTable = raise get
-- | Set the table of evaluated modules.
putModuleTable :: Member (State (ModuleTable (Environment location value, value))) effects => ModuleTable (Environment location value, value) -> Evaluator location term value effects ()
putModuleTable = raise . put
-- | Update the evaluated module table.
modifyModuleTable :: Member (State (ModuleTable (Environment location value, value))) effects => (ModuleTable (Environment location value, value) -> ModuleTable (Environment location value, value)) -> Evaluator location term value effects ()
modifyModuleTable = raise . modify'