We recently ran into an error where the GHCJS frontend would crash with the unhelpful console message Maybe.fromJust: Nothing. We grepped our entire dependency tree source and decided that ghcjs-dom was the most likely caller of fromJust since it uses it countless times. We were right.
The problem with fromJust is that it has no call stack at all. Even fromMaybe (error "fromJust: Nothing") would be much better because it would at least give us the immediate caller. We manually replaced all occurrences of fromJust in ghcjs-dom with something like fromMaybe (error ...) and immediately found the issue. It was one of the "*Unchecked" calls.
How hard would it be to change the code generator to use this pattern instead of using fromJust?
We recently ran into an error where the GHCJS frontend would crash with the unhelpful console message
Maybe.fromJust: Nothing
. We grepped our entire dependency tree source and decided thatghcjs-dom
was the most likely caller offromJust
since it uses it countless times. We were right.The problem with
fromJust
is that it has no call stack at all. EvenfromMaybe (error "fromJust: Nothing")
would be much better because it would at least give us the immediate caller. We manually replaced all occurrences offromJust
inghcjs-dom
with something likefromMaybe (error ...)
and immediately found the issue. It was one of the "*Unchecked" calls.How hard would it be to change the code generator to use this pattern instead of using
fromJust
?