From 8c392eb76c143ea7667fe8529e697ac4777b567f Mon Sep 17 00:00:00 2001 From: "Juan J. Martinez" Date: Sat, 13 Aug 2022 20:34:35 +0100 Subject: Use as-pattern --- src/Env.hs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src/Env.hs') diff --git a/src/Env.hs b/src/Env.hs index 1b98e9f..380addc 100644 --- a/src/Env.hs +++ b/src/Env.hs @@ -44,12 +44,9 @@ existsSyml env sym = isJust $ getSyml env sym -- environment. It will create a new enviroment if the symbol already exists -- (shadowing). addSym :: Env -> Sym -> Env -addSym (Env m parent) (id, typ, pos) = case getSym env id of +addSym env@(Env m parent) sym@(id, typ, pos) = case getSym env id of Nothing -> Env (Map.insert id sym m) parent Just s -> Env (Map.singleton id sym) $ Just env - where - env = (Env m parent) - sym = (id, typ, pos) -- | @addEnv e@ adds a new local environment using @e@ as parent. addEnv :: Env -> Env -- cgit v1.2.3