1
1
mirror of https://github.com/github/semantic.git synced 2024-11-24 00:42:33 +03:00

Evaluate records using the Domain effect.

This commit is contained in:
Rob Rix 2019-12-19 12:09:37 -05:00
parent 6810624e2c
commit c4db1c9db4
No known key found for this signature in database
GPG Key ID: F188A01508EA1CF7

View File

@ -72,14 +72,13 @@ eval Analysis{..} eval = \case
c' <- eval c >>= A.asBool @Term @address
if c' then eval t else eval e
Load p -> eval p >>= A.asString @Term @address >> A.unit @Term @address -- FIXME: add a load command or something
Record fields -> traverse (traverse eval) fields >>= record
Record fields -> A.record fields
a :. b -> do
a' <- ref a
a' ... b >>= maybe (freeVariable (show b)) (deref' b)
a' <- eval a >>= asRecord @Term @address
maybe (freeVariable (show b)) eval (lookup b a')
a :? b -> do
a' <- ref a
mFound <- a' ... b
A.bool @Term @address (isJust mFound)
a' <- eval a >>= asRecord @Term @address
A.bool @Term @address (isJust (lookup b a'))
a := b -> do
b' <- eval b