From 30f4498d2c62b77d823ffe1292387e66ed047c25 Mon Sep 17 00:00:00 2001 From: "Juan J. Martinez" Date: Wed, 14 Sep 2022 07:24:38 +0100 Subject: Use modify --- src/Micro/Compiler.hs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/Micro/Compiler.hs b/src/Micro/Compiler.hs index 98fdae8..bd01b12 100644 --- a/src/Micro/Compiler.hs +++ b/src/Micro/Compiler.hs @@ -43,8 +43,7 @@ foldlEither fn init xs = -- the compilation to continue. addError :: Error -> State CompState (Maybe A.Type) addError e = do - st <- get - put st {stErr = e : stErr st} + modify $ \st -> st {stErr = e : stErr st} pure $ Nothing -- | @typecheckCall args params@ resolves @args@ and compares it with @params@, @@ -138,9 +137,8 @@ compileOne x = do nev <- return $ addSym nev $ Sym "$fn$" ftype True True pos put st {stEnv = nev, stErr = errs} _ <- compileAll body - st <- get -- store updated errors and the env with the function - put st {stEnv = ev} + modify $ \st -> st {stEnv = ev} pure Nothing where ftype = A.toFuncType params ret -- cgit v1.2.3