| Table of Contents | 5 |
|---|
| About the Author | 15 |
|---|
| About the Technical Reviewer | 16 |
|---|
| Acknowledgments | 17 |
|---|
| Introduction | 18 |
|---|
| Part I: First Steps | 20 |
|---|
| Chapter 1: Going Functional | 21 |
| Why Haskell? | 21 |
| Why Pure Functional Programming? | 22 |
| Why Strong Static Typing? | 24 |
| The Haskell Ecosystem | 25 |
| The History of Haskell | 26 |
| Your Working Environment | 26 |
| Installing on Windows or Mac OS X | 27 |
| Installing on Linux | 27 |
| Installing on Linux from Source | 28 |
| First Steps with GHCi | 29 |
| The Time Machine Store | 31 |
| Summary | 32 |
| Chapter 2: Declaring the Data Model | 34 |
| Characters, Numbers, and Lists | 34 |
| Characters | 35 |
| Numbers | 36 |
| Strings | 38 |
| Lists | 39 |
| Creating a New Project | 44 |
| Creating a Project with Cabal | 44 |
| Creating a Project with Stack | 46 |
| Understanding Modules | 48 |
| Cabal and Stack | 50 |
| Defining Simple Functions | 50 |
| Creating a Simple Function | 51 |
| Specifying the Function s Type | 51 |
| Developing a Robust Example | 52 |
| Returning More Than One Value | 55 |
| Working with Data Types | 57 |
| Pattern Matching | 61 |
| Simple Patterns | 61 |
| Lists and Tuples | 66 |
| Guards | 68 |
| View Patterns | 71 |
| Records | 73 |
| Creation and Use | 73 |
| The Default Values Idiom | 77 |
| Summary | 79 |
| Chapter 3: Increasing Code Reuse | 80 |
| Parametric Polymorphism | 81 |
| Functions As Parameters | 84 |
| Higher-Order Functions | 85 |
| Anonymous Functions | 87 |
| Partial Application of a Function | 90 |
| More on Modules | 94 |
| Module Imports | 94 |
| Smart Constructors and Views | 96 |
| Diving into Lists | 99 |
| Folds | 100 |
| Lists and Predicates | 104 |
| Lists Containing Tuples | 112 |
| List Comprehensions | 113 |
| Haskell Origami | 118 |
| Summary | 123 |
| Chapter 4: Using Containers and Type Classes | 125 |
| Using Packages | 126 |
| Managing Dependencies | 127 |
| Building Packages | 129 |
| Building Packages with Cabal | 129 |
| Building Packages with Stack | 131 |
| Obtaining Help | 134 |
| Containers: Maps, Sets, Trees, Graphs | 134 |
| Maps | 135 |
| Sets | 140 |
| Trees | 142 |
| Graphs | 145 |
| Ad Hoc Polymorphism: Type Classes | 148 |
| Declaring Classes and Instances | 149 |
| Built-in Type Classes | 153 |
| Binary Trees for the Minimum Price | 159 |
| Step 1: Simple Binary Trees | 159 |
| Step 2: Polymorphic Binary Trees | 161 |
| Step 3: Binary Trees with Monoidal Cache | 163 |
| Container-Related Type Classes | 166 |
| Functors | 166 |
| Foldables | 169 |
| Summary | 171 |
| Chapter 5: Laziness and Infinite Structures | 172 |
| An Infinite Number of Time Machines | 173 |
| Lazy Evaluation Model | 178 |
| Understandin
|