Jump to ratings and reviews
Rate this book

Haskell Programming From First Principles

Rate this book
I am writing this book because I had a hard time learning Haskell.
It doesn't have to be that way. I've spent the last couple years actively teaching Haskell online and in person. Along the way, I started keeping notes on exercises and methods of teaching specific concepts and techniques in Haskell that eventually turned into my guide for learning haskell. That experience led me to work on this book.

If you are new to programming entirely, Haskell is a great first language. You may have noticed the trend of "Functional Programming in [Imperative Language]" books and tutorials and learning Haskell gets right to the heart of what functional programming is. Languages such as Java are gradually adopting functional concepts, but most such languages were not designed to be functional languages, after all. We would not encourage you to learn Haskell as an only language, but because Haskell is a pure functional language, it is a fertile environment for mastering functional programming techniques. That way of thinking and problem solving is useful, no matter what other languages you might know or learn.

Haskell is not a difficult language to use. Quite the opposite. I'm now able to tackle problems that I couldn't have tackled when I was primarily a Clojure, Common Lisp, or Python user. Haskell is difficult to teach effectively.

1189 pages, ebook

First published January 1, 2015

Loading interface...
Loading interface...

About the author

Christopher Allen

1 book23 followers

Ratings & Reviews

What do you think?
Rate this book

Friends & Following

Create a free account to discover what your friends think of this book!

Community Reviews

5 stars
128 (49%)
4 stars
93 (36%)
3 stars
25 (9%)
2 stars
6 (2%)
1 star
5 (1%)
Displaying 1 - 30 of 39 reviews
Profile Image for Emre Sevinç.
143 reviews269 followers
January 2, 2017
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, VBScript, VBA, SQL, PL/SQL, T-SQL, PHP, Python, ActionScript, C#, Java, ActionScript 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.

The rest of my review is at https://ileriseviye.wordpress.com/2017/01/01/one-year-with-haskell-programming-from-first-principles/ (due to Goodreads characteer limits).
Profile Image for Gerald.
22 reviews1 follower
Shelved as 'hold'
February 21, 2017
I'm not finished working through this book yet, but it really is phenomenal. The authors fuse theory and practicality in a way I don't think I've seen done so effectively in any other instructional text. A lot of the beauty of this book comes from Haskell itself, syntax reflects conceptual structure, complex ideas follow naturally from simpler ideas, thoughtful approaches make intricate problems much more linear, etc. The thing is, that other educational Haskell texts manage to complicate and confuse despite the fact that Haskell is so well designed to be taught, because they don't look to the language for guidance on how it should be taught, whereas the authors here really try to do exactly what the title says, teach from first principles. When done this way, learning Haskell is constantly challenging, but never frustrating, and often really beautiful.
Profile Image for Evgeny Dudin.
1 review1 follower
December 30, 2016
Although it covers Haskell and FP in good detail, reading almost every chapter feels quite unsatisfying. The author deliberately does not go into depth or explanation of certain concepts, not showing where the bottom of those concepts are and leaves it for later... Which they scratch the surface of next time.. and then next time... and so on. It constantly makes me feel like I still don't have the full picture. FP is a complicated topic indeed, but reading this book feels like you're being spoon-fed a bit too much. Some trivial things are explained to every single detail, whereas some more complicated ones are sometimes explained with very little detail. Exercises can be fairly trivial and repetitive. Even though I am being critical here, I realise the authors have their own style and I still enjoyed reading it.
Profile Image for Bernie Noel.
20 reviews8 followers
October 31, 2019
Reading this book was a slight deception, not because of the content, but mailny because it's a bit messy. The chapters don't correlate with each otehr very well and the content is not as well organized as I was expecting. Aside from that, I believe I learned something new.
9 reviews
April 6, 2020
I'll admit I did not quite finish this book; I lost steam and patience somewhere within Monad Transformers, and never really found the desire to come back again. I had previously read Learn You A Haskell for Great Good, which I imagine is the background a fair portion of people have. Learn you a Haskell, for its concise, joke-laden exposition, did have some shortcomings (which, given it is free, I can't grumble about all that much). I hoped this book would fix those, and it mostly does.

Unfortunately it brings in some new ones in the process.

For one, it trades that conciseness for verbosity, which is not necessarily a bad thing - longer explanations from multiple angles can be useful when trying to understand abstract concepts. In this case, however, I think it goes too far in the opposite direction - this book really needs an editor to go through and cull some of that excess. I firmly believe this book could be half the size without sacrificing much at all.

The other issue it attempts to correct from LYAH is having exercises. The issue with these (and often with the exposition as well) is they focus solely on the concept being presented, eschewing everything else ("meaningless" type/variable names, writing more than the tiniest snippets of code), such that the exercises can become extremely monotonous, and give little or no idea of "real" usage (i.e. "why do I care about this?")

This all makes the book feel like a real slog to get through.

In the end, a number of concepts did stick, so it was useful from that perspective. I can't say I particularly enjoyed the ride, though, and I have extreme skepticism that all but the most dedicated beginners would manage to slog through the whole thing.
Profile Image for Gavin.
1,066 reviews305 followers
July 17, 2022
Good. Slightly stodgy, but not malicious or cold. More technical terms for after you learn you a Haskell.

Free sample
Profile Image for G..
Author 8 books2 followers
August 17, 2018
This book is an amazing work. Its 1300 some pages walk the reader from entering simple expressions into the REPL through all the big concepts that make Haskell scary. There are plenty of examples, lots of code to read and try on your own, and plenty of discussion (sometimes multiple approaches to a single topic!). It is exhaustive, approachable and seems quite free of errors.

So, you ask: "why only 4 stars?" Well, although it is a brilliant book, this is a warning that it may not be the book for you. As a metonymic example, explanations of Monads are a trope on the internet. Many people feel, once their own understanding is clear, that they, better than the hundreds that have gone before, can explain the concept clearly. The truth is simply that different people just achieve understanding differently.

Similarly, as is evidenced by the tens of readers that have loved this book, it might well be your path to understanding Haskell. If that is your goal, the sheer amount of work the authors put into this book certainly should earn it a chance. It is absolutely the case that it would be impossible to read it, in its entirety, without learning a *lot* of Haskell. If, however, you find the constant forward references and the informal approach to syntax frustrating, there may be a faster, shorter path.
Profile Image for Christian Panadero.
13 reviews7 followers
November 27, 2018
If you are interested on Haskell or in the functional programming paradigm, this is a must read book.
34 reviews2 followers
November 27, 2019
Disclaimer: I read RC2, and couldn't finish it (lost interest in the Monad chapter)

Things I liked about this book:
- compiles a huge amount of material, arranged in a reasonable order, and if you manage to read it all, you'll inevitably know something about haskell
- it encouraged good interactivity, with lots of well-spread-out exercises, and constant instructions for playing in the repl

On the whole though, this book just isn't ready for publishing and it's a shame that it's been available for so long at such a high price without being finished.

The exercises were often not well thought out or explained. Sometimes they hit the mark, but sometimes they had serious issues:
- sometimes so trivial that I thought I didn't understand what was being asked
- sometimes completely unsolveable without concepts that had never been mentioned in the book, with no hint that they would be impossible without outside research
- sometimes they seemed easy enough but the results were impossible to verify with the skills learned thus far in the book; an answer key would have been helpful

The narrative flow of the book was often very janky. Sometimes a concept that had been mentioned only once, a hundred pages ago would be brought back as if it was fresh in the readers mind. Sometimes a concept that had been explained 5 pages ago would be reintroduced as if it was completely new. This caused me to constantly be confused and wonder if I was actually absorbing anything.

One of the authors, in the intro (and also in a blog post plugging the book) presented very weak criticisms of other languages and portrayed haskell as the vastly superior solution, as if it too doesn't have odd edge cases and would never be frustrating. This disingenuous-ness made me automatically distrust the book's content.

Whether it was for the above reasons, or others, what the book was teaching mostly didn't seem to click with me. I have guesses about what aspects of the language it missed explaining, but my understanding of the language is still weak enough that my guesses are probably wrong.

On the whole, this is among the worst tech books I've read.
Profile Image for Bennie.
63 reviews2 followers
November 6, 2018
This book is a labyrinth presented as a learning path. It has multiple dead ends and frustrating skims over material that made me rage quit. The authors do not expect the reader to understand everything the first time read the book. They do not expect you to finish every exercise (they state this much from the outset). The authors, though, do not state WHICH things they do not expect you to understand the first time or WHICH exercises you won’t be able to complete. Sure, that will vary from reader to reader, but if you don’t heed this warning, you will waste too much time spinning out over trivial bits.

My recommendation is this: if you don’t understand something by the end of the chapter, Google it. You might end up ahead of the game sometimes, but you may find another explanation that may better suit your learning style.

Don’t sweat needing a break here and there. I took several throughout, and I came back to the book ready to take on another part.

Overall, the book is one whose approach I could not appreciate until I had finished it. In later sections, the book explained most frustrations I experienced. The book knows this and tries to tell you this. But being a 1200+ page book, you will have doubts. Yes, you need to wait until the end to understand I/O and Exceptions. I appreciated the prior chapters’ knowledge when digging into those monsters.
Profile Image for Tony Poerio.
212 reviews11 followers
August 16, 2016
Not all the way done yet, but neither is this book. The five stars are to encourage others to give it a try, and to let the authors know my appreciation.

Already over 1,000 pages, this book is full of more examples and exercises than you could ever need to understand Haskell. It's extremely comprehensive and excellent.

I've read (and tried to read) a few other books on Haskell, but this one does the best job--by far--of making the material accessible to someone who hasn't already done a Ph.D in some obscure subfield of Math or Computer Science.

This book is very incremental, and builds your understanding slowly but surely. And with Haskell, that seems the best way to gain actual understanding. This won't be a quick read -- I'm about 800 pages in, and still have a ways to go. But take it slow, enjoy it, and your time will be rewarded. Thanks Chris.
32 reviews1 follower
May 23, 2015
As a first draft, it's very impressive - the quality of explanation is high, and except for the (current) latest chapter about datatype, I wouldn't hesitate to recommend it to anyone, even those unfamiliar with the craft of programming.

Now, I want to read everything else !
Profile Image for Erlend.
15 reviews
November 12, 2016
Great, thorough book with excellent exercises. Lots of hands-on stuff and great explanations. Even when reading about stuff I knew, a lot of gaps were filled in. It leaves the learner able to write “real world” programs and not just algorithms and small demo programs.
2 reviews
March 13, 2019
Most likely the best way to learn Haskell. It's a massive book with lots of exercises that focuses on teaching Haskell for understanding. I'd recommend it to anyone wanting to learn not just Haskell but FP in general.
26 reviews2 followers
September 14, 2018
- The best thing about the book is it covers enough topics to get one started with programming in Haskell.
- Another really nice thing I liked about it is it builds a decent amount of motivation in most of the topics before actually explaining those topics.
- I liked the coverage of monoids and semigroups before Applicatives and Monads. It felt more natural because, well, Applicatives are Monoidal Functors ;)
- It covers many practical topics like Testing, building projects which I found lacking in other books.

- The not so good part was it felt too verbose. Even for a first-time reader it felt overly explained. The chapter on Monads was quite a turn-off. We kept going pages on pages on learning what *is not* a monad before actually learning what *is* a monad.

- The introductory chapter on lambda calculus was really good. It gave me an impression that throughout the book we will keep connecting the ideas of lambda calculus with fp. It turns out not to be the case.

To summarise, a great introductory book for readers who prefer very detailed explanations compared to dense explanations. It is still a decent book for other readers as perhaps this seems to be the only book covering this much amount of material.
Profile Image for MinhTu Thomas Hoang.
28 reviews8 followers
February 3, 2021
I think all the chapters from the beginning to chapter 18 on "Monads" are solid, and you can be productive with Haskell if you left at this point. The rest are not necessarily practical; and sometimes I felt that these chapters are quite lengthy & need more editorial support. If I need to summarise the book from chapter 19 to the end in one sentence, it would be, "You should read "Parallel and Concurrent Programming in Haskell: Techniques for Multicore and Multithreaded Programming" by Simon Marlow for better understanding".

Moreover, a lot has changed since 2017 when the book is published. I've worked through Hoogle and GitHub a lot to worked out which libraries' API has been changed in order to finish the chapters that need third-party libraries.

Still, I've learnt a lot through chapter exercises and the authors' instructive guidance!

P/S:
I encountered some comments stating that this book isn't well-organised. IMO it's not something to be bothered. I'd not fully understood chapter 6 on "Typeclasses" until I finished the chapter 16 on "Functor". As Chris wrote early in the book, because learning is a personal journey, you don't need to strictly follow the order the authors specified (I did jump around a lot).
Profile Image for Derek Ho.
7 reviews1 follower
February 25, 2021
Having this book as a starting point was infinitely more useful than reading blogs on getting started (although I did read many blogs and videos before starting). I was also reading Learn You a Haskell for Great Good in parallel to get a less theoretical, more beginner, grasp of the language.

Unfortunately, I am a windows user. There were some things I couldn't follow completely. Despite this, there have already been real benefits. I am already applying functional programming to my work in a more proper way. I'll be on the lookout to build some personal side projects (or work projects) with Haskell in the future. This book is probably one where you regularly reference to ensure a proper understanding of the concepts. Overall, it is a solid overview and foundational learning material. The book steadily eases new topics to avoid losing the learner, yet is unafraid of going deep to ensure a thorough understanding of the fundamentals (with some questionably comedic warnings).
January 25, 2022
We adopted this book as the main resource for a local Haskell study group. Our format consisted into monthly meetings reviewing chapters exercises solutions.
While we were able to successfully finish our study group program, I was a bit disappointed by this book.
In particular I found a degradation of the explanation quality over the progression of the chapters. This is a critical issue, as the latter chapters deal with the hardest to grasp concepts. Often, I had to look at other online sources in order to reach a deep understanding.
Nevertheless, the availability of chapter exercises have been key for an effective learning of Haskell. I'm not aware of another Haskell book featuring an organic mix of explanations and exercises (suggestion accepted). Hence, we would probably had adopted this book despite its flaws.
Profile Image for Alain O'Dea.
10 reviews
February 5, 2017
Excellent, well-paced book that walks through the significant challenge of teaching Haskell without scaring away self-taught programmers or those new to programming entirely. The exercises are a reach from the material, but an appropriate one that cements the lessons of the chapter rather than leaving the reading feeling adrift.

The iterative deepening approach taken by this book has left me with much greater confidence applying Haskell to my work and in reaching up from beginner Haskell into more advanced topics to improve my productivity.
13 reviews
August 29, 2019
An excellent introduction to the world of functional programming. My only complaints are that the book needs better technical editing in the later chapters (as of August 2019), and is sometimes unnecessarily long winded at times. This book requires patience and bit of familiarity with thinking in formal / mathematical terms.

As far as I know, this is the best and most up to date book on Haskell currently available. It will take readers from zero to a working knowledge of Haskell.
11 reviews
December 10, 2017
I think this book explains the core concepts in Haskell such as Functor, Applicative and Monad very well. I don't feel they are scary anymore after reading the book. So I highly recommend it to anyone who wants to learn functional programming or Haskell. Also I found the https://github.com/data61/fp-course was a perfect exercise suite for this book which I highly recommend too.
Profile Image for Juraj.
16 reviews
May 20, 2018
The best programming book I've ever read. Make no mistake, even though the name might make you think this is some brief introductory text, this book is huge and on the 1300 pages covers virtually everything you're gonna need on your way to Enlightenment...I mean, mastering Haskell :). The way is still very long even after reading this book, but it's easier :)
Profile Image for Long Nguyễn.
5 reviews
March 31, 2022
This is very good book to learn haskell.
The way Chris organized the content is very reasonable.
My approach is starting slowly with *data declaration*, familiar with pattern matching, then function compose, then functor, then applicative, then monad, then monad transformer.
I highly recommend this book.
25 reviews2 followers
July 9, 2017
Great intro to Haskell, it leaves nothing unexplained, which is the usual problem with Haskell intro resources. It's big, but if you go through all of it you'll have strong foundations. If it's too much you can still skip around and clarify the topics you most need to.
Profile Image for DANIEL.
23 reviews1 follower
January 19, 2019
The best book you can read if you want to learn and understand Functional Programming from the beginning. This book uses Haskell (which is a pure functional language) to explain every concept of FP, from zero to hero.

You can find the book here: http://haskellbook.com/
2 reviews
March 13, 2019
Most likely the best way to learn Haskell. It's a massive book with lots of exercises that focuses on teaching Haskell for understanding. I'd recommend it to anyone wanting to learn not just Haskell but FP in general.
Profile Image for Rohit.
21 reviews5 followers
January 1, 2019
More like 4.5 stars, hands down one of the best book on haskell. However some chapters are way too long and hope there were more questions to help exercise.
Displaying 1 - 30 of 39 reviews

Can't find what you're looking for?

Get help and learn more about the design.