Whether `-fignore-assertions` is applied is not visible to the user (for instance as a CPP macro)
Summary
Control.Exception.assert allows the user to do assertions in development which disappear when compiled with optimizations enabled.
However, Control.Exception.assert always throws an AssertFailed exception. There are cases in which a user might want to do other kinds of assertions: Either throwing a different kind of exception, or maybe different logic (that is not related to exceptions) all-together.
Proposed solution
A very simple and flexible way to provide the user with this ability, is to expose whether the fignore-asserts flag is enabled (either directly or by using -O1/-O2 without also specifying -fno-ignore-asserts) as the CPP macro __GLASGOW_HASKELL_ASSERTS_IGNORED__.
This particular design was chosen in collaboration with @bgamari.