From 831d9c0737cd53be0b98f176f00c117de1ecc9ca Mon Sep 17 00:00:00 2001 From: tzlil Date: Sat, 15 Apr 2023 01:22:18 +0300 Subject: problem 1 --- src/HW.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/HW.hs') diff --git a/src/HW.hs b/src/HW.hs index 88fb1c2..ee26584 100644 --- a/src/HW.hs +++ b/src/HW.hs @@ -13,9 +13,9 @@ import Parse (parse) -- | Return the free variables in an expression fv :: Expr -> Set.Set String -fv _ = Set.singleton "UNIMPLEMENTED" -- Replace with your solution to problem 1 - - +fv (Var x) = Set.singleton x +fv (Lam x m) = x `Set.delete` (fv m) +fv (App m1 m2) = (fv m1) `Set.union` (fv m2) -- | Substitute n for x in e, avoiding name capture -- subst n x e e[x := n] -- cgit 1.4.1