summaryrefslogtreecommitdiff
path: root/app/Interpreter.hs
diff options
context:
space:
mode:
authorMirek Kratochvil <exa.exa@gmail.com>2023-02-26 21:43:25 +0100
committerMirek Kratochvil <exa.exa@gmail.com>2023-02-26 21:43:25 +0100
commit0092723895da4136a68f71f34a816b33586d9ccb (patch)
treef2ddf1c40dda994ac645ce848f32ae3e02529445 /app/Interpreter.hs
parent0d52bcf663ead766ae83c8f30f90beaea5790789 (diff)
downloadprlg-0092723895da4136a68f71f34a816b33586d9ccb.tar.gz
prlg-0092723895da4136a68f71f34a816b33586d9ccb.tar.bz2
microlens and an ugly parse of ,(something,something)
btw we triggered a ghc bug here with iscallTok in parser. Apparently it kills `call` for whichever reason. New ghc solved it.
Diffstat (limited to 'app/Interpreter.hs')
-rw-r--r--app/Interpreter.hs8
1 files changed, 4 insertions, 4 deletions
diff --git a/app/Interpreter.hs b/app/Interpreter.hs
index 8531a27..0107bf5 100644
--- a/app/Interpreter.hs
+++ b/app/Interpreter.hs
@@ -19,8 +19,8 @@ import qualified Data.Map as M
import Env (PrlgEnv)
import Heap
import IR (Id(..), StrTable(..))
-import Lens.Family2
-import Lens.Family2.State
+import Lens.Micro
+import Lens.Micro.Mtl
prove :: Code -> PrlgEnv (Either String Bool)
prove g = do
@@ -140,7 +140,7 @@ cutGoal = doCut >> advance
openGoal :: IR.Id -> InterpFn
openGoal fn = do
- def <- defs `uses` (M.!? fn)
+ def <- (M.!? fn) <$> use defs
case def of
Just hs@(_:_) -> do
advance
@@ -293,7 +293,7 @@ unify _ _ = backtrack
{- unification reference-handling tools -}
findLocalRef :: Lens' Cho (M.Map Int Int) -> Int -> PrlgEnv Int
findLocalRef store lr = do
- a' <- (cur . store) `uses` (M.!? lr)
+ a' <- (M.!? lr) <$> use (cur . store)
case a' of
Nothing -> do
a <- newHeapVar