Top positive review
Excellent book to get you into Haskell
14 December 2016
After a lifetime of programming in declarative languages like C, C++ and Java, I find it difficult to switch into the functional programming mindset. I suspect this is more to do with my age than anything else. I’m particularly interested in how to build systems that effectively make use of modern multi-core computers, assuming that we’ll soon have computers with hundreds of cores. In spite of what some experts say, I have grave doubts about our ability to reliably build such systems in the likes of Java; yes, there will some people who will be able to do it, but how will the common or garden developer do it?
Enter functional programming. Erlang has the ability to succeed with multi-cores, though I have my doubts about its efficiency; it’s great for network-heavy applications, but is it quite so great for compute-intensive apps? I’m not convinced yet that functional programming (Erlang excepted) has the ability *right now* to build hugely scalable multi-core apps - but I think the potential is there, and any developer putting the effort into becoming proficient at functional programming may be hugely rewarded in the future.
Given this hypothesis, how to go about it? Haskell has a reputation of being an extremely pure functional language. It also has a reputation of being very hard to learn. This is where “Real World Haskell” comes in. If you study this book right to the end, you’ll have made the mindset switch. Be warned though, it has 650 pages and is heavy going. Not because it’s badly written; on the contrary, it’s written very well. It’s because there’s a huge amount of technical stuff to put over. Recursion, folds, partial functions, lambda functions, typeclasses, and monads anyone? (Write programs using recursion in Java etc, and get used to stack overflows; not the best way to write highly stable apps).
Back in the 1990s I went through another mindset switch - from procedural thinking to object thinking. I’m finding this one harder. After studying a couple of hundred pages, and having studied Erlang previously, I began to experience the mindset switch. Unfortunately it was fragile, one minute I was thinking functionally and the next back to declarative. The real world intervened though, and I had to stop the study; so I slid back to declarative thinking. Real soon now I’m going to take another run at it. Of all the Haskell books, this is the one I’ll use. I’ve found others either too simple or too academic; for me, this book is just right.