Changed the uses of flowAlgorithm to make better use of userErrLabel to give better error messages

This commit is contained in:
Neil Brown 2008-06-05 20:22:47 +00:00
parent 24b10deb33
commit 17255bb2b1
3 changed files with 6 additions and 5 deletions

View File

@ -181,7 +181,7 @@ checkInitVar m graph startNode
,nodesToProcess = lpre graph
,nodesToReAdd = lsuc graph
,defVal = Everything
,userErrLabel = show
,userErrLabel = ("for node at: " ++) . show . fmap getNodeMeta . lab graph
}
getMeta :: Node -> Meta

View File

@ -141,7 +141,7 @@ findReachDef graph startNode
,nodesToProcess = lpre graph
,nodesToReAdd = lsuc graph
,defVal = Map.empty
,userErrLabel = show
,userErrLabel = ("for node at: " ++) . show . fmap getNodeMeta . lab graph
}
readInNode' :: Node -> Var -> a -> Bool

View File

@ -129,9 +129,10 @@ flowAlgorithm funcs nodes (startNode, startVal)
-- Pick the next node from the list and remove it:
= do let (node, workList') = Set.deleteFindMin workList
-- Process that node:
total <- foldWithEither (iterateNode vals) (Left $ show workList
++ userErrLabel
funcs node) (nodesToProcess funcs node)
total <- foldWithEither (iterateNode vals) (Left $
"Nodes still to process: " ++ show workList
++ " " ++ userErrLabel funcs node)
(nodesToProcess funcs node)
nodeVal <- Map.lookup node vals
if total /= nodeVal
-- If the value has changed, that will cascade to affect all