## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

No credit card required

## Book Description

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!

1. Learn You a Haskell for Great Good!
2. Introduction
3. 1. Starting Out
1. Calling Functions
2. Baby’s First Functions
3. An Intro to Lists
4. Texas Ranges
5. I’m a List Comprehension
6. Tuples
4. 2. Believe the Type
1. Explicit Type Declaration
3. Type Variables
4. Type Classes 101
5. 3. Syntax in Functions
1. Pattern Matching
2. Guards, Guards!
3. where?!
4. let It Be
5. case Expressions
6. 4. Hello Recursion!
1. Maximum Awesome
2. A Few More Recursive Functions
3. Quick, Sort!
4. Thinking Recursively
7. 5. Higher-Order Functions
1. Curried Functions
2. Some Higher-Orderism Is in Order
3. The Functional Programmer’s Toolbox
4. Lambdas
5. I Fold You So
6. Function Application with \$
7. Function Composition
8. 6. Modules
1. Importing Modules
2. Solving Problems with Module Functions
3. Mapping Keys to Values
4. Making Our Own Modules
9. 7. Making Our Own Types and Type Classes
1. Defining a New Data Type
2. Shaping Up
3. Record Syntax
4. Type Parameters
5. Derived Instances
6. Type Synonyms
7. Recursive Data Structures
8. Type Classes 102
9. A Yes-No Type Class
10. The Functor Type Class
11. Kinds and Some Type-Foo
10. 8. Input and Output
1. Separating the Pure from the Impure
2. Hello, World!
3. Gluing I/O Actions Together
4. Some Useful I/O Functions
5. I/O Action Review
11. 9. More Input and More Output
1. Files and Streams
3. To-Do Lists
4. Command-Line Arguments
5. More Fun with To-Do Lists
6. Randomness
7. Bytestrings
12. 10. Functionally Solving Problems
1. Reverse Polish Notation Calculator
2. Heathrow to London
13. 11. Applicative Functors
1. Functors Redux
2. Functor Laws
3. Using Applicative Functors
4. Useful Functions for Applicatives
14. 12. Monoids
1. Wrapping an Existing Type into a New Type
3. Meet Some Monoids
4. Folding with Monoids
15. 13. A Fistful of Monads
2. Getting Your Feet Wet with Maybe
4. Walk the Line
5. do Notation
16. 14. For a Few Monads More
1. Writer? I Hardly Knew Her!
2. Reader? Ugh, Not This Joke Again
3. Tasteful Stateful Computations
4. Error Error on the Wall