Home - Software Design, Testing & Engineering
Learn You a Haskell for Great Good!: A Beginner's Guide
Price: $35.95
& 2-Day * Free Nationwide Shipping! (* details)
Availability: Usually ship in 24 hours if sold by Amazon.com
Product Details
| Binding: | Kindle Edition |
|---|---|
| EAN: | |
| Label: | No Starch Press |
| Feature: | |
| Publisher: | No Starch Press |
| Studio: | No Starch Press |
Editorial Reviews
It's all in the name: Learn You a Haskell for Great Good! is a hilarious, illustrated guide to this complex functional language. Packed with the author's original artwork, pop culture references, and most importantly, useful example code, this book teaches functional fundamentals in a way you never thought possible.
You'll start with the kid stuff: basic syntax, recursion, types and type classes. Then once you've got the basics down, the real black belt master-class begins: you'll learn to use applicative functors, monads, zippers, and all the other mythical Haskell constructs you've only read about in storybooks.
As you work your way through the author's imaginative (and occasionally insane) examples, you'll learn to:
- Laugh in the face of side effects as you wield purely functional programming techniques
- Use the magic of Haskell's "laziness" to play with infinite sets of data
- Organize your programs by creating your own types, type classes, and modules
- Use Haskell's elegant input/output system to share the genius of your programs with the outside world
Short of eating the author's brain, you will not find a better way to learn this powerful language than reading Learn You a Haskell for Great Good!
Customer Reviews
The book doesn't go into any of the really hairy stuff, such as monad transformers, the subtleties of laziness, or unsafe IO, which are probably required for serious Haskell programming. But I guess it's excused, since it does call itself a beginner's guide. It *does* do a very fine job of showing how purity, type classes, and category theory concepts provide mind-blowingly elegant solutions to real, practical programming tasks. As such, I've started recommending it to anyone who asks for a good introduction to functional programming.
First a caution: Learn You a Haskell is not designed for non-programmers - it is not a guide to learn how to program. Rather, it's a guide for programmers who are used to imperative languages (like C, Java, or even Fortran) to learn about functional languages (and, obviously, Haskell in particular). What's nice about this book compared to other typical programming guides is that it's engaging to read; it's funny and cute, and the content is consistently clear. Also, the order in which the material is presented makes sense.
The book starts out with a few chapters on the basics. Lipovaca shows how to call functions, use lists and tuples, and understand the basic type system. He goes on to explain pattern matching, recursion, and higher order functions - the bread and butter of functional programming. The descriptions and examples (and even the doodles) are great. He goes through the toolkit of many commonly used functions (reverse, zip, map, fold, ...) and shows how to implement them from scratch.
Chapters 6 though 10 focus on actually using Haskell to write real programs. Modules are covered briefly before a great section on type classes. These can often be confusing to new Haskell programmers as they are very different from classes in a language like Java, but Lipovaca provides plenty of examples and clear explanations to make the learning process smooth. Next, input and output is introduced. Nothing very complicated is addressed - it's limited to basic console and file I/O - but it's more than sufficient to give a pre-monad overview of I/O. Chapter 10 is almost like a halfway point in the book. We use what we've learned so far to make a nice, useful, functional program before delving into the deeper type classes that are so critical to advanced Haskell programming.
The next few sections are where LYAH really shines. Where many Haskell resources introduce monads all at once with little reason for why they exist or how they were designed, Lipovaca builds into them beautifully. We start with a clear explanation of functors, then applicative functors, then monoids, and finally monads. It makes the following chapter on some common monads (Reader, Writer, and State) seem downright easy. (I'll admit: I had trouble with the State monad for a while when I was first learning Haskell - I wish I'd read this earlier!)
The book ends with a chapter on zippers that seems oddly out of place. Where most of the other chapters build from their predecessors, this one had nothing to do with anything from the previous few chapters. I think it would have been much better suited just before or after chapter 10 than as the climax of the book.
Overall, LYAH is a solid beginner's guide to Haskell. It covers most of the basics, does a great job with the beginning advanced material, and is fun to read to boot. I would have liked to see a section on Arrows, as I find myself using them more and more, but I recognize they're still pretty fringe right now, so I see this as only a minor fault. If you already feel comfortable with applicative functors and monads, this book won't provide much new material for you, but if you're anywhere from having no idea about Haskell to still afraid of the state monad, I highly recommend Learn You a Haskell For Great Good!.
I say "almost smashed it out," though, because there is room for improvement. Even at that, I think Lipovaca has, at the very least, hit a long triple, just bouncing off the top of the center-field wall, with this book.
To begin with, I must disagree with the reviewers who've claimed, in one way or another, that the author has left out information important even to a beginners' text. On the contrary, the scope and breadth of this text are truly astonishing. Nowhere else have I seen monads, monoids, functors, applicative functors, and the like, treated with such thoroughness and patience. As one or two other reviewers have pointed out, Lipovaca has even managed to impart insight into how these constructs actually obey the same laws that are expected of their theoretical counterparts in higher mathematics, specifically category theory--without getting bogged down in technical details. This would be a stunning achievement for any author, let alone one who's just writing his first book! As a programmer/hacker of more than thirty years, one who's deeply immersed in the imperative programming paradigm, I've truly come to appreciate how Lipovaca divides topics into small, bite-sized, easily-digestible chunks, with (mostly) easy-to-follow code snippets, before moving on to the next chunk. Indeed, he appears to approach his pedagogy from the sympathetic viewpoint of one who has quite recently had to grapple with a welter of high-flying, highly abstracted, and theoretical texts, and who consciously wants to spare his own readers this sort of iniquity.
If Mr. Lipovaca's book leaves anything at all to be desired, they would be the following: (1) More systematic use of exercises and problem sets at the end of each chapter; (2) Greater use of extended programming examples, and maybe a few programming projects that readers and hackers can really sink their teeth into. As for (1), despite the wealth of code snippets that the author provides, I still find myself wanting to test my assimilation and understanding, by forcing myself to complete a related set of exercises at chapter's end. To my way of thinking, in a beginners' text these exercises are absolutely indispensable. (Maybe it's just me, but without such exercises I always have the lingering, vaguely nauseated feeling in my gut that I haven't quite absorbed the relevant topics fully.) To take just one example: in his otherwise excellent discussion of randomness and pseudo-randomness (pp. 190-198), the author employs a snippet of code to intimate the beginnings of a rudimentary password generator (on p. 195). Here he misses a good bet, I think; he could have easily followed this up with a series of exercises cuing the reader to develop more powerful and refined versions of the password generator; for instance: "(1) Write a brief program that extends the password generator on p. 195 by generating a number of different passwords, the number of which the user can input from the keyboard; (2) Extend this program to allow the user to specify the length of the passwords generated; (3) Now have the program output the passwords in rows of five across, with all five columns aligned; (4) Develop your generator further, by allowing the user to incorporate upper- and lower-case characters, and/or numerals, and/or other typographical symbols, in the passwords;" and so on.*
As for (2), greater use of extended programming examples and projects, Mr. Lipovaca begins to do as much with his Optimal Path program of Chapter 10, and with the examples used in the final chapter on zippers, yet it still strikes me that he could go much further in this direction. This is one of very few areas in which Graham Hutton's deeply flawed book, Programming in Haskell, truly shines. I would particularly like to see such examples deployed when readers begin swimming in really deep waters--such as when the discussion turns to creating types, use of applicative functors, monads, and suchlike.
Happily, Mr. Lipovaca is as amicable and easy-going as his funny drawings suggest; I've corresponded with him on a few occasions, and he seems willing to address the use of exercises and projects in a subsequent edition of this book. If such an edition does come to pass, I will gladly shell out the bucks for it if the text is expanded to 450-500 pages, maybe with smaller chapters in greater numbers, and comes with copious examples to practice upon and hone the craft of Haskell programming. THAT book would be an absolute world-beater--and a "tape-measure" home run that bounces into the city streets.**
__________________________
*Anyone interested in seeing this program realized should Google XGB Web and Software Design, visit the Programming page, and click the link that references code for the password generator.
**Oh, and have I pointed out how much I LOVE the "I lie flat" feature of this book, with its semi-detachable back cover binding? I wish EVERY techbook had this feature.
The book says it's for beginners, but it walks from some fairly early topics all the way to Zippers, which, prior to this book confused me a good bit.
I recommend this book to anyone interested in Haskell as the different perspective on the approach of learning it can be enough to provide new insights to the language.
My only wish is that the author could have covered Enumerators, Iteratee and the like in the style of this book.
The examples in the book are nicely picked. Not only they explain the concept clearly, but they also lead up to material on which a next section or chapter is based. A discussion about Random numbers in Chapter 9 sets things up nicely for State Monad in Chapter 14. Build up from Functors (Chapter 7) to Applicative Functors (Chapter 11) to Monads (chapter 13 and 14) is done nicely. The book title mentions that its "A Beginners Guide", but I think by the end of this book the reader will be have a middle level Haskell understanding.
In terms of cons, I think there were couple of places where I felt discussion could have gone deeper into why things are the way they are. Probably they were omitted to keep the material interesting and not too dense. Also, I have been reading the book almost every day for a month and the back cover came out. But depending on how much I gained from the book, I would not rate this book any less.
LYAH definitely is among the top programming books I read so far. Due to the author's easy-going and funny style -- though I'm sure there will be some readers who won't appreciate his humor -- you might not even notice at first how choke-full of good content this book is, but once you are done with it you realize that you actually learned a lot. This would be an amazing feat for any technical book, but is even more impressive considering Haskell's reputation as being a very academical and arcane language. Sure, not everything is covered here -- Arrows or CPS come to mind -- but every book is finite and the selection of topics is absolutely appropriate for beginning Haskell enthusiasts. The only chapter I wasn't so happy with was the last one on Zippers, not because it wasn't well written or interesting, but more because it felt a bit tucked on.
What can you expect from this book? Will you be a Haskell guru after reading it? Most likely not, because that takes a long time of practice and actually writing code. Maybe that's one of the few weak points of LYAH, the code examples are usually rather short and focussed on getting the point across, not "real-world" tasks you are likely to encounter in day to day programming. They still are great for introducing the reader to Haskell's way of abstracting problems, which I find immensely beautiful and well thought out. Still, a chapter or two on "programming in the large" and how to structure a big Haskell project would have been nice additions, but there are other places for learning more about the language, e.g. the Haskell wiki or the Haskell Wikibook. What the book will do for you is that once you are done with it, you should have a good basic understanding of the language's key concepts and type system and will be comfortable around terms like "monoid", "applicative functor" and "monad". There still we be a long way to go before you can consider yourself a Haskell expert, but you'll have a very solid grounding to build on.
All in all this is a remarkable book and maybe just what this beautiful language was missing, an easy to read, entertaining yet still thorough introduction to the language, that gives you an idea that Haskell is not only a research subject for computer scientists but a useful tool that can be used to build software.
To someone coming from a more "traditional" programming language, Haskell at first lance appears utterly impenetrable. However, Mr. Lipova'a does a fantastic job of explaining the fundamental concepts in an interesting and informative way. For example, Haskell's function signatures are an interesting beast. That is, from an outsider's perspective the signature pair :: a -> b -> (a, b) can be a little intimidating. However, this book does a fantastic job of illustrating how these signatures are formed in a consistent manner. The matter of signatures is just a small bump in the road toward learning Haskell, but it's emblematic of Mr. Lipova'a's attention to detail. You'll appreciate this attention to detail when the book delves into some of the more arcane topics such as type classes and monads. That is, Learn you a Haskell *will not* explain these topics in relation to current popular languages, but instead on their own terms. In my opinion, this is the correct approach and without previous context the author's careful handling of detail is critical.
This is a fantastic book and I highly recommend it as a *the* first book on Haskell -- and possibly even the second.
The author has a sense of humor while not filling the text with lots of jokes or provocative humor; it just feels natural. The cartoons that populate the book are not comics and just have a figurative role. I must confess that sometimes they just fill space but others they help making the reading more nice. My only complain with the book is the lack of coding exercises at the end of each chapter. This wouldn't be a complain if the book was more structured around mini-projects that would force you to code something larger than small functions. They exist, e.g., the task list, the calculator, but more would be a nice addition.
Did I learn Haskell with the book? Definitely yes! And it was fun! Naturally I'm still at a beginner's level but if I keep coding more in Haskell, I believe I can consolidate what I've learned and be ready to pass to a more intermediate level. I have not read other Haskell books but if you want to learn the language, have a good grasp of its capabilities and what you can do with it, this is a good book to achieve it and I recommend it without a doubt!
Disclaimer: I was offered by the publisher a free copy for review.
What I especially like about it is the way it hints at the underpinnings of Haskell (and functional programming) in category theory (and other formal systems); thus making them much more accessible and comprehensible.
The discussions about monads are fantastic!
The examples are first rate: it's well worth going through each and every one of them (slowly and carefully) to fully absorb the gold mine of insights each one can impart. (Even if you think you already understand the concepts: you might just find yourself seeing things in a novel and unexpected way! ;-)
I truly hope the author will write another book. He has a real gift and talent; not only in explaining, but also in making things interesting. I actually found this book hard to put down. It really drew me in. (Not just any technical book can cast such a spell!)
This book should be of great interest to F# programmers. F# materials alone will not give a reader enough insight into the milieu of functional programming to really appreciate monads (for instance). In fact, I say: to really learn C# you need to learn F#, and to really learn F# you need to learn Haskell.
I also hope one day we'll have H# available as a fully integrated citizen of .Net (following in F#'s footsteps).
Haskell to me is well worth learning because it is so pure. The lessons learned can then be mapped back to many existing technologies that one must work with. (Legacy technologies aren't going away anytime soon; but the good news is that the Haskell way of thinking can still be leveraged to great good in many venues.)
The hand drawn artwork (done by the author himself!) added a lot to the tapestry and enchanting magic of this well crafted book.
In conclusion: my greatest praise for this book is the way it took such a lofty and important topic and made it so amazingly accessible, fun, and fascinating.
Kudos for a job well done!!!
Criticisms: maybe I'm asking too much from an introduction, but it really *is* rather basic; someone who finishes this book still has a ways to go before she's developing non-trivial Haskell programs. There's a bit of unevenness, and some of the chapters are long enough that they begin to drag -- the book might profit from some reorganization. But these are minor things. Looking at it another way, this book is worth a read for the many clever and well-crafted illustrations. That it succeeds in teaching introductory Haskell is pure bonus.
Note - I was provided a copy for reviewing purposes by No Starch Press.
But now I must write seventeen more words for this review to post so here they are!
Fans of the book's forerunning website will recognize Lipovaca's brand of humor as well as his cute pictures, qualities that serve well his purpose of keeping a difficult subject down to earth and downright fun. I give it four stars because I am persnickety about a few points of prose style and not because, say, the book lacks exercises, which is hardly a fault in light of the abundance of its examples. All in all, this text is a salvation, and it may even become a classic.
Create your own review



