From 47d48d695ed31810607841ddc2c711dc9a60ba80 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Mon, 7 May 2018 15:09:50 -0400 Subject: [PATCH] Add types for terms, values, and the effects for evaluating terms. --- test/Control/Abstract/Evaluator/Spec.hs | 30 ++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/test/Control/Abstract/Evaluator/Spec.hs b/test/Control/Abstract/Evaluator/Spec.hs index c43ca75e8..51284b846 100644 --- a/test/Control/Abstract/Evaluator/Spec.hs +++ b/test/Control/Abstract/Evaluator/Spec.hs @@ -1,6 +1,34 @@ module Control.Abstract.Evaluator.Spec where -import SpecHelpers +import Control.Abstract +import Data.Abstract.Module +import qualified Data.Abstract.Number as Number +import Data.Abstract.Package +import qualified Data.Abstract.Value as Value +import SpecHelpers hiding (Term) spec :: Spec spec = parallel $ pure () + +type TermEffects + = '[ LoopControl Value + , Return Value + , EvalClosure Term Value + , Resumable (AddressError Precise Value) + , Resumable (Value.ValueError Precise Value) + , Reader ModuleInfo + , Reader PackageInfo + , Fail + , Fresh + , Reader (Environment Precise Value) + , State (Environment Precise Value) + , State (Heap Precise Value) + , State (ModuleTable (Environment Precise Value, Value)) + , State (Exports Precise Value) + , State (JumpTable Term) + ] + +type Value = Value.Value Precise +newtype Term = Term { runTerm :: Evaluator Precise Term Value TermEffects Value } + +instance Show Term where showsPrec d _ = showParen (d > 10) $ showString "Term _"