4 ms·
I use a strongly typed functional language, so I don't need to write tests. If my code compiles, it's correct.
by lbarrow 14y ago
I use a strongly typed functional language, so I don't need to write tests. If my code compiles, it's correct.
- _ak 14y agoPoe's law applies here.
- tikhonj 14y agoThis is not accurate unless you use a nice dependently typed lanugage like Agda or Coq. It is true that you need far fewer tests, but hardly none at all. This is particularly evidenced by the fact that Haskell--certainly a "strongly typed functional language"--also has some of the best testing facilities of any language I've seen. QuickCheck simply can't be beat, and you can cover other parts of the code with more standard tools like HUnit. Now, there is some code--only very polymorphic code--where the type system is strong enough to give a proof of correctness. For that sort of code, which you're only likely to encounter if writing a very generic library, you can get away without testing. But that is not even the majority of all Haskell code! And even there you have to be careful of infinite loops (e.g. bottom). Comments like this make functional programmers sound much more arrogant and clueless than they really are.
- pbiggar 14y agoIf you try hard enough, you can make code that doesn't work in Haskell too!