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

Better implementation for invalid? #176

Open
istathar opened this issue Mar 3, 2023 · 0 comments
Open

Better implementation for invalid? #176

istathar opened this issue Mar 3, 2023 · 0 comments
Labels
bug Something isn't working core-program Issues involving the Program type and command-line options & argument parsing

Comments

@istathar
Copy link
Member

istathar commented Mar 3, 2023

A long while ago we added invalid in Core.Program to make it clear when you'd hit an illegal state (when in monadic context).

{- |
Illegal internal state resulting from what should be unreachable code or
otherwise a programmer error.
-}
invalid :: Program τ α
invalid = error "Invalid State"
is the current implementation

I bet that could be done better.

At the very least an HasCallStack => constraint might be good, but is there something better than using error here? MonadFail fail?

@istathar istathar added bug Something isn't working core-program Issues involving the Program type and command-line options & argument parsing labels Mar 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working core-program Issues involving the Program type and command-line options & argument parsing
Projects
None yet
Development

No branches or pull requests

1 participant