diff options
author | Juan J. Martinez <jjm@usebox.net> | 2022-08-13 20:34:35 +0100 |
---|---|---|
committer | Juan J. Martinez <jjm@usebox.net> | 2022-08-13 20:34:35 +0100 |
commit | 8c392eb76c143ea7667fe8529e697ac4777b567f (patch) | |
tree | 9be871db7c552f2fbf6d6448af5eb69cb2b6891f | |
parent | f9069e14e80eb2c8b134a0297fa17b81742c8a03 (diff) | |
download | micro-lang-hs-8c392eb76c143ea7667fe8529e697ac4777b567f.tar.gz micro-lang-hs-8c392eb76c143ea7667fe8529e697ac4777b567f.zip |
Use as-pattern
-rw-r--r-- | src/Env.hs | 5 |
1 files changed, 1 insertions, 4 deletions
@@ -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 |