✨
This commit is contained in:
@ -27,9 +27,9 @@ instance Monad CheckM where
|
||||
let CheckM y = f x'
|
||||
in y vars
|
||||
|
||||
elem' :: VName -> [VName] -> Bool
|
||||
elem' _ [] = False
|
||||
elem' x (y : ys) = if x == y then True else elem' x ys
|
||||
inList :: VName -> [VName] -> Bool
|
||||
inList _ [] = False
|
||||
inList x (y : ys) = if x == y then True else inList x ys
|
||||
|
||||
askVars :: CheckM Vars
|
||||
askVars = CheckM $ \vars -> Right vars
|
||||
@ -68,7 +68,7 @@ check (KvGet e1) = check e1
|
||||
check (KvPut e1 e2) = checkBinOp e1 e2
|
||||
check (Var v) = do
|
||||
vars <- askVars
|
||||
if elem' v vars
|
||||
if inList v vars
|
||||
then pure ()
|
||||
else CheckM $ \_vars -> Left $ "Variable not in scope: "++v
|
||||
check (Let var e1 e2) = do
|
||||
|
Reference in New Issue
Block a user