Learning me a Haskell for my own good

Mick Duprez
3 min readAug 31, 2017

I’ve picked up Haskell a few times in the past and I’ve always found myself understanding the overall concepts and can read and understand most code. Once you get past the basics though the learning curve can get steep real fast. Again, it’s not so much the overall concepts but it’s underlying details of how Haskell works and I think you need to know these details if you want to get the most out of it.

Anyway, I came across a book called ‘Haskell programming from first principles’ and so far it is delivering. It’s quite a tome with over 1200 pages, I’m only a quarter of the way through and have already covered a lot of ground. I’ve completed all exercises and I find I’m fully understanding what’s presented and what’s going on at a deeper level (so far :) ).

The book starts with a chapter on Lambda Calculus and teaches you how it works with some exercises at the end. This chapter alone was a great help and set the tone for the rest of the book.
The teaching style is quite good and the authors encourage you to think about how an example or exercise works and what you think the answer is then verify it yourself in the REPL. I like this approach as it encourages you to ‘tinker’ a bit and learn some things on your own.

The book is a bit of a slog due to its size, you read and read and it seems as though you are still at the start of the book! Most programming books you might work your way through in a few days but with Haskell it’s different. You need to start — as they say — from first principles and your prior knowledge of programming will only get in the way — there are no shortcuts with Haskell.

The authors deliberately eschew analogies with other programming languages and in this particular book’s case I agree, hence the size of the book. It would be hard to write a shorter book without analogies, I still think analogies are useful but use them alongside this book, not in place of it so you don’t miss the subtle points that can be very important to gain a full understanding of Haskell.
While I’ve mentioned it’s a bit of a slog, it’s not hard reading, just a lot to read :) The content is clear and I couldn’t see any real areas where it could be trimmed down.

It’s strange really, Haskell has many similarities with Lisp in how it works but I think it’s the strict typing that makes it harder to learn than Lisp. The declaration syntax is fine but the hardest thing to grok is the terminology. It’s things like type classes, type constructors, type instances, type variables, data types … you get the idea and it seems there’s more types than you could poke a stick at, all in the one line of code!
I can glaze over quickly once they start mentioning all these types in one sentence and I need to stop and take another look. Perhaps I will make a cheat sheet to refer to, it will help until it all ‘sticks’.

Anyway, if you want to learn Haskell properly you just have realise that Haskell is not the same language with a new syntax like Lisps and most imperative languages. You just have to go back to ‘school’ and stick it out, it will be worth it and I think this book will help you get there.

I’ll let you know how I get on once I finish, cheers.

--

--