aboutsummaryrefslogtreecommitdiff
path: root/src/Micro
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2022-09-14 07:24:38 +0100
committerJuan J. Martinez <jjm@usebox.net>2022-09-14 07:24:38 +0100
commit30f4498d2c62b77d823ffe1292387e66ed047c25 (patch)
treeab9f247c536da207b55967b70f3aa486d62bc94b /src/Micro
parent8fe1fc0c2b0b10f64c43498481e738221fe03bb3 (diff)
downloadmicro-lang-hs-30f4498d2c62b77d823ffe1292387e66ed047c25.tar.gz
micro-lang-hs-30f4498d2c62b77d823ffe1292387e66ed047c25.zip
Use modify
Diffstat (limited to 'src/Micro')
-rw-r--r--src/Micro/Compiler.hs6
1 files 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