diff options
| author | Mirek Kratochvil <exa.exa@gmail.com> | 2023-02-25 22:35:59 +0100 |
|---|---|---|
| committer | Mirek Kratochvil <exa.exa@gmail.com> | 2023-02-25 22:35:59 +0100 |
| commit | 81df52f6565c073f9638108a66304d0ecc6cac02 (patch) | |
| tree | 6fd48069777d403177de923183afa6d8ca40349d /app/Env.hs | |
| parent | 3eb6125609245c6588df2cacc3102b8e78093ea5 (diff) | |
| download | prlg-81df52f6565c073f9638108a66304d0ecc6cac02.tar.gz prlg-81df52f6565c073f9638108a66304d0ecc6cac02.tar.bz2 | |
get lensy and classy
Diffstat (limited to 'app/Env.hs')
| -rw-r--r-- | app/Env.hs | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -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 |
