News for hackers. Stuff that matters.
Re:Code is Engineering; Types are Science by tsimionescu on Monday April 06, 2020 @04:53AM (#22791932)
> 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).

Re:Code is Engineering; Types are Science by naasking on Monday April 06, 2020 @09:16AM (#22793423)
> 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.

Re:Code is Engineering; Types are Science by nilkn on Monday April 06, 2020 @12:44PM (#22795242)
What 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.
Re:Code is Engineering; Types are Science by tsimionescu on Tuesday April 07, 2020 @10:52AM (#22803730)
It'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-scal...

They find some effect of language on defects, but it is small, and there are other factors with much larger impact.

Re:Code is Engineering; Types are Science by sweeneyrod on Monday April 06, 2020 @08:17AM (#22793035)
> 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?

Re:Code is Engineering; Types are Science by danielscrubs on Monday April 06, 2020 @09:05AM (#22793339)
I 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/

It's been almost a decade since though. Maybe the compiler catches more nowadays.

Re:Code is Engineering; Types are Science by tsimionescu on Monday April 06, 2020 @12:43PM (#22795231)
I 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