haskell / haskell/hoopl

Runtime error caused by fromJust in module Dataflow

Open
#32 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
77
Forks
30
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

Research direction

Open Dataflow.hs around line 274 and inspect the arfx implementation and its lookupFact call. Replace the uninformative fromJust failure with the requested explicit error path, then verify that a missing fact reports the label in the runtime error.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
compilers
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.