5 ms·
Interesting article. Types definitely make it easier to figure how things work in new codebases. I wonder how often do experienced Haskell developers find bugs
by bgorman 7y ago
Interesting article. Types definitely make it easier to figure how things work in new codebases. I wonder how often do experienced Haskell developers find bugs in production.
- tsimionescu 7y ago> I wonder how often do experienced Haskell developers find bugs in production If by this you mean that you are wondering how often bugs in Haskell programs make it to production, the answer seems to be "at about the same rate as bugs in C or Java, as far as we can tell". Which, given that Haskell's (default) type system is not much more powerful at expressing constraints than C or Java's, shouldn't be a big surprise. Haskell's type system is much more flexible, allowing you to express specific types for many cases where in Java or C you would have to resort to Object or void*; but otherwise, Haskell types can not encode much more powerful constraints than C or Java types - you can only express the available operations and the "shape". The bulk of the power comes from enforcing purity, but that is essentially a property of the standard library, not of the type system. For example, you can't express that a type is a Monad in Haskell - you can specify that it supports the Monad operations, but you have to rely on manual checking to see if it respects all of the monad laws. Note that Idris or Coq are another matter entirely (as are dependent type systems implemented in Haskell extensions).
- sweeneyrod 7y ago> If by this you mean that you are wondering how often bugs in Haskell programs make it to production, the answer seems to be "at about the same rate as bugs in C or Java, as far as we can tell". That seems surprising. What are the bugs that Haskell has but C and Java don't that replace all the null pointer exceptions?
- danielscrubs 7y agoI had a horrible problem with space leaks when running weeks in production, didn't help that I used a pure Haskell db at the time. :) Here are some more info http://blog.ezyang.com/2011/05/space-leak-zoo/ http://blog.ezyang.com/2011/05/space-leak-zoo/ It's been almost a decade since though. Maybe the compiler catches more nowadays.
- tsimionescu 7y agoI have no idea, but here is some speculation: - perhaps Haskell programs end up being more feature-ful within a given bug budget - perhaps Haskell induces more logic bugs, because it is more alien to the regular way of thinking - perhaps the vast majority of NPEs are actually logic bugs, so that preventing them through the type system does not actually significantly reduce the number of bugs - perhaps the study had some flaws in how it was counting issues - perhaps some or all of the above are true, in various proportions
- naasking 7y ago> If by this you mean that you are wondering how often bugs in Haskell programs make it to production, the answer seems to be "at about the same rate as bugs in C or Java, as far as we can tell". I think this is worded deceptively. Bug counts are about the same when measured as bugs per line of code. A line of code in Haskell can do quite a bit more than a line of code in C or Java. I think that's a meaningful difference.
- nilkn 7y agoWhat is any of this based on? I could just as well say that the Haskell software we have in production has essentially never had a bug over 3+ years of runtime, despite being a complex, high-performance, heavily multithreaded service. But I wouldn't expect you to take that as a universal accounting of the language's relative strengths and weaknesses.
- tsimionescu 7y agoIt's based on this study, and a few other I don't have on hand: https://m-cacm.acm.org/magazines/2017/10/221326-a-large-scale-study-of-programming-languages-and-code-quality-in-github/abstract https://m-cacm.acm.org/magazines/2017/10/221326-a-large-scal... They find some effect of language on defects, but it is small, and there are other factors with much larger impact.