withCString msg $ \cmsg ->
debugBelch cfmt cmsg
-foreign import ccall unsafe debugBelch :: CString -> CString -> IO ()
+foreign import ccall unsafe "RtsMessages.h debugBelch"
+ debugBelch :: CString -> CString -> IO ()
#endif
{-# NOINLINE trace #-}
trace string expr = unsafePerformIO $ do
putTraceMsg string
return expr
+
+{-|
+Like 'trace', but uses 'show' on the argument to convert it to a 'String'.
+
+> traceShow = trace . show
+-}
+traceShow :: (Show a) => a -> b -> b
+traceShow = trace . show