diff --git a/app/Interpreter.hs b/app/Interpreter.hs index bb47144..774c13d 100644 --- a/app/Interpreter.hs +++ b/app/Interpreter.hs @@ -129,6 +129,16 @@ proveStep = St.get >>= go unify (HeapRef _) VoidRef = uok unify VoidRef (HeapRef _) = uok {- actual HeapRefs, these are dereferenced and then unified (sometimes with copying) -} + unify (HeapRef hr) (HeapRef gr) + | BoundRef ha _ <- deref hr + , BoundRef ga _ <- deref gr + , ha == ga = uok + | FreeRef ha <- deref hr + , BoundRef ga _ <- deref gr = setHeap ha (HeapRef ga) + | BoundRef ha _ <- deref hr + , FreeRef ga <- deref gr = setHeap ga (HeapRef ha) + | FreeRef ha <- deref hr + , FreeRef ga <- deref gr = setHeap ha (HeapRef ga) unify (HeapRef hr') g = case deref hr' of FreeRef hr ->