File: Assertion.hs

package info (click to toggle)
haskell-cabal-install-solver 3.10.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 496 kB
  • sloc: haskell: 4,780; makefile: 3
file content (22 lines) | stat: -rw-r--r-- 620 bytes parent folder | download | duplicates (7)
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