1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
{-# LANGUAGE CPP #-}
module Distribution.Client.Utils.Assertion (expensiveAssert) where
#ifdef DEBUG_EXPENSIVE_ASSERTIONS
import Prelude (Bool)
import Control.Exception (assert)
import Distribution.Compat.Stack
#else
import Prelude (Bool, id)
#endif
-- | Like 'assert', but only enabled with -fdebug-expensive-assertions. This
-- function can be used for expensive assertions that should only be turned on
-- during testing or debugging.
#ifdef DEBUG_EXPENSIVE_ASSERTIONS
expensiveAssert :: WithCallStack (Bool -> a -> a)
expensiveAssert = assert
#else
expensiveAssert :: Bool -> a -> a
expensiveAssert _ = id
#endif
|