summaryrefslogtreecommitdiff
path: root/app/Env.hs
diff options
context:
space:
mode:
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