From 330266e6823ad2af806c090f2c7f582c77d1d80c Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Sat, 2 Feb 2008 17:24:02 +0000 Subject: [PATCH] Fixed the code for detecting if there was the same replicator at the beginning of a PAR group --- checks/UsageCheckAlgorithms.hs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/checks/UsageCheckAlgorithms.hs b/checks/UsageCheckAlgorithms.hs index df4b342..3ad4204 100644 --- a/checks/UsageCheckAlgorithms.hs +++ b/checks/UsageCheckAlgorithms.hs @@ -49,10 +49,13 @@ checkPar getRep f g = mapM f =<< allParItems m (Map.Map Int (Maybe A.Replicator, [(Node,Node)])) helper mp (s,e,n) | r == Nothing = fail "Could not find label for node" - | join r /= join (liftM fst $ Map.lookup n mp) = fail "Replicator not the same for all nodes at beginning of PAR" - | otherwise = return $ Map.insertWith add n (join r,[(s,e)]) mp + | prevR == Nothing || prevR == r = return $ Map.insertWith add n (join r,[(s,e)]) mp + | otherwise = fail $ "Replicator not the same for all nodes at beginning of PAR: " + ++ show r ++ " ; " ++ show (Map.lookup n mp :: Maybe (Maybe A.Replicator, [(Node, Node)])) where add (newR, newNS) (oldR, oldNS) = (newR, oldNS ++ newNS) + prevR :: Maybe (Maybe A.Replicator) + prevR = liftM fst $ Map.lookup n mp r :: Maybe (Maybe A.Replicator) r = lab g s >>* (getRep . (\(Node (_,l,_)) -> l))