summaryrefslogtreecommitdiff
path: root/src/Grasp
diff options
context:
space:
mode:
authorJed Barber <jjbarber@y7mail.com>2014-12-19 13:52:41 +1100
committerJed Barber <jjbarber@y7mail.com>2014-12-19 13:52:41 +1100
commit9cc9f189afa13e7e60d1e3adab471f2389d4aab4 (patch)
treeb88c7d97aa419fe1dc1aadc47d8f949800d1ac9b /src/Grasp
parent841b51de745008220a953669104b21898473d79b (diff)
Bugfix for graph garbage collection
Diffstat (limited to 'src/Grasp')
-rw-r--r--src/Grasp/Monad.hs4
1 files 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)