3 ms·
"print/log" based debugging in Haskell is harder and thus there is more pressure to solve the debugging needs with a proper debugger. I rarely feel the need fo
by ithkuil 7y ago
"print/log" based debugging in Haskell is harder and thus there is more pressure to solve the debugging needs with a proper debugger.
I rarely feel the need for a debugger in Go and other procedural languages because I often find it easier to just patch the code with some ad-hoc debugging logic that lets me understand what's going on. I find that usually easier to do rather than figure out how to attach a debugger in the right environment where the issue can be reproduced.
- weavie 7y agoPrint based debugging isnt necessarily harder in Haskell: https://www.stackage.org/haddock/lts-14.21/base-4.12.0.0/Debug-Trace.html#v:trace https://www.stackage.org/haddock/lts-14.21/base-4.12.0.0/Deb...
- jerf 7y agoThe laziness can make it a bit of a challenge to follow, though. I know trace itself is strict, but that thunk will still be lazy from the environment around it. Debugging has the same problem too, actually. "Step next" is much more challenging to know what is actually going to be "next" than in other languages. On the plus side (no sarcasm), it's a great way to get a feel for what the laziness really does. I recommend stepping through some non-trivial code of your own with the debugger for any intermediate Haskell programmer, even if it's working perfectly, because it'll actually show you the lazy evaluation order as it happens.
- whateveracct 7y agoOh the debugger in Haskell is not used that often. Usually people debug their logic in a repl session. Print debugging is a little weird in pure code, but it's useful and the same as any other language in any code that does IO.