{-# LANGUAGE CPP #-}

module Clash.Debug
  ( debugIsOn
  , traceIf
  , module Debug.Trace
  ) where

import Debug.Trace

debugIsOn :: Bool
#if defined(DEBUG)
debugIsOn :: Bool
debugIsOn = Bool
True
#else
debugIsOn = False
#endif

-- | Performs trace when first argument evaluates to 'True'
traceIf :: Bool -> String -> a -> a
traceIf :: Bool -> String -> a -> a
traceIf Bool
True  String
msg = String -> a -> a
forall a. String -> a -> a
trace String
msg
traceIf Bool
False String
_   = a -> a
forall a. a -> a
id
{-# INLINE traceIf #-}