Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't use fromJust #94

Open
3noch opened this issue Feb 7, 2020 · 0 comments
Open

Don't use fromJust #94

3noch opened this issue Feb 7, 2020 · 0 comments

Comments

@3noch
Copy link

3noch commented Feb 7, 2020

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant