stupid compilation

This commit is contained in:
2026-05-04 00:41:52 -07:00
parent d136bd62f7
commit d79206440a

View File

@@ -190,21 +190,18 @@ compileGuard _ _ = []
compileInExpr :: CompileEnv -> Expr -> Expr -> Value compileInExpr :: CompileEnv -> Expr -> Expr -> Value
-- Fix 4: put the more-specific ct patterns BEFORE the generic 2-element -- Fix 4: put the more-specific ct patterns BEFORE the generic 2-element
-- EQual case to eliminate the overlapping pattern match warning. -- EQual case to eliminate the overlapping pattern match warning.
compileInExpr env (EQual ["ct", "state"]) (ESet vs) = ctMatch env "state" vs compileInExpr env (EQual ["ct", "state"]) (ESet vs) =
compileInExpr env (EQual ["ct", "status"]) (ESet vs) = ctMatch env "status" vs matchExpr "in" (object ["ct" .= object ["key" .= ("state" :: String)]]) (toJSON (map (exprVal env) vs))
compileInExpr env (EQual ["ct", "status"]) (ESet vs) =
matchExpr "in" (object ["ct" .= object ["key" .= ("status" :: String)]]) (toJSON (map (exprVal env) vs))
compileInExpr env l (ESet vs) = compileInExpr env l (ESet vs) =
matchExpr "in" (exprVal env l) (setVal (map (exprVal env) vs)) matchExpr "==" (exprVal env l) (setVal (map (exprVal env) vs))
compileInExpr env l (EVar z) compileInExpr env l (EVar z)
| Just (DZone _ ns) <- Map.lookup z env = | Just (DZone _ ns) <- Map.lookup z env =
matchExpr "in" (exprVal env l) (setVal (map (A.String . toText) ns)) matchExpr "==" (exprVal env l) (setVal (map (A.String . toText) ns))
compileInExpr env l r = compileInExpr env l r =
matchExpr "==" (exprVal env l) (exprVal env r) matchExpr "==" (exprVal env l) (exprVal env r)
ctMatch :: CompileEnv -> String -> [Expr] -> Value
ctMatch env key vs = matchExpr "in"
(object ["ct" .= object ["key" .= (key :: String)]])
(setVal (map (exprVal env) vs))
-- ─── Action → Maybe Value ───────────────────────────────────────────────────── -- ─── Action → Maybe Value ─────────────────────────────────────────────────────
compileAction :: CompileEnv -> Expr -> Maybe Value compileAction :: CompileEnv -> Expr -> Maybe Value