summaryrefslogtreecommitdiff
path: root/src/Grasp
diff options
context:
space:
mode:
authorJed Barber <jjbarber@y7mail.com>2014-12-18 10:35:34 +1100
committerJed Barber <jjbarber@y7mail.com>2014-12-18 10:35:34 +1100
commit347eebc55a1de42429b38b67c355a48a358ead63 (patch)
tree811853f4df0029591ae81ffd3e0762edaf6e9d10 /src/Grasp
parent73c926bed24e4dabe8efc3acc9b2a892c680bacd (diff)
nextIP will now filter out all empty IPs
Diffstat (limited to 'src/Grasp')
-rw-r--r--src/Grasp/Monad.hs7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/Grasp/Monad.hs b/src/Grasp/Monad.hs
index 3a3bd4f..bea8cd8 100644
--- a/src/Grasp/Monad.hs
+++ b/src/Grasp/Monad.hs
@@ -295,11 +295,8 @@ peekIP = do
nextIP :: GraspM ()
nextIP = do
(gr, ips, fh) <- State.get
- let ips' = if (length ips == 0)
- then []
- else if (IP.isEmpty (head ips))
- then tail ips
- else (tail ips) ++ [head ips]
+ let nonEmpties = filter (not . IP.isEmpty) ips
+ ips' = if (length nonEmpties == 0) then [] else (tail ips) ++ [head ips]
gr' = garbageCollect gr ips'
State.put (gr', ips', fh)