Runtime error caused by fromJust in module Dataflow
In line 274 of DataFlow, function arfx uses fromJust assuming that looking up a fact always produces a result. Would you please change the implementation into:
arfx arf thing fb =
case lookupFact (entryLabel thing) (joinInFacts lattice fb) of
Nothing -> error $
"Dataflow.hs: arfx => Clueless on label:"
++ (show . entryLabel) thing
Just x -> arf thing x
It was hard to spot where the error was raised. Including clues in the error message should help.
Regards
Is this check in arfx too late? Will adding an invariant check "all entry labels should have a fact" to analyzeAndRewriteFwd be better? A similar invariant check can be added to analyazeAndRewriteBwd.
I don't know where it would be best to check runtime invariants. However if an invariant doesn't hold because of a programming error, like in my case, an informative error message would help.
Regards
On 12:11, Fri, 27 May 2016 Ning Wang, [email protected] wrote:
Is this check in arfx too late? Will adding an invariant check "all entry labels should have a fact" to analyzeAndRewriteFwd be better? A similar invariant check can be added to analyazeAndRewriteBwd.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/haskell/hoopl/issues/32#issuecomment-222121116, or mute the thread https://github.com/notifications/unsubscribe/AJgbMjandrufnU2VFrVsAuyLRooYWsM5ks5qFtFcgaJpZM4Ij2Cf .