Add assertions
GHC currently has a nice feature for assertions, which allow the programmer to insert a condition which is asserted to be true. If the condition is in fact false, an error is raised which contains the source code line of the assertion. A compiler flag allows all assertions to be disabled.
http://www.haskell.org/ghc/docs/latest/html/users_guide/sec-assertions.html
Possible variations:
- Have a form of 'assert' which can take an arbitrary string to which the source file location is prepended.
- assert can tie in to imprecise exceptions, if they are adopted, or a failed assertion can be bottom
- Remove the source line feature (makes the proposal simpler, but less useful because now all you get is the compiler flag to turn assertions off)
Trac metadata
| Trac field | Value |
|---|---|
| Version | |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | HaskellPrime |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |