Comment by SoftTalker
14 hours ago
> Remember that later, just adding a simple print somewhere is not going to work without refactor (welcome to the IO monad).
This hits home for me. Print statements are essential to the way I code. I use them to debug, to examine variables and parameters, to trace execution flow. I rarely use debuggers.
For caveman debugging, if I'm not sitting in a monad, I usually reach for something like Debug.Trace. Typically that's in Idris or my own language, but I see that haskell has it too.
For my own language, I have the syntax highlighting set to put the `trace` keyword in red, so I can easily clean up.
Debug.Trace.trace and friends can help here. This can work from pure code.
But the lazy evaluation does imply that trace functions only execute when the statement is actually forced evaluation. But it is actually quite helpful during debugging..