summaryrefslogtreecommitdiff
path: root/app/Env.hs
diff options
context:
space:
mode:
authorMirek Kratochvil <exa.exa@gmail.com>2022-11-13 00:46:38 +0100
committerMirek Kratochvil <exa.exa@gmail.com>2022-11-13 00:46:38 +0100
commit8d5353dc8c7ef3eefb0ae4860e67602c455c1a58 (patch)
treec668dc93c1dddd517cfd771da5506c2159e6a2c7 /app/Env.hs
parent9d7868431792dcd94ec71adb9f95f55ab4bf027d (diff)
downloadprlg-8d5353dc8c7ef3eefb0ae4860e67602c455c1a58.tar.gz
prlg-8d5353dc8c7ef3eefb0ae4860e67602c455c1a58.tar.bz2
builtins are built in
Diffstat (limited to 'app/Env.hs')
-rw-r--r--app/Env.hs15
1 files changed, 6 insertions, 9 deletions
diff --git a/app/Env.hs b/app/Env.hs
index ba86c9e..744762b 100644
--- a/app/Env.hs
+++ b/app/Env.hs
@@ -1,25 +1,22 @@
module Env where
-import Code (Interp (..))
-import Control.Monad.IO.Class
+import Code (Interp(..), PrlgEnv)
import Control.Monad.Trans.State.Lazy
import qualified IR
-import qualified Operators
-import System.Console.Haskeline
-type PrlgEnv a = StateT Code.Interp (InputT IO) a
-
-withStrTable :: (IR.StrTable -> (IR.StrTable, a)) -> PrlgEnv a
+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'})
return x
-findStruct :: String -> Int -> PrlgEnv IR.Id
+findStruct :: String -> Int -> Env.PrlgEnv IR.Id
findStruct str arity = do
stri <- findAtom str
return IR.Id {IR.str = stri, IR.arity = arity}
-findAtom :: String -> PrlgEnv Int
+findAtom :: String -> Env.PrlgEnv Int
findAtom = withStrTable . flip IR.strtablize
+
+type PrlgEnv a = Code.PrlgEnv a