Control.Exception.assert vs HsVersions.h's ASSERT?

RodLogic dev at rodlogic.net
Tue Nov 11 19:34:02 UTC 2014


Having spent a bit of time staring at GHC's sources, I noticed that there
are around 140 modules using a set of C macros for assertions, namely:

ASSERT
> ASSERT2
> MASSERT
> MASSERT2
> ASSERTM
> ASSERTM2


However, I see that Control.Exception already provides a first class
Haskell assertion function:

assert :: Bool -> a -> a


that is turned off automatically when optimizations are turned on, and
provides an error containing the filename and line number, which was why I
thought the above macros existed and were still in use.

My question is: is there any reason to keep using these macros instead of
*assert*?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/ghc-devs/attachments/20141111/6cb4a93d/attachment-0003.html>


More information about the ghc-devs mailing list