3 ms·
My trick to debugging is to simply make every nontrivial piece of code return the same output for the same input. (The trivial pieces of code too!) No other (
by mrkeen 6mo ago
My trick to debugging is to simply make every nontrivial piece of code return the same output for the same input. (The trivial pieces of code too!)
No other (mainstream) language comes close.
But what about situations where the code cannot be written in such a form (like shared memory concurrency)? I use transactions for that.
No other (mainstream) language comes close.
And that's without the low hanging fruit of no nulls, no implicit integer casts, etc.
It is absolutely true that debugging Haskell code is harder than debugging other languages. If you took away the bottom 90% of footguns, how could it not be?
- zelphirkalt 6mo agoSame output for same input is implicitly part of FP. (Not for OOP, due to mutation and side-effects.) I would think that when writing Haskell, one naturally always aims for same input same output.