Re:Ask HN: Why Haskell?
by SamReidHughes on Sunday March 30, 2014 @08:09PM
(#7498613)
> Short version: Most, if not all programming bugs are due to your code receiving something it did not expect. Haskell's type system helps eliminate this problem by forcing your code to declare exactly what it expects, and to handle all cases of said expectations.
No it doesn't (force). It's about as good as C++ on this front, with better error messages. What it does do is make it a lot easier to program in a style that handles all cases, but without forcing you to do so. You can pattern match on something instead of making a visitor. But you can still call head or tail.
Re:Ask HN: Why Haskell?
by coolsunglasses on Sunday March 30, 2014 @08:22PM
(#7498662)
Your comment misrepresents the reality for Haskell programmers.
Re:Ask HN: Why Haskell?
by SamReidHughes on Sunday March 30, 2014 @08:41PM
(#7498748)
If you wanted a useful reply you could explain how. The grandparent has things backwards -- it's possible for functions to force restrictions on their callers (by forcing them to pass a pure function as a parameter). The caller can't force the callee to consider all cases of its input.
Re:Ask HN: Why Haskell?
by felipehummel on Sunday March 30, 2014 @09:18PM
(#7498926)
Can you elaborate on this: "and to handle all cases..".
Look up "total functions"
In other words, it's doesn't let you skip out by not thinking about the entirety of your code. It's the same line of benefits that TDD gives you, but TDD is, IMO, a stepping stone towards the pure, functional programming that Haskell provides.
Note that I am by no means a Haskell programmer. To me, Haskell is the "last level" in learning development. I hope to one day reach such a level.