diff options
| author | Mirek Kratochvil <exa.exa@gmail.com> | 2022-11-13 00:46:38 +0100 |
|---|---|---|
| committer | Mirek Kratochvil <exa.exa@gmail.com> | 2022-11-13 00:46:38 +0100 |
| commit | 8d5353dc8c7ef3eefb0ae4860e67602c455c1a58 (patch) | |
| tree | c668dc93c1dddd517cfd771da5506c2159e6a2c7 /app/Env.hs | |
| parent | 9d7868431792dcd94ec71adb9f95f55ab4bf027d (diff) | |
| download | prlg-8d5353dc8c7ef3eefb0ae4860e67602c455c1a58.tar.gz prlg-8d5353dc8c7ef3eefb0ae4860e67602c455c1a58.tar.bz2 | |
builtins are built in
Diffstat (limited to 'app/Env.hs')
| -rw-r--r-- | app/Env.hs | 15 |
1 files changed, 6 insertions, 9 deletions
@@ -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 |
