mirror of
https://github.com/github/semantic.git
synced 2024-12-22 06:11:49 +03:00
Use Evaluation in evaluate/evaluates.
This commit is contained in:
parent
7ceb6d6370
commit
32bb45f52c
@ -77,14 +77,14 @@ evaluate :: forall v term.
|
||||
, AbstractValue v
|
||||
, Evaluatable (Base term)
|
||||
, FreeVariables term
|
||||
, MonadAddressable (LocationFor v) v (Evaluator (Evaluating term v) term v)
|
||||
, MonadFunction term v (Evaluator (Evaluating term v) term v)
|
||||
, MonadAddressable (LocationFor v) v (Evaluation term v)
|
||||
, MonadFunction term v (Evaluation term v)
|
||||
, Recursive term
|
||||
, Semigroup (Cell (LocationFor v) v)
|
||||
)
|
||||
=> term
|
||||
-> Final (Evaluating term v) v
|
||||
evaluate = run @(Evaluating term v) . runEvaluator . foldSubterms eval
|
||||
evaluate = run @(Evaluating term v) . runEvaluator . runEvaluation . evaluateTerm
|
||||
|
||||
-- | Evaluate terms and an entry point to a value.
|
||||
evaluates :: forall v term.
|
||||
@ -92,15 +92,15 @@ evaluates :: forall v term.
|
||||
, AbstractValue v
|
||||
, Evaluatable (Base term)
|
||||
, FreeVariables term
|
||||
, MonadAddressable (LocationFor v) v (Evaluator (Evaluating term v) term v)
|
||||
, MonadFunction term v (Evaluator (Evaluating term v) term v)
|
||||
, MonadAddressable (LocationFor v) v (Evaluation term v)
|
||||
, MonadFunction term v (Evaluation term v)
|
||||
, Recursive term
|
||||
, Semigroup (Cell (LocationFor v) v)
|
||||
)
|
||||
=> [(Blob, term)] -- List of (blob, term) pairs that make up the program to be evaluated
|
||||
-> (Blob, term) -- Entrypoint
|
||||
-> Final (Evaluating term v) v
|
||||
evaluates pairs (_, t) = run @(Evaluating term v) (runEvaluator (localModuleTable (const (Linker (Map.fromList (map (first (dropExtensions . blobPath)) pairs)))) (foldSubterms eval t)))
|
||||
evaluates pairs (_, t) = run @(Evaluating term v) (runEvaluator (runEvaluation (localModuleTable (const (Linker (Map.fromList (map (first (dropExtensions . blobPath)) pairs)))) (evaluateTerm t))))
|
||||
|
||||
newtype Evaluation term value a = Evaluation { runEvaluation :: Evaluator (Evaluating term value) term value a }
|
||||
deriving (Applicative, Functor, Monad, MonadFail)
|
||||
|
Loading…
Reference in New Issue
Block a user