1
1
mirror of https://github.com/github/semantic.git synced 2024-12-18 20:31:55 +03:00

Generalize EvalTerm to * -> *.

This commit is contained in:
Rob Rix 2019-10-18 14:37:55 -04:00
parent 70f33d45ef
commit bef3ca1ed8
No known key found for this signature in database
GPG Key ID: F188A01508EA1CF7

View File

@ -17,6 +17,7 @@ import Data.Abstract.Evaluatable
import Data.Abstract.Module
import Data.Abstract.ModuleTable as ModuleTable
import Data.Language (Language)
import Source.Loc
import Source.Span
type ModuleC address value m
@ -150,14 +151,14 @@ class EvalTerm term where
--
-- This calls out to the 'Evaluatable' instances, and can have other functions composed after it to e.g. intercept effects arising in the evaluation of the term.
evalTerm :: ( Carrier sig m
, AbstractValue term address value m
, AbstractValue (term Loc) address value m
, Member (Allocator address) sig
, Member (Bitwise value) sig
, Member (Boolean value) sig
, Member (Deref value) sig
, Member (Error (LoopControl value)) sig
, Member (Error (Return value)) sig
, Member (Function term address value) sig
, Member (Function (term Loc) address value) sig
, Member (Modules address value) sig
, Member (Numeric value) sig
, Member (Object address value) sig
@ -170,7 +171,7 @@ class EvalTerm term where
, Member (Resumable (BaseError (HeapError address))) sig
, Member (Resumable (BaseError (ScopeError address))) sig
, Member (Resumable (BaseError (UnspecializedError address value))) sig
, Member (Resumable (BaseError (EvalError term address value))) sig
, Member (Resumable (BaseError (EvalError (term Loc) address value))) sig
, Member (Resumable (BaseError ResolutionError)) sig
, Member (State (Heap address address value)) sig
, Member (State (ScopeGraph address)) sig
@ -185,15 +186,15 @@ class EvalTerm term where
, Ord address
, Show address
)
=> Open (term -> Evaluator term address value m value)
-> term -> Evaluator term address value m value
=> Open (term Loc -> Evaluator (term Loc) address value m value)
-> term Loc -> Evaluator (term Loc) address value m value
instance ( AccessControls term
, Declarations term
, Evaluatable (Base term)
, FreeVariables term
, HasSpan term
, Recursive term
instance ( AccessControls (term Loc)
, Declarations (term Loc)
, Evaluatable (Base (term Loc))
, FreeVariables (term Loc)
, HasSpan (term Loc)
, Recursive (term Loc)
)
=> EvalTerm term where
-- NB: We use a lazy pattern match for the lambdas argument to postpone evaluating the pair until eval/ref is called.