From 9cc9f189afa13e7e60d1e3adab471f2389d4aab4 Mon Sep 17 00:00:00 2001 From: Jed Barber Date: Fri, 19 Dec 2014 13:52:41 +1100 Subject: Bugfix for graph garbage collection --- src/Grasp/Monad.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Grasp/Monad.hs b/src/Grasp/Monad.hs index bea8cd8..b94b006 100644 --- a/src/Grasp/Monad.hs +++ b/src/Grasp/Monad.hs @@ -192,7 +192,7 @@ reach :: Gr Instruction EdgeLabel -> [Node] -> [Node] -> [Node] reach _ [] f = f reach gr (x:xs) f = let f' = List.nub (x:f) - x' = List.nub (xs ++ (Graph.suc gr x)) + x' = List.nub (xs ++ (filter (/= x) (Graph.suc gr x))) gr' = Graph.delNode x gr in reach gr' x' f' @@ -296,7 +296,7 @@ nextIP :: GraspM () nextIP = do (gr, ips, fh) <- State.get let nonEmpties = filter (not . IP.isEmpty) ips - ips' = if (length nonEmpties == 0) then [] else (tail ips) ++ [head ips] + ips' = if (length nonEmpties == 0) then [] else (tail nonEmpties) ++ [head nonEmpties] gr' = garbageCollect gr ips' State.put (gr', ips', fh) -- cgit