module Debug.Trace.Helpers where

import Debug.Trace
import Control.Monad.Trans

traceTrue :: (Show a) => a -> Bool
traceTrue x = trace (show x ++ "\n\n") True


traceIt :: (Show a) => a -> a
traceIt x = trace (show x ++ "\n\n") x

traceMsg :: (Show a) => [Char] -> a -> a
traceMsg msg x = trace ( "\n\n" ++ msg ++ (show x) ++ "\n\n") x

traceReadableMsg :: (Show a) => [Char] -> a -> a
traceReadableMsg msg x = trace ( "\n\n" ++ msg ++ (show . show $ x) ++ "\n\n") x

dbgFile :: (MonadIO m) => FilePath -> String -> m ()
dbgFile f x = liftIO $ writeFile f x

traceWith :: (a -> String) -> a -> a
traceWith f v = trace (f v) v

{-# NOINLINE traceM #-}
traceM :: (Monad m) => String -> m ()
traceM s = trace s $ return ()