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

Constant assertions #111

Open
sorki opened this issue Aug 24, 2017 · 0 comments
Open

Constant assertions #111

sorki opened this issue Aug 24, 2017 · 0 comments

Comments

@sorki
Copy link
Contributor

sorki commented Aug 24, 2017

I'm trying to figure out how to create always firing assertions as assert false seems to be disallowed by opts.

I sometimes tend to write code like this:

when cond $ do
  comment "this is pretty bad"
  assert $ not cond

See for example GaloisInc/ivory-tower-stm32@aafc0ca#diff-1651b43e296daea4ab0ba777cb26b769R90

I guess I would prefer to be able to express this as something like fail

when cond $ do
  fail "how did we get here"

assuming this is taking care of some rare condition like improper hardware configuration.

Looks like this would need another primitive along with assert.

Any thoughts?

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