One year with “Haskell Programming from First Principles”

01 Jan

My relationship with the Haskell programming language, my efforts to learn it had its ups and downs throughout the years. According to my memory and the archives of my blog, my first attempts had been around 2005 – 2006, more than 12 years ago. Back then, apart from a few books written by university professors, and some Wiki-based books, I couldn’t find much high quality material for beginners. Therefore, my efforts didn’t last very long. A few years later, I heard the news about a new book, “Real World Haskell” being written. I was excited once again, I even made a few comments here and there as the book was being written. Unfortunately, life happened, and I couldn’t spend much time on that nice book, too. Fast forward to the end of 2015, and I was working at a company in Ghent, Belgium where there were some Haskell experts, trying out things in an industrial storage system development environment. The teams that I was part of had nothing to do with Haskell though, my daily job was almost always about Python, Bash, ActionScript, Java, and some Scala. Nevertheless, being in such an environment rekindled my curiosity, and I decided to look around to see if there was some new Haskell books targeted at people who didn’t use this language before. Luckily, I’ve heard about the book “Haskell Programming from First Principles“, and I decided to give it a try. Therefore I bought the book, and started to read and study it in the beginning of 2016. Since Haskell was not at all used in my daily job, I could study the book only in my spare time, therefore it took me about 1 year to finish the book, doing most of the exercises.

It is not easy to review such a book, and I won’t I claim to do justice to such a massive tome. Instead of trying to motivate the curious reader, I’ll briefly write about my background, motivation, and what led me to this book. If you have a similar background and motivation, you can draw your own conclusions. First a bit of background: Before tackling this book seriously, I’ve spent my professional life in various software-intensive systems, but I’ve never used Haskell or many of other strongly, statically typed functional programming languages such as O’Caml, F#, or SML in an industrial, practical setting working within big teams. The only exception to the previous sentence is Scala programming language which I’ve studied and used briefly in some very small projects, mostly for small tasks as part of bigger commercial projects. In other words, I’ve spent most of my programming life using languages such as C, VBA, SQL, PL/SQL, T-SQL, VBScript, JavaScript, PHP, Python, ActionScript, C#, Java, and Bash.

Apart from my professional and commercial use of programming languages, I’ve had my fair share of Common Lisp and some Emacs Lisp for a few years in an academic setting. I’ve also dabbled a little in Prolog and Erlang, as well as played with various constraint satisfaction paradigms using Mozart/Oz programming environment. As for my academic education background, I had a lot of math courses, including abstract algebra, topology, etc., therefore I knew what von Neumann meant when he said “In mathematics you don’t understand things. You just get used to them.”. In other words, technical terms such as isomorphism, homomorphism, groups, algebras wouldn’t scare me away, and I always liked a proof on a good day, as long as it was also backed by some examples.

With that background, I wanted to spend time to learn what it really means and feels like to use purely functional programming language that is a testbed of state-of-the-art programming language research, as well as a strong tool used in different commercial and open source projects. I also wanted to have some kind of intellectual stimulation after having used mostly imperative and object oriented languages for so many years, languages that seemed different but the same. Another motivation was a nice book titled “Functional Programming in Scala“: I’ve started to study the book, and even attended some meet-ups that were workshops led by highly qualified professors of functional programming, but somehow I had the feeling that since many of the ideas originated in Haskell, and since there was no tension of trying to combine object orientation with functional programming, as well as being constrained by JVM, Haskell would be a better choice than Scala for studying the core concepts and their applications. I think, by now, it is obvious that I had no commercial, professional motivation for learning Haskell 🙂 After all, I knew only 3 companies that were using Haskell to an extent in Belgium (one of them was a 1-person start-up).

Having laid down my background and detailed my motivation, I started to practically test myself to see if an old dog like me could learn new tricks; after all I was 40 years old when I started to practice. What about the result you might ask? Frankly, the journey had not been easy at all, but it’s been a lot of fun. I was amazed at the technical and pedagogical effort that the authors of “Haskell Programming from First Principles” spent. I found the pacing of the book, the development of material, and how previous chapters motivated the later chapters to be very well thought out. The book is very exercise-driven and it was a very good thing for a self learner like me. But this doesn’t mean I had it easy, on the contrary, some of the exercises were pretty mind-bending; I could feel my neurons fire! The nice thing is that most of the exercises are self-contained and carefully crafted to enhance your understanding. While some of the exercises seemed a bit repetitive, it was not difficult to see that this was done deliberately, by taking into account established learning theories.

If this book only went on to teach the core concepts of purely functional programming in Haskell, it would be easy to compare it with some good books written by university professors, targeted at young university students. But this book went beyond that, trying to show how Haskell is used in industrial settings, how Haskell used in-the-wild. I found this to be another very strong point: knowing the precise, rigorous, mathematical principles is very good and I like it a lot, but if you are out in the world, using Haskell to solve some business problems for some clients, working with teams of Haskell programmers, you’ll also definitely want to know how test your Haskell programs, how to document them, how to start a project from scratch, how to use an established build tool, how to optimize your programs, how to profile them, how to interpret what’s going on behind-the-scenes. “Real World Haskell” would be a good candidate but it’s been more than 8 years it’s been published and new things happened in Haskell, both from a language perspective, as well as the tooling perspective, and “Haskell Programming from First Principles” is the strongest candidate to teach the reader how practical, daily Haskell work is done.

Now that I finished the book, does that make me a Haskell programmer, or a functional programmer? Yes, and no. Compared to my understanding of Haskell and functional programming at the end of 2015, I have a much better understanding, thanks to the numerous exercises in the book. For example I can follow the discussions at Leuven Haskell Meet-ups more easily, same goes for /r/haskell. But of course this book, as well as the very good selection of end-notes of each chapter made me realize how wide and deep the world of functional programming is. There are still many topics and discussions that are way over my head, yet I’m eager to learn more and more. Apart from that, programming is a practical business after all, and I haven’t built anything substantial in Haskell, I haven’t worked with Haskell programmers in an open source project, so I’m still missing a lot of things in the department of practical experience. Maybe 2017 will be the year to put Haskell into concrete use for me, who knows.

As for some negative criticism / missing parts, I can say that even though I saw numerous examples of how strong, static typing, coupled with type inference helped me solve problems in the book in many interesting ways, even though I started to realize how GHC and GHCi sort of had a conversation with me, trying to direct me towards correct constructions of programs (e.g. using Typed Holes, or helpers such as Djinn), I think the book could help the reader more on how to do type-driven design of programs. Because, even though type systems are generally advertised as preventing a whole class of bugs, making program construction and maintenance easier, I think going beyond that, and acquiring the skills of type-driven development is also very exciting, but unfortunately very high-quality tutorials are still missing (feel free to prove me wrong! ;).

In short, until something much better comes, I can sincerely recommend “Haskell Programming from First Principles” to the working programmers who are serious about learning Haskell. It will not be easy but you’ll be rewarded with a solid understanding of many modern principles of Haskell and functional programming, as well as how these are applied to different practical projects.

For the curious reader, you can view my Haskell questions that I asked while studying the book at[haskell].

This blog entry is dedicated to my beloved wife and son, because without their unconditional support, and the sacrifices they had to endure, it would definitely take much longer than one year to finish this massive book.



7 responses to “One year with “Haskell Programming from First Principles”

  1. mer

    January 2, 2017 at 20:47

    Thanks for the review, I’m glad to hear people are able to finish such a behemoth of a book. I’ve just started the book (after starting the fp in scala book as well) and at times it seems overwhelming with no end in sight. Perhaps in a year I can review it as well.

    As a side note, I think the upcoming Type-Driven Development with Idris by Edwin Brady should hit the spot when it comes to tdd 🙂

  2. Emre Sevinç

    January 3, 2017 at 11:47


    Thanks for your comment. I’m looking forward to your review. Also, Type-Driven Development with Idris is on my reading list.

  3. Madderote

    August 24, 2017 at 06:43

    Great review. Been looking into this book after ‘Learn you a Haskell’ and ‘Real world Haskell’. Now really motivated to push through and learn it, since in my opinion Haskell could hold the future in programming. I know very little people involved in Haskell, can you perhaps point me to some user groups or users that are willing to share some knowledge in case I really get stuck, since although my background is in programming, it is so much more limited than yours. Thanks!!

  4. Mohamed Elsharnouby

    March 20, 2018 at 15:31

    I’m glad to stumble upon this article while searching for more materials to learn Haskell after “Learn you a Haskell”. I wanted to ask though if you have read through Real World Haskell, how do the two books compare in terms of practicality. If I want to go up to speed on developing real applications in Haskell, should I better go with this book or Real World Haskell. I’d love to hear your opinion if you have had time to take a look at Real World Haskell.
    Also, I’ve lived in Istanbul for 2 years and I’m planning to go back sometime in the future, I’d like to know if there’s a community of Haskell in Istanbul or if there are any companies using Haskell around there, I’d appreciate it. Thanks

    • Emre Sevinç

      April 4, 2018 at 10:18

      Hello Mohamed,

      I tried to follow Real World Haskell as it was being written (even gave feedback and comment on a thing or two), but I don’t consider it very useful nowadays; a lot of things happened in the last 10 years! I’d say “Haskell Programming from First Principles“ is one of the best resources to get a strong foundation (together with “Programming in Haskell”, 2nd Edition by Graham Hutton). For “real world practical projects” type of information, I don’t know a good, up-to-date book. Let me know if you find one!

      I don’t know of any Haskell community in Istanbul, but why don’t you contact people from Picus Security from Ankara? As far as I know, there are some strong Haskell developers (some of them also experienced Common Lisp programmers) there, working on commercial offerings, check these out:

  5. Keith

    April 27, 2018 at 13:07

    Great review. I have been working on this book for few weeks and gained a lot of inspiration and excitation. It is joyful to work through this book. However, I wonder what will be next step after I finish this book in next few weeks. Is there any book after this one, I mean that would be a little more advanced and deeper to level me up.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: