Skip to content

Don't use fromJust #94

Open
Open
@3noch

Description

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?

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions