1
1
mirror of https://github.com/github/semantic.git synced 2024-12-24 23:42:31 +03:00

Use localState with a proxy argument

This commit is contained in:
joshvera 2018-02-22 12:41:49 -05:00
parent 1826192c05
commit e1135f56f9
3 changed files with 4 additions and 8 deletions

View File

@ -102,17 +102,14 @@ instance (Recursive t
eval [x] = step x -- Return the value for the last term
eval (x:xs) = do
_ <- step @v x -- Evaluate the head term
env <- get @(Environment (LocationFor v) v) -- Get the global environment after evaluation since
env <- get @(Env' v) -- Get the global environment after evaluation since
-- it might have been modified by the 'step'
-- evaluation above ^.
-- Finally, evaluate the rest of the terms, but do so by calculating a new
-- environment each time where the free variables in those terms are bound
-- to the global environment.
put @(Environment (LocationFor v) v) (bindEnv (freeVariables1 xs) env)
-- TODO: This might not be right
transactionState (Proxy :: Proxy (Environment (LocationFor v) v)) (eval xs)
-- transactionState (const (bindEnv (freeVariables1 xs) env)) (eval xs)
localState (Proxy :: Proxy (Env' v)) (bindEnv (freeVariables1 xs) env) (eval xs)
-- | The 'Eval' class defines the necessary interface for a term to be evaluated. While a default definition of 'eval' is given, instances with computational content must implement 'eval' to perform their small-step operational semantics.
-- class Monad m => Eval term v m constr where

View File

@ -110,8 +110,7 @@ instance ( Ord l
assign a v
pure (name, a)
put (foldr (uncurry envInsert) env bindings)
transactionState (Proxy :: Proxy (Environment l (Value l t))) (E3.step body)
localState (Proxy :: Proxy (E3.Env' (Value l t))) (foldr (uncurry envInsert) env bindings) (E3.step body)
data Comparison a
= LessThan !a !a

2
vendor/effects vendored

@ -1 +1 @@
Subproject commit de7b02dbf32ea455c2075ab6682c3616b9461077
Subproject commit 05640b6d099d58960d6b68e8170fe16985630d36