Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I'm familiar with the argument that strict typing catches bugs, but some bugs are trivial and a few are very tricky. Based on my experience with languages besides Haskell (which I don't know), I suspect that the kinds of bugs computers catch automatically aren't likely to be bad ones. The bad ones are runtime errors and logic errors, and I guess there are two kinds of these: ones that come from sloppy coding, and ones where you made an error in thinking. The type-checker might help with the sloppy ones. But I think the best language defense against those is to be concise and readable, so the logic is easy to see and you don't lose the forest for the trees.


The bad ones are runtime errors and logic errors

That's just the thing: Haskell's type system catches many, many bugs that would be runtime errors in most other languages. It can even provide static guarantees against extremely tricky bugs such as race conditions!

sloppy coding

Everybody is guilty of sloppy coding some of the time. Having a powerful sanity check against it is extremely helpful.

ones where you made an error in thinking

Haskell can actually help here, too. Its rigid purity forces you to think more carefully before you act and its powerful expressiveness enables you to build highly composable abstractions that are simply not possible in other languages.

Edit: Check out this talk on someone's personal experience with static typing in real projects at work:

http://vimeo.com/72870631


I very rarely have much trouble finding bugs that I made myself. The hardest bugs are the ones somebody else had a hand in. I'm sure everyone wishes they could force their coworkers to be more careful. :)


You might be surprised to see the degree with which you can assert behaviour using typing in haskell. Given the strict environment it presents.

Types in Haskell are used not just to represent data, but represent data as it is transformed and processed.

So often a type error in haskell represents an error in thinking, rather than an error in typing. This is one aspect of the language I really like.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: