From 81df52f6565c073f9638108a66304d0ecc6cac02 Mon Sep 17 00:00:00 2001 From: Mirek Kratochvil Date: Sat, 25 Feb 2023 22:35:59 +0100 Subject: get lensy and classy --- app/Env.hs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'app/Env.hs') 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 -- cgit v1.2.3