diff options
| author | Mirek Kratochvil <exa.exa@gmail.com> | 2023-03-05 21:34:20 +0100 |
|---|---|---|
| committer | Mirek Kratochvil <exa.exa@gmail.com> | 2023-03-05 21:34:20 +0100 |
| commit | 98c40f4bf8849f5cdd3d3c49123bc911b8fa42e1 (patch) | |
| tree | e41a1cd05d17765f9e27b0844580655b2dc1ae95 /app/Env.hs | |
| parent | 45c3f81891837820aea7c3dbd45e3bae25fc4c22 (diff) | |
| download | prlg-98c40f4bf8849f5cdd3d3c49123bc911b8fa42e1.tar.gz prlg-98c40f4bf8849f5cdd3d3c49123bc911b8fa42e1.tar.bz2 | |
strings and a few other small nice changes
Diffstat (limited to 'app/Env.hs')
| -rw-r--r-- | app/Env.hs | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -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 |
