1
1
mirror of https://github.com/github/semantic.git synced 2024-12-22 06:11:49 +03:00

Define a MonadAnalysis instance for Evaluation.

This commit is contained in:
Rob Rix 2018-03-01 15:20:02 -05:00
parent 4d37770f7e
commit 052c1fdbb3

View File

@ -1,4 +1,4 @@
{-# LANGUAGE ConstraintKinds, DataKinds, GeneralizedNewtypeDeriving, ScopedTypeVariables, TypeApplications, TypeFamilies, TypeOperators, MultiParamTypeClasses #-}
{-# LANGUAGE ConstraintKinds, DataKinds, GeneralizedNewtypeDeriving, ScopedTypeVariables, TypeApplications, TypeFamilies, TypeOperators, MultiParamTypeClasses, UndecidableInstances #-}
module Analysis.Abstract.Evaluating where
import Prologue
@ -104,3 +104,14 @@ evaluates pairs (_, t) = run @(Evaluating term v) (runEvaluator (localModuleTabl
newtype Evaluation term value a = Evaluation { runEvaluation :: Evaluator (Evaluating term value) term value a }
deriving (Applicative, Functor, Monad)
instance ( AbstractValue v
, Evaluatable (Base t)
, FreeVariables t
, MonadAddressable (LocationFor v) v (Evaluation t v)
, MonadFunction t v (Evaluation t v)
, Recursive t
, Semigroup (Cell (LocationFor v) v)
)
=> MonadAnalysis t v (Evaluation t v) where
evaluateTerm = foldSubterms eval