    {-# LANGUAGE CPP #-}

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

    import Debug.Trace

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

    -- | Performs trace when first argument evaluates to 'True'
    traceIf :: Bool -> String -> a -> a
    traceIf :: forall a. 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 #-}