3 ms·
> 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 proble
by SamReidHughes 13y ago
> 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.
- coolsunglasses 13y agoYour comment misrepresents the reality for Haskell programmers.
- SamReidHughes 13y agoIf 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.