4 ms·
From my experience it is a pretty tough question to answer. You can point people to various 'smaller' aspects (like I did above regarding error handling) and tr
by w4rh4wk5 5y ago
From my experience it is a pretty tough question to answer. You can point people to various 'smaller' aspects (like I did above regarding error handling) and try to explain why Haskell's approach is 'better' compared to other languages. But doing that for a complete, real-world problem is a lot more difficult.
I've learned Haskell and used it for a relatively long time until I finally understood what is so nice about it. Again, very hard to explain, and a lot of that comes just from the combination of simple, functional language features. Like: how currying works together with function composition; how sum-types and product-types make it easy to model your domain / problem and using pattern matching to write code that is easy to understand and does the right thing; how a powerful type-system can be leveraged to rule certain bugs out almost completely, right from the design phase. Leveraging monads by using Haskell's special `do` syntax.
I only really understood this after having done imperative style programming, then having done functional style programming, and then trying to apply the functional style in an imperative environment and seeing why it does not work there (typically because of some missing language feature).
Edit: Just wanted to point out, I am not a fan of Haskell as a whole, since there are a lot of drawbacks in my opinion. There are valuable things to learn from the language, but I do think Rust is superior.
- deleted 5y ago[deleted]