From b254b0347c24164713fe64a50bcf2558f1d91eb7 Mon Sep 17 00:00:00 2001 From: Luca Bruno Date: Tue, 8 Jul 2014 13:47:31 +0200 Subject: [PATCH] Evaluate with expression --- Nix/Eval.hs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Nix/Eval.hs b/Nix/Eval.hs index 2f869ff..80740fa 100644 --- a/Nix/Eval.hs +++ b/Nix/Eval.hs @@ -56,7 +56,14 @@ evalExpr = cata phi NVConstant (NBool False) -> f env _ -> error "condition must be a boolean" - phi (NWith _c _v) = error "with: not implemented" + phi (NWith scope e) = \env -> case env of + (Fix (NVSet env')) -> do + s <- scope env + case s of + (Fix (NVSet scope')) -> e . Fix . NVSet $ Map.union scope' env' + _ -> error "scope must be a set in with statement" + _ -> error "invalid evaluation environment" + phi (NAssert _e _v) = error "assert: not implemented" phi (NVar _v) = error "var: not implemented"