# Book review: Learn You a Haskell for Great Good!

Hi everyone,

this is the first book I write about, but it’s so well written and amusing that I’ve decided to blog my personal review.

#### From rookie to master in 15 colorful chapters

This book is a little miracle indeed: you start thinking “Oh my God I’m an Haskell newbie, I won’t grasp Monads and other scaring stuff” and you finished thinking “So this are Monads about? They are so simple, it can be!”. The author guides you through all 15 chapters with a step-to-step approach: your path from functors to monads is built brick after brick. The amusing thing is that I’m reading it (indeed I haven’t finished it yet, 30 pages left ) at night just before going to sleep, and it’s so clear and simple that I can even understand everything!

Technically speaking, this book simply saved Haskell for me: before it, I considered Haskell a not-so-cool functional language, but this book changed everything.

#### The book, squeezed up

I’ve decided to go a step further into this book review, summarizing and giving an opinion of every book’s chapter:

1. Starting Out: Your first Haskell file, plus a lot of cool stuff, e.g. ranges and list comprehensions. You will end thinking “Why I need range(1,20) or “for i = 0; i < 20; i++” when I have 1 .. 20? List comprehensions are awesome, too.
2. Types and Typeclasses: Some Haskell’s basic types acquaintance. You will go deeper into the topic starting to Chp. 7
3. Syntax in Functions: some basic syntax you can live without. You can already write some non-trivial functions, in my opinion; they will be a little verbose, but correct.
4. Recursion: If you are familiar with functional language, go swiftly and fast through this.
5. Higher Order Functions: the Haskell awesomeness begin to emerge. Haskell is a language where you have some kind of cool stuff just out-the-box: currying, lazyness and more. Sure, they come with a price, but come on, just enjoy them meanwhile!
6. Modules: you will struggle with modules, and this chapter helps you to get thing a little less painful.
7. Making Our Own Types and Typeclasses: by far, one of most important chapter: if you wanna do serious Haskell development make sure to squeeze out this chapter and the beautiful Haskell Type System. As a bonus, your first encounter with Functors!
8. Input and Output: a light and pleasant chapter about Haskell IO. My advice is to skip this chapter and the next one for now. Come back with your overpowered Monad knowledge, and things will be much clearer (despite the fact they are clear even without any preliminar Monad knowledge).
9. More input and output: I don’t know why, this chapter is not present into the online version: the author preferred to merge its content into the Chp. 8 (see above).
10. Functionally Solving Problems: You can skip this, a collection of problems solved with functional thinking. Useful to take a pause and do some practice.
11. Functors, Applicative Functors and Monoids: Here the author have merged all the cool stuff into this chapter, but into the printed version Chp. 11 is just “Applicative Functors”, and it’s only dedicated to that topic. Strange. In this extra-condensed chapter you will encounter functors, applicative functors (beefed-up functors) and monoid (for wrapping existing types). With them you will be finally able to respond to this question “What the hell Maybe is useful about?”
12. A Fistful of Monads: Correspond to the book’s 13th Chapter. You will finally meet the legendary creature of Haskell programming: the powerful and terrifying Monad (I don’t why I thing to a Monad as a tibetan Monk).
14. Zippers: Perfect conclusion for the book; learn to use powerful Haskell functions based on Monoids and Monads

#### Conclusion

Learn You a Haskell is an amazing book, written by a very passionate author, for a fantastic programming language, Haskell. Give them both a try, you won’t regret! After all, Ada language is used into mission critial software, and Haskell has been influenced by Ada: This can’t be for accident, after all, don’t you believe?

See you!

Alfredo

## 5 pensieri su “Book review: Learn You a Haskell for Great Good!”

1. human mathematics scrive:

“for pure case” ?

2. Alfredo Di Napoli scrive:

Whoops Fixed

3. ceii scrive:

A small detail: monoids aren’t “beefed-up applicatives”. They’re completely orthogonal to the functor/applicative/monad ladder, and I’d say they embody a much simpler idea.

They’re also completely different things from a technical standpoint: “applicative functor” (like “functor” and “monad”) is a term that applies to parameterized type constructors with one parameter, like IO, Maybe or []. “Monoid”, on the other hand, applies to concrete types like Int and Bool (said more compactly, members of the Applicative class have kind (* -> *) whereas members of Monoid have kind (*)).

• Alfredo Di Napoli scrive:

Yea, you’re right Monoids are a costruct for wrapping existing types into something else, that can be used in some way (for example with mappend, mconcat and mempty)

• Divve scrive:

What do you mean with ‘Monoids are a construct for wrapping existing types into something else’? To say something is a monoid (by looking at the minimal definition of the Monoid class) is to express mempty and mappend for some type T. So, basically, it is expressing a no-op
and a binary combination of expressions (of type T) for a type T that is a Monoid where you uphold the rules of closure, associativity and “identity element” (http://en.wikipedia.org/wiki/Monoid).

Example.
instance Monoid Integer where
mzero=0
mappend=(+)

Perhaps I am missing something. If you want to inject (“wrap”) types into ‘something else’ you have Monads.