From d79206440a0a7428dc8787d4605b2fc2178d7f37 Mon Sep 17 00:00:00 2001 From: Yuri Tatishchev Date: Mon, 4 May 2026 00:41:52 -0700 Subject: [PATCH] stupid compilation --- src/FWL/Compile.hs | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/FWL/Compile.hs b/src/FWL/Compile.hs index 75ade75..0fa206a 100644 --- a/src/FWL/Compile.hs +++ b/src/FWL/Compile.hs @@ -190,21 +190,18 @@ compileGuard _ _ = [] compileInExpr :: CompileEnv -> Expr -> Expr -> Value -- Fix 4: put the more-specific ct patterns BEFORE the generic 2-element -- EQual case to eliminate the overlapping pattern match warning. -compileInExpr env (EQual ["ct", "state"]) (ESet vs) = ctMatch env "state" vs -compileInExpr env (EQual ["ct", "status"]) (ESet vs) = ctMatch env "status" vs +compileInExpr env (EQual ["ct", "state"]) (ESet 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) = - matchExpr "in" (exprVal env l) (setVal (map (exprVal env) vs)) + matchExpr "==" (exprVal env l) (setVal (map (exprVal env) vs)) compileInExpr env l (EVar z) | 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 = 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 ───────────────────────────────────────────────────── compileAction :: CompileEnv -> Expr -> Maybe Value