A young man from Slovenia, just 23 years of age, writes his first book documenting a difficult computer-programming language, in English, which is not his native language. Given these facts, you'd think the odds would be stacked deeply against any measure of success for him. Yet it appears that, with his book Learn You a Haskell for Great Good!: A Beginner's Guide, Miran Lipovaca has almost smashed the ball right out of the ballpark. It is easily the best text available for an absolute newcomer to Haskell, and would also benefit many who've already perused other Haskell books. Moreover, of the seven volumes on Haskell that I own, it's the only one that I've so far managed to read cover-to-cover (including, BTW, typing, testing, and hacking all the code in it. I have, however, come close to finishing Graham Hutton's book, Programming in Haskell, which in most respects could not be further removed from this one.) Another big "plus": Mr. Lipovaca's code actually COMPILES. All of it. (Professor Hutton, are you reading this?)
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.