Haskell is one of the leading languages for teaching functional programming, enabling students to write simpler and cleaner code, and to learn how to structure and reason about programs. This introduction is ideal for beginners: it requires no previous programming experience and all concepts are explained from first principles via carefully chosen examples. Each chapter includes exercises that range from the straightforward to extended projects, plus suggestions for further reading on more advanced topics. The author is a leading Haskell researcher and instructor, well-known for his teaching skills. The presentation is clear and simple, and benefits from having been refined and class-tested over several years. The result is a text that can be used with courses, or for self-learning. Features include freely accessible Powerpoint slides for each chapter, solutions to exercises and examination questions (with solutions) available to instructors, and a downloadable code that's fully compliant with the latest Haskell release.
'The best introduction to Haskell available. There are many paths towards becoming comfortable and competent with the language but I think studying this book is the quickest path. I urge readers of this magazine to recommend Programming in Haskell to anyone who has been thinking about learning the language.' Duncan Coutts, Monad Reader 'Two groups of people must consider this book. The first is professors interested in rapidly introducing students to fundamental concepts in functional programming. This book, supplemented with online resources and professorial guidance could easily serve as the textbook for a semester-long course on functional programming. The second group is programmers interested in surveying the functional paradigm as quickly as possible.' Journal of Functional Programming
| Preface | p. xi |
| Introduction | p. 1 |
| Functions | p. 1 |
| Functional programming | p. 2 |
| Features of Haskell | p. 4 |
| Historical background | p. 6 |
| A taste of Haskell | p. 6 |
| Chapter remarks | p. 9 |
| Exercises | p. 9 |
| First steps | p. 10 |
| The Hugs system | p. 10 |
| The standard prelude | p. 10 |
| Function application | p. 12 |
| Haskell scripts | p. 13 |
| Chapter remarks | p. 16 |
| Exercises | p. 16 |
| Types and classes | p. 17 |
| Basic concepts | p. 17 |
| Basic types | p. 18 |
| List types | p. 20 |
| Tuple types | p. 20 |
| Function types | p. 21 |
| Curried functions | p. 21 |
| Polymorphic types | p. 23 |
| Overloaded types | p. 23 |
| Basic classes | p. 24 |
| Chapter remarks | p. 28 |
| Exercises | p. 28 |
| Defining functions | p. 30 |
| New from old | p. 30 |
| Conditional expressions | p. 31 |
| Guarded equations | p. 31 |
| Pattern matching | p. 32 |
| Lambda expressions | p. 34 |
| Sections | p. 36 |
| Chapter remarks | p. 36 |
| Exercises | p. 37 |
| List comprehensions | p. 38 |
| Generators | p. 38 |
| Guards | p. 39 |
| The zip function | p. 40 |
| String comprehensions | p. 41 |
| The Caesar cipher | p. 42 |
| Chapter remarks | p. 46 |
| Exercises | p. 46 |
| Recursive functions | p. 48 |
| Basic concepts | p. 48 |
| Recursion on lists | p. 49 |
| Multiple arguments | p. 52 |
| Multiple recursion | p. 53 |
| Mutual recursion | p. 53 |
| Advice on recursion | p. 55 |
| Chapter remarks | p. 59 |
| Exercises | p. 59 |
| Higher-order functions | p. 61 |
| Basic concepts | p. 61 |
| Processing lists | p. 62 |
| The foldr function | p. 64 |
| The foldl function | p. 66 |
| The composition operator | p. 68 |
| String transmitter | p. 69 |
| Chapter remarks | p. 72 |
| Exercises | p. 72 |
| Functional parsers | p. 74 |
| Parsers | p. 74 |
| The parser type | p. 75 |
| Basic parsers | p. 75 |
| Sequencing | p. 76 |
| Choice | p. 78 |
| Derived primitives | p. 78 |
| Handling spacing | p. 81 |
| Arithmetic expressions | p. 82 |
| Chapter remarks | p. 85 |
| Exercises | p. 85 |
| Interactive programs | p. 87 |
| Interaction | p. 87 |
| The input/output type | p. 88 |
| Basic actions | p. 88 |
| Sequencing | p. 89 |
| Derived primitives | p. 90 |
| Calculator | p. 91 |
| Game of life | p. 94 |
| Chapter remarks | p. 97 |
| Exercises | p. 97 |
| Declaring types and classes | p. 99 |
| Type declarations | p. 99 |
| Data declarations | p. 100 |
| Recursive types | p. 102 |
| Tautology checker | p. 105 |
| Abstract machine | p. 109 |
| Class and instance declarations | p. 111 |
| Chapter remarks | p. 114 |
| Exercises | p. 114 |
| The countdown problem | p. 116 |
| Introduction | p. 116 |
| Formalising the problem | p. 117 |
| Brute force solution | p. 119 |
| Combining generation and evaluation | p. 120 |
| Exploiting algebraic properties | p. 121 |
| Chapter remarks | p. 123 |
| Exercises | p. 123 |
| Lazy evaluation | p. 124 |
| Introduction | p. 124 |
| Evaluation strategies | p. 125 |
| Termination | p. 128 |
| Number of reductions | p. 129 |
| Infinite structures | p. 130 |
| Modular programming | p. 132 |
| Strict application | p. 134 |
| Chapter remarks | p. 137 |
| Exercises | p. 137 |
| Reasoning about programs | p. 139 |
| Equational reasoning | p. 139 |
| Reasoning about Haskell | p. 140 |
| Simple examples | p. 141 |
| Induction on numbers | p. 142 |
| Induction on lists | p. 145 |
| Making append vanish | p. 146 |
| Compiler correctness | p. 150 |
| Chapter remarks | p. 154 |
| Exercises | p. 154 |
| Standard prelude | p. 156 |
| Classes | p. 156 |
| Logical values | p. 157 |
| Characters and strings | p. 158 |
| Numbers | p. 159 |
| Tuples | p. 160 |
| Maybe | p. 160 |
| Lists | p. 160 |
| Functions | p. 164 |
| Input/output | p. 164 |
| Symbol table | p. 166 |
| Bibliography | p. 167 |
| Index | p. 169 |
| Table of Contents provided by Ingram. All Rights Reserved. |
ISBN: 9780521692694
ISBN-10: 0521692695
Audience:
Professional
Format:
Paperback
Language:
English
Number Of Pages: 183
Published: 18th January 2007
Dimensions (cm): 24.7 x 19.0
x 1.0
Weight (kg): 0.358