Drop in replacement for GHC's assert
feature.
How to use:
- Use
assert
in your code. - Turn on assertion checking by calling GHC with
-fplugin=With.Assertions
(otherwiseassert
doesn't have any effect the generated code)
GHC's native assert
only supports boolean assertions. So assert failures are not very informative. I wanted richer assertions, which could build up an assertion failure message (such as Validation
in the validity
package, which are supported out of the box by the assert plugin).