summaryrefslogtreecommitdiff
path: root/app/Env.hs
diff options
context:
space:
mode:
authorMirek Kratochvil <exa.exa@gmail.com>2023-02-25 22:35:59 +0100
committerMirek Kratochvil <exa.exa@gmail.com>2023-02-25 22:35:59 +0100
commit81df52f6565c073f9638108a66304d0ecc6cac02 (patch)
tree6fd48069777d403177de923183afa6d8ca40349d /app/Env.hs
parent3eb6125609245c6588df2cacc3102b8e78093ea5 (diff)
downloadprlg-81df52f6565c073f9638108a66304d0ecc6cac02.tar.gz
prlg-81df52f6565c073f9638108a66304d0ecc6cac02.tar.bz2
get lensy and classy
Diffstat (limited to 'app/Env.hs')
-rw-r--r--app/Env.hs10
1 files changed, 5 insertions, 5 deletions
diff --git a/app/Env.hs b/app/Env.hs
index 82bf9d0..592d608 100644
--- a/app/Env.hs
+++ b/app/Env.hs
@@ -1,14 +1,14 @@
module Env where
-import Code (Interp(..), InterpFn, PrlgEnv)
-import Control.Monad.Trans.State.Lazy (gets, modify)
+import Code (InterpFn, PrlgEnv)
+import CodeLens
import qualified IR
+import Lens.Family2.State
withStrTable :: (IR.StrTable -> (IR.StrTable, a)) -> Env.PrlgEnv a
withStrTable f = do
- st <- gets strtable
- let (st', x) = f st
- modify (\s -> s {strtable = st'})
+ (st', x) <- strtable `uses` f
+ strtable .= st'
return x
findStruct :: String -> Int -> Env.PrlgEnv IR.Id