As nm indicates that there is Debug.Trace , but it's easy to write something yourself. However, I highly recommend using this for debugging only and removing it for real-world code. Here is an example:
import System.IO.Unsafe output ab = seq (unsafePerformIO (print a)) b (output "test" 23) * 25 -- "test" -- 527
Here, output takes an argument to print, and the return value behaves like a const , only with a side effect. seq needed to force print to evaluate, otherwise laziness will prevent printing of anything.
source share