Programming in Haskell

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

Introduction -- First steps -- Types and classes -- Defining functions -- List comprehensions -- Recursive functions -- Higher-order functions -- Functional parsers -- Interactive programs -- Declaring types and classes -- The countdown problem -- Lazy evaluation -- Reasoning about programs -- Appendix A: standard prelude -- Appendix B: symbol table

Author(s): Graham Hutton
Publisher: Cambridge University Press
Year: 2006

Language: English
Pages: 184
City: Cambridge, UK ; New York

Half-title......Page 3
Title......Page 4
Copyright......Page 5
Dedication......Page 6
Contents......Page 8
Preface......Page 12
1.1 Functions......Page 14
1.2 Functional programming......Page 15
1.3 Features of Haskell......Page 17
1.5 A taste of Haskell......Page 19
1.7 Exercises......Page 22
2.2 The standard prelude......Page 23
2.3 Function application......Page 25
My first script......Page 26
Naming requirements......Page 27
Comments......Page 28
2.6 Exercises......Page 29
3.1 Basic concepts......Page 30
Char – single characters......Page 31
Float – single-precision floating-point numbers......Page 32
3.4 Tuple types......Page 33
3.6 Curried functions......Page 34
3.8 Overloaded types......Page 36
Eq – equality types......Page 37
Ord – ordered types......Page 38
Read – readable types......Page 39
Integral – integral types......Page 40
3.11 Exercises......Page 41
4.1 New from old......Page 43
4.3 Guarded equations......Page 44
4.4 Pattern matching......Page 45
List patterns......Page 46
4.5 Lambda expressions......Page 47
4.7 Chapter remarks......Page 49
4.8 Exercises......Page 50
5.1 Generators......Page 51
5.2 Guards......Page 52
5.3 The zip function......Page 53
5.4 String comprehensions......Page 54
5.5 The Caesar cipher......Page 55
Encoding and decoding......Page 56
Frequency tables......Page 57
Cracking the cipher......Page 58
5.7 Exercises......Page 59
6.1 Basic concepts......Page 61
6.2 Recursion on lists......Page 62
6.3 Multiple arguments......Page 65
6.5 Mutual recursion......Page 66
Step 4: define the other cases......Page 68
Step 2: enumerate the cases......Page 69
Step 5: generalise and simplify......Page 70
Step 4: define the other cases......Page 71
6.8 Exercises......Page 72
7.1 Basic concepts......Page 74
7.2 Processing lists......Page 75
7.3 The foldr function......Page 77
7.4 The foldl function......Page 79
7.5 The composition operator......Page 81
Binary numbers......Page 82
Base conversion......Page 83
Transmission......Page 84
7.8 Exercises......Page 85
8.1 Parsers......Page 87
8.3 Basic parsers......Page 88
8.4 Sequencing......Page 89
8.6 Derived primitives......Page 91
8.7 Handling spacing......Page 94
8.8 Arithmetic expressions......Page 95
8.10 Exercises......Page 98
9.1 Interaction......Page 100
9.3 Basic actions......Page 101
9.4 Sequencing......Page 102
9.5 Derived primitives......Page 103
9.6 Calculator......Page 104
9.7 Game of life......Page 107
9.9 Exercises......Page 110
10.1 Type declarations......Page 112
10.2 Data declarations......Page 113
10.3 Recursive types......Page 115
10.4 Tautology checker......Page 118
10.5 Abstract machine......Page 122
10.6 Class and instance declarations......Page 124
Derived instances......Page 125
Monadic types......Page 126
10.8 Exercises......Page 127
11.1 Introduction......Page 129
11.2 Formalising the problem......Page 130
11.3 Brute force solution......Page 132
11.4 Combining generation and evaluation......Page 133
11.5 Exploiting algebraic properties......Page 134
11.7 Exercises......Page 136
12.1 Introduction......Page 137
12.2 Evaluation strategies......Page 138
Lambda expressions......Page 140
12.3 Termination......Page 141
12.4 Number of reductions......Page 142
12.5 Infinite structures......Page 143
12.6 Modular programming......Page 145
12.7 Strict application......Page 147
12.9 Exercises......Page 150
13.1 Equational reasoning......Page 152
13.2 Reasoning about Haskell......Page 153
13.3 Simple examples......Page 154
13.4 Induction on numbers......Page 155
13.5 Induction on lists......Page 158
13.6 Making append vanish......Page 159
13.7 Compiler correctness......Page 163
13.9 Exercises......Page 167
A.1 Classes......Page 169
A.2 Logical values......Page 170
A.3 Characters and strings......Page 171
A.4 Numbers......Page 172
A.7 Lists......Page 173
A.9 Input/output......Page 177
Appendix B Symbol table......Page 179
Bibliography......Page 180
Index......Page 182