-
Until some enterprising PhD student comes along and takes a whack at this problem, I debug my programs by: a) using pure functions whenever possible—I am bad at keeping track of imperative execution in my head, and as such pure functions help me avoid the associated mistakes, and what mistakes I do make are more apparent visually; b) using hedgehog or QuickCheck aggressively, so as to verify that the assumptions I’m making are correct; c) when writing imperative/effectful computation, building in logging from the get-go—I am a fused-effects user, so I use the built-in Trace effect as well as fused-effects-profile to yield information about what’s actually being executed.
-
CodeRabbit
CodeRabbit: AI Code Reviews for Developers. Revolutionize your code reviews with AI. CodeRabbit offers PR summaries, code walkthroughs, 1-click suggestions, and AST-based analysis. Boost productivity and code quality across all major languages with each PR.
-
Try to restrict your types even on sub functions (inside where), use testing, break down your code to the most atomic parts, using ghci to debug each part once at a time, and because Haskell doesn't let you reuse variables, or mutate state, it's a lot easier to rationalize evaluation order (which makes it a lot easier to debug without step debuggers compared to languages like python).
-
I can easily debug any Haskell program with the external STG interpreter. https://www.youtube.com/watch?v=DkDUEd3pUyM https://github.com/grin-compiler/ghc-whole-program-compiler-project