From 98c40f4bf8849f5cdd3d3c49123bc911b8fa42e1 Mon Sep 17 00:00:00 2001 From: Mirek Kratochvil Date: Sun, 5 Mar 2023 21:34:20 +0100 Subject: strings and a few other small nice changes --- app/Env.hs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'app/Env.hs') diff --git a/app/Env.hs b/app/Env.hs index 03a7ce8..0b648f8 100644 --- a/app/Env.hs +++ b/app/Env.hs @@ -1,23 +1,23 @@ module Env where -import Code (InterpFn, PrlgEnv) +import Code (Id(..), InterpFn, PrlgEnv) import CodeLens -import qualified IR +import IR (StrTable, strtablize) import Lens.Micro.Mtl -withStrTable :: (IR.StrTable -> (IR.StrTable, a)) -> Env.PrlgEnv a +withStrTable :: (StrTable -> (StrTable, a)) -> Env.PrlgEnv a withStrTable f = do (st', x) <- f <$> use strtable strtable .= st' return x -findStruct :: String -> Int -> Env.PrlgEnv IR.Id +findStruct :: String -> Int -> Env.PrlgEnv Id findStruct str arity = do stri <- findAtom str - return IR.Id {IR.str = stri, IR.arity = arity} + return Id {str = stri, arity = arity} findAtom :: String -> Env.PrlgEnv Int -findAtom = withStrTable . flip IR.strtablize +findAtom = withStrTable . flip strtablize type PrlgEnv a = Code.PrlgEnv a -- cgit v1.2.3