by biohacker42 · 17y ago · 0 comments
If you actually want to do something you still have to have side effects, and that's when all that Haskell-ish beauty goes out the window.
It is still absolutely worth it to learn functional programming, it will change the way you think, it will make a better programmer in non functional languages, but it won't solve the problems of side effects.
http://journal.dedasys.com/2007/12/12/programming-languages-...
Most programmers, realistically, don't use that many languages at any given time, and if they could use fewer, they probably would. The more territory a language covers, the better off it is... well, at least as long as it can do so relatively well.
let tree = Node (Node (Leaf 3) (Leaf 4)) (Node (Leaf 7) (Leaf 8))
This value is constant, just like an integer or string constant in many languages. In other words, the right-hand side can be arbitrarily complex. And this data structure gets passed around in a very lightweight manner (by reference, not by copying).
The Java notion that values are either primitive, or objects... is limiting.
In my (limited) experience, Haskell code to do I/O (i.e., Monads) isn't a pretty or elegant as purely functional Haskell code. A lot of Haskell's useful tricks (i.e., its beauty like the ridiculously strong type system or lazy evaluation) don't work on code with side effects.