{-# LANGUAGE CPP #-}

module Control.Effect.Internal.Debug where

import Control.Exception (assert)

#ifdef EFF_DEBUG
import GHC.Stack (HasCallStack)
#else
import Data.Kind (Constraint)
#endif

debugEnabled :: Bool
#ifdef EFF_DEBUG
debugEnabled = True
#else
debugEnabled :: Bool
debugEnabled = Bool
False
#endif
{-# INLINE debugEnabled #-}

#ifdef EFF_DEBUG
type DebugCallStack = HasCallStack
#else
type DebugCallStack = () :: Constraint
#endif

assertM :: (DebugCallStack, Applicative m) => Bool -> m ()
assertM :: Bool -> m ()
assertM Bool
b = Bool -> m () -> m ()
forall a. (?callStack::CallStack) => Bool -> a -> a
assert Bool
b (m () -> m ()) -> m () -> m ()
forall a b. (a -> b) -> a -> b
$ () -> m ()
forall (f :: * -> *) a. Applicative f => a -> f a
pure ()
{-# INLINE assertM #-}