3 ms·
Haskell's biggest win is the power of its type system, including its ways of getting types places other languages simply can't. In C and Python, "a statement"
by dllthomas 13y ago
Haskell's biggest win is the power of its type system, including its ways of getting types places other languages simply can't.
In C and Python, "a statement" is a different kind of thing than "an expression". Statements don't "have types" - the expression that makes it up may, but the value winds up discarded and the type doesn't matter (except maybe to produce a "unhandled value" warning, if you've set things up for that).
In Haskell, statements are just another kind of expression, and the types of those expressions determine how they get chained together. This means I can leverage the type system to help me avoid new kinds of errors - want to be sure you don't try to do I/O in an STM transaction? Or access that variable from the wrong thread? Or... In Haskell, that's straightforward. In C, that's not something you can express and you have to check it all by hand.