This easy-to-use, fast-moving tutorial introduces you to functional programming with Haskell. You'll learn how to use Haskell in a variety of practical ways, from short scripts to large and demanding applications. Real World Haskell takes you through the basics of functional programming at a brisk pace, and then helps you increase your understanding of Haskell in real-world issues like I/O, performance, dealing with data, concurrency, and more as you move through each chapter. With this book, you You'll find plenty of hands-on exercises, along with examples of real Haskell programs that you can modify, compile, and run. Whether or not you've used a functional language before, if you want to understand why Haskell is coming into its own as a practical language in so many major organizations, Real World Haskell is the best place to start.
This is both a great book, and a horrible book, for learning Haskell. In short, it's well-written, has good structure, and complete examples that enable you to follow along, but it's getting too old.
I feel I learned a lot from it, but it took a great deal of effort. Apart from breaks here and there, I started a year ago, and decided to devote one hour every morning to it. I also decide to rigorously type in everything in the book, in order to learn by doing.
What's good
The book introduces Haskell without assuming that you know anything about the language. It tells you how to get started, even how you install Haskell on various operating systems, including Windows, Mac OS, and multiple variations of Linux.
Whenever there's a code listing, it starts with the name of the file, so if you're typing along, not only does it tell you what to type, but also in which file you should put the code. I found that tremendously helpful.
In the first many chapters, the code is introduced in order, which means that it compiles right away. In later chapters, when you see some more 'real-world' examples, the code doesn't compile right away, because it calls functions not yet defined. Sometimes I found myself typing for days before I could get everything to compile, and then I had to go back in order to try to understand what I just spent some hours typing.
The entire text of the book is legally available for free online, so I could have simply cut and pasted from the site. Still, I chose to type, because I believe that the act of typing helps me retain what I've learned.
The online version of the book includes community contributions in the form of comments, and I found those indispensable.
What's bad
First of all, the book is from 2008, and while that doesn't sound that terrible, unfortunately it predates some breaking changes that were added to Haskell since it was published. In general, I was able to handle the problems that arise from those breaking changes, often because someone had already blazed the trail before me. I found a few answers on Stack Overflow, but in general, most help was already available in the comments to the online version of the book.
One or two chapters are so severely impacted by the breaking changes that I gave up on making the code compile, but in most cases, I managed. Often, it was difficult, and I was stuck for days, but I also believe that I learn something valuable about the language from having to troubleshoot old code.
There's a good answer on Stack Overlow that summarises which parts of the book are obsolete, and which parts are still good.
Another, unrelated, problem with the books is that the exercises are often ambiguous or just formidable. A few of them, I could solve in a couple of minutes; some of them, I spent weeks on; and some I simply gave up on.
Summary
I learned a lot from this book, but it was also because I was willing to put serious work into it. For that reason, I consider my efforts worthwhile, but I'd probably not recommend this book to someone interested in an introduction to Haskell today. Too bad, because it's the only Haskell book I've read so far, so I don't know of an alternative to suggest.
Finally done! I started reading this book before it was published. I stalled out several times, and restarted from the beginning, so some parts have been read 3 or 4 times. Eventually it became a proxy for learning Haskell. So it's hard to say I'm done.
I contributed a lot of stupid comments to the first several introductory chapters, and hopefully made them better. The book was reviewed on the web by many people, in a rather unique way, and I'm one of many proud to be listed as a reviewer in the book.
The first several chapters are a good introduction. I didn't really develop the ability to evaluate nontrivial haskell code by reading them though, and that made it much harder for me later. (I also didn't really do the exercises, which probably didn't help with this.)
I got stuck around chapter 6, on typeclasses. The explanation didn't stick well, and I struggled especially with the multiple different namespaces used in typeclasses, often with a single Word being defined in more than one. Also with polymorphic types. Hard to tell if this was the book's problem or my own.
The chapter on IO wisely comes before monads, and this works quite well.
But, the development of monads used in the book didn't work for me. Part of the problem is that the example code that is used to motivate monads is tangled up in a chapter that involves parsing PGM image files. The monad-free code written to do this was clearly not the right way, but I also found it so incomprehensible, with my poor grasp of the syntax, and relating to such boring subject matter that it was hard to get through.
Similarly, arrays and maps are buried in a chapter that develops a barcode parser. While quite an impressive thing to put in this book, I wonder if that is somehow too impressive to expect readers to wade through while still shakey in syntax and foundations. (And, similarly, getopt is only explained in the last chapter of the book, which purports to be about STM! It's not even in the index, so unless you read it all right through before trying to write any real world program, you'll struggle to find some decent getopt docs elsewhere.)
Some of the better chapters don't have a large body of code attached. The shining example of this is the awesome chapter on profiling, which concerns itself with 5 lines of code and dives down all the way to assembly language to make it optimal. It's a great reference chapter the first time you get stuck on haskell space use, too.
That seems to be the main tension in the book, is it about showing actual real-world code, or real-world techniques? Perhaps the book errs on the side of showing off too many of the authors' pet projects.
I also suspect that, despite the heavy reviewing of chapters as they were written, O'Reilly may have rushed this book to press somewhat. (My own limited experience with working with O'Rielly suggests this is not uncommon.) It's a bit sad to see corrections that were made before publication time and did not get in. I hope for a second edition one day. Particularly, the book needs to be updated to use new style exceptions, and some of the other examples have rotted.
Still and all, I read the book, and "Learn You a Haskell", and a bunch of web writings, and I eventually learned haskell well enough to write a real-world, eleven thousand line program that is being used by a fair number of people. Without having actually sat down and written the program, I'd not truely understand haskell to the extent I do. Without this book, I'd certainly not have even tried.
This was a book that was very, very hard to read. It took me several months. And frankly, with all the buzz about it, I was expecting a lot more.
Some of the chapters are brilliant. I really loved the ones about building a JSON serializer, parsing with Parsec, composing monads with monad transformers, and profiling memory and execution time.
Some of the chapters felt out of place. I am yet to find a reason for the barcode recognition chapter to exist. Same goes for the FFI chapter - do people need to call C code from Haskell that often?
Some of the chapters are truly bad. The ones about "system" programming (shell emulation really), GUI programming, Networking, HTTP, and Syslog client/server feel like blog posts that you cobble together on a Friday night. They contain a bunch of code with almost no explanations and a "Here! It works! See how nice it is!" statement at the end.
I'd still recommend the book. Even if you go through the Haskell language features chapters and my good chapters list, you'd learn a lot.
Unfortunately, this book was a disappointment for me. There are a lot of typos in the printed version, but it's not a biggest disadvantage. It was really hard to follow the book. I think that a lot of things are just in the wrong order. There are a lot of moments when you just get a lot of code in your face without any explanations. Also, I didn't really like that there are a lot of details about the domain of examples (barcodes, image formats etc.) that doesn't really help you in learning Haskell stuff. Anyway, it is still worth reading, it has some really good chapters and contains a lot of practical information and library examples. Notice, that one should not start learning Haskell with this book, definitely. I don't agree with the description that says that "This easy-to-use, fast-moving tutorial introduces you to functional programming with Haskell."
I've been reading this for nearly 6 months and have just finished. While very detailed and clear about some of the more complex areas of Haskell, I found some of the explanations a bit long winded. If you are looking for a good deep dive and already have some experience of Haskell I would recommend this book, but if you are new to it then I'd say to try Learn you a Haskell for great good first.
There are two things that have to be separated: firstly, the book itself is written in a very decent way and guides you through the aspects of functional programming very nicely. As a result you can learn the theory in a pretty comprehensive way.
The other thing oscillates around Haskell itself - as a specific implementation and all the tools aimed at developing. While reading the books I was really amused with the potential hidden in the language, but everything disappeared during the coding. Ok - it's very easy to reproduce simple examples, but writing a program that actually DOES something is challenging as hell. Doing this in a production-ready way is even more problematic. And it doesn't help at all that the community seems to be divided internally between cabal- and stack-supporters. Oh yeah, and the last thing: let me know if you manage to find an IDE that works out of the box. Most of them are terribly poorly configured and/or are missing so important features. I've heard crazy stories about very short, concise programs written in Haskell, but well... how can I verify this if I can't even work out how to set up my IDE correctly ?
Lastly: the community. By itself it's nice in general, but don't expect constructive answers when it comes to questions like "cabal or stack ?" etc.
To sum up: the book itself is very decent and I can say I liked it. However, I wouldn't recommend it due to massive problems with actually using Haskell.
(Disclaimer: I'm open to a discussion and happy to change my opinion if I'm proved to be wrong)
Don't try to read this book unless you have enough free time: it is too old and most of the examples are complete broken.
Anyways, four stars because it cover more than what I expected (actually I am trying to update the entire book. If you decide to spend time reading it would you lend me a hand?)
This book is a good book to use as a reference. Each chapters in the book covers a common real world task along with how you can solve it in Haskell. That being said, most (if not all) of the task covered in this book is readily available online so I can't imagine going back to this book when I'm faced with a problem.
This book worked me over pretty hard. It covers the functional programming language Haskell, emphasizing its usage in real world applications. It really did a phenomenal job at this, despite the several times I could barely stop myself from throwing it across the room. But I kept chugging through it, no matter how bad it hurt. I did give up on it once, but picked it up again a few days later and kept going.
Many of the chapters I barely understood, but as the book progressed, they started feeling more familiar. That's the benefit of its real world approach. Its conceptual chapters are often followed by case study chapters. Sometimes it will use these case studies to introduce more concepts. I liked that it started with simple examples, and then only introduced complex concepts after the code became too unwieldy. This helped make sense of why these complex concepts are useful, and not just theoretical. Again, part of its "real world" approach.
It's a long book, and covers a ton of subjects, including types, functions, recursion, folds, functors, applicative functors, monads, monad plus, monad transformers, I/O, typeclasses, regular expressions, JSON, testing, Parsec, Cabal, maps, lists, interfacing with C, error handling, systems programming, databases, GUI, networking, concurrency, profiling, sockets, CSV, and STM. Those are just the concepts! On top of that, it has several complex case studies, including searching a filesystem, parsing binary data, barcode recognition, a web client, a bloom filter, and a syslog client/server. So, yeah, I got plenty of opportunity to get used to the new ideas.
But seriously, I wanted to strangle these authors sometimes. It's pretty disjointed. There are three authors, and it shows. Sometimes, it feels like a collection of tutorials. In some early chapters, difficult concepts are taken for granted, while later chapters belabor simple concepts. It's the former problem that annoyed me the most. If you overheard me as I read this book, you'd hear a lot of, "what the hell are you talking about?" "what does that even mean?" "did you just pull that function out of your ass?" I completely gave up all hope of even trying my hand at the exercises scattered throughout the book. Some of them are so challenging that they require a Ph.D. in computer science in addition to an in-depth knowledge of Haskell concepts the book never even mentions.
And yet, I give this book five stars, for a few reasons. One is that the authors are bad asses. They know this language very intimately, and speak it fluently. Another is that it is ridiculously thorough. It's a tutorial, a cookbook, a guide to language tools, and a reference book, all in one. When I learned Ruby, I had to read a dozen books to really understand it, whereas I feel like I just need to keep studying this one book to get all I need to program in Haskell. Luckily, this book is also available for free online, so it will always be at my fingertips for my future reference. But the biggest reason this book gets five stars is the same reason I give any book five stars: it challenged me, it pushed me, and I grew from it. I could feel my mind shifting as I read it. I was merely intrigued with Haskell before this book, but now I'm absolutely hooked. After this book, I have a totally different attitude toward programming.
It took me forever to read this book from cover to cover. I've read it *very* sparingly, meaning that I read the first chapter in 2011 and only now, 2015, I'm done with it. I tried to study all the chapters very thoroughly and use other resources to complement my understanding.
I knew zero about Haskell and because this book focuses on practical (real world) examples, it's not the best choice for beginners. It's great for people intending to use Haskell professionally, but I'd recommend http://learnyouahaskell.com/ first. In addition, I found it easier to learn concurrent programming (covered on chapters 24 and 28) from the "Parallel and Concurrent Programming in Haskell" book.
As people mention in other comments, several examples in the free version of the book, on the website, are not working (I think it always runs the examples against more recent GHC versions, which are back-incompatible with the examples - it would be simpler if the examples were static).
Finally, I felt the level of clarity and explanation from chapters seem to vary significantly from chapter to chapter. For example, in some chapters the authors go over each function one by one, explaining what they do, while in others it provides a single big chunk of code where the explanation is done in the comments.
I'm really grateful that the authors from this book and the others mentioned made it available for free. Haskell is a hard language to learn and it would be impossible if there was not from a curated list of topics. Hopefully this review is constructive.
I'll be brief. This is an excellent introduction to Haskell and functional programming. It doesn't waste space on trying to explain FP in terms of imperative or OO concepts, but makes the basic ideas very natural.
In particular, it has an excellent approach to monads, which succeeds in demystifying them. However, the explanation of monad transformers is less lucid and doesn't really get to the basic idea, which is just one type with the properties of more than one monad. As such it doesn't quite gel.
The only real niggles are that (1) often library functions are used without explanation, (2) code in the larger examples isn't presented in the most logical order, so one has to do some jumping back and forth, (3) there are too many typos.
But these are minor points. This is an excellent book and well worth the investment. Any serious student or Haskell programmer should own a copy.
Ugh. I've tried to read this book five times. One day I'll get through it. It's fine (as far as I remember) until about one third or one half of the way through and then it gets really heavy and not well explained.
This book singlehandedly raised a generation of Haskell programmers. We went from writing Fibonacci sequence generators to writing web applications and systems utilities. I can't speak to whether this is a good introductory book, but it took me from beginner to intermediate/advanced and no book can take you further at this point. If you're curious about Haskell and don't need technical books to be cutesy, get this book.
This book made me think and made me solve problems myself, but I don't feel I came away from it with applicable skills. The topics were interesting and the examples were compelling, but I still wasn't able to "get" idiomatic Haskell after completing it. In fairness I was able to make some impactful Open Source contributions to GHC and Haskell libraries afterwards so perhaps my standards as too high.
Clear and engaging, with useful examples. Somewhat more complete in terms of language features than The Haskell School of Expression, but both are worth having.