Skip to content

Commit

Permalink
Review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
siddharth-krishna committed Mar 12, 2024
1 parent 32f009e commit dde2789
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions inferno-core/src/Inferno/Eval.hs
Original file line number Diff line number Diff line change
Expand Up @@ -197,12 +197,13 @@ eval env@(localEnv, pinnedEnv) expr = case expr of
valMap <- foldrM (\(f, e, _) vs -> eval env e >>= \v -> return ((f, v) : vs)) [] fs
return $ VRecord $ Map.fromList valMap
RecordField_ (Ident r) f -> do
eval env (Var undefined Nothing LocalScope $ Expl $ ExtIdent $ Right r) >>= \case
VRecord fs -> do
case Map.lookup (ExtIdent $ Right r) localEnv of
Just (VRecord fs) -> do
case Map.lookup f fs of
Just v -> return v
Nothing -> throwM $ RuntimeError "record field not found"
_ -> throwM $ RuntimeError "failed to match with a record"
Just _ -> throwM $ RuntimeError "failed to match with a record"
Nothing -> throwM $ RuntimeError $ show (ExtIdent $ Right r) <> " not found in the unpinned env"
One_ e -> eval env e >>= return . VOne
Empty_ -> return $ VEmpty
Assert_ cond e ->
Expand Down

0 comments on commit dde2789

Please sign in to comment.