diff options
Diffstat (limited to 'app/Builtins.hs')
| -rw-r--r-- | app/Builtins.hs | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/app/Builtins.hs b/app/Builtins.hs index a12da07..c63fb25 100644 --- a/app/Builtins.hs +++ b/app/Builtins.hs @@ -1,17 +1,6 @@ module Builtins where -import Code - ( Builtin(..) - , Code - , Datum(..) - , Dereferenced(..) - , Instr(..) - , InterpFn - , InterpFn - , derefHeap - , heapStruct - , newHeapVars - ) +import Code (Builtin(..), Code, Datum(..), Instr(..), InterpFn) import CodeLens import qualified Compiler as Co import Control.Exception (IOException, catch) @@ -23,6 +12,7 @@ import Data.List (intercalate) import qualified Data.Map as M import Data.Maybe (fromJust) import Env (PrlgEnv(..), findAtom, findStruct, prlgError) +import Heap (Dereferenced(..), derefHeap, heapStruct, newHeapVars) import qualified IR import Interpreter (backtrack) import Lens.Family2.State @@ -199,8 +189,8 @@ structUnify arity str = do h <- use (cur . heap) scope <- use (cur . hvar) listAtom <- findAtom "[]" + pvars <- newHeapVars arity let hcode = map U $ maybe VoidRef HeapRef . (scope M.!?) <$> [0 .. 2] - (h', pvars) = newHeapVars arity h structData = Struct IR.Id {IR.arity = arity, IR.str = str} : map HeapRef pvars paramsData = @@ -210,7 +200,6 @@ structUnify arity str = do [Atom listAtom] gcode = map U $ structData ++ [Atom str] ++ paramsData zoom cur $ do - heap .= h' gol %= (gcode ++) hed %= (hcode ++) continue |
