We use Haskell's built-in assert functionality, which is toggled at compile time with optimization level and/or -f(no-)ignore-assert
We have a compile-time package flag which triggers expensive asserts or not
Problems with the current approach:
You have to do some unnatural work to extend the built-in asserts with more useful information, because GHC doesn't make available a boolean "you compiled with asserts enabled". The "usual" way of doing it is to catch the thrown AssertionError and then rewrite it with extra information, but this is awfully indirect
Proposed alternate approach:
We add a specific new flag to Cabal, cabal-install specifically for enabling asserts
We build our own infrastructure using CallStack to throw assert failures
Current status:
assert
functionality, which is toggled at compile time with optimization level and/or-f(no-)ignore-assert
Problems with the current approach:
Proposed alternate approach: