Get Programming with 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"

The original book has a long list of errata (https://manning-content.s3.amazonaws.com/download/4/699ce32-de8b-4b62-880a-9cbd4a0a4624/Kurt_GetProgrammingwithHaskell_err3.html), and even the errata has typo. This file has all of them fixed.

Author(s): Will Kurt
Edition: 1
Publisher: Manning Publications
Year: 2018

Language: English
Pages: 616

Get Programming with Haskell
Contents
Preface
Acknowledgments
About this book
Who should read this book
How this book is organized
About the code
Book forum
About the author
Lesson 1 Getting started with Haskell
1.1 Welcome to Haskell
1.2 The Glasgow Haskell Compiler
1.3 Interacting with Haskell?GHCi
1.4 Writing and working with Haskell code
Summary
Unit 1 Foundations of functional programming
Lesson 2 Functions and functional programming
2.1 Functions
2.2 Functional programming
2.3 The value of functional programming in practice
Summary
Lesson 3 Lambda functions and lexical scope
3.1 Lambda functions
3.2 Writing your own where clause
3.3 From lambda to let: making your own variable variables!
3.4 Practical lambda functions and lexical scope
Summary
Lesson 4 First-class functions
4.1 Functions as arguments
4.2 Returning functions
Summary
Lesson 5 Closures and partial application
5.1 Closures?creating functions with functions
5.2 Example: Generating URLs for an API
5.3 Putting it all together
Summary
Lesson 6 Lists
6.1 The anatomy of a list
6.2 Lists and lazy evaluation
6.3 Common functions on lists
Summary
Lesson 7 Rules for recursion and pattern matching
7.1 Recursion
7.2 Rules for recursion
7.3 Your first recursive function: greatest common divisor
Summary
Lesson 8 Writing recursive functions
8.1 Review: Rules of recursion
8.2 Recursion on lists
8.3 Pathological recursion: Ackerman function and the Collatz conjecture
Summary
Lesson 9 Higher-order functions
9.1 Using map
9.2 Abstracting away recursion with map
9.3 Filtering a list
9.4 Folding a list
Summary
Lesson 10 Capstone: Functional object- oriented programming with robots!
10.1 An object with one property: a cup of coffee
10.2 A more complex object: let?s build fighting robots!
10.3 Why stateless programming matters
10.4 Types?objects and so much more!
Summary
Unit 2 Introducing types
Lesson 11 Type basics
11.1 Types in Haskell
11.2 Function types
11.3 Type variables
Summary
Lesson 12 Creating your own types
12.1 Using type synonyms
12.2 Creating new types
12.3 Using record syntax
Summary
Lesson 13 Type classes
13.1 Further exploring types
13.2 Type classes
13.3 The benefits of type classes
13.4 Defining a type class
13.5 Common type classes
13.6 The Ord and Eq type classes
13.7 Deriving type classes
Summary
Lesson 14 Using type classes
14.1 A type in need of classes
14.2 Implementing Show
14.3 Type classes and polymorphism
14.4 Default implementation and minimum complete definitions
14.5 Implementing Ord
14.6 To derive or not to derive?
14.7 Type classes for more-complex types
14.8 Type class roadmap
Summary
Lesson 15 Capstone: Secret messages!
15.1 Ciphers for beginners: ROT13
15.2 XOR: The magic of cryptography!
15.3 Representing values as bits
15.4 The one-time pad
15.5 A Cipher class
Summary
Unit 3 Programming in types
Lesson 16 Creating types with ?and? and ?or?
16.1 Product types?combining types with ?and?
16.2 Sum types?combining types with ?or?
16.3 Putting together your bookstore
Summary
Lesson 17 Design by composition? Semigroups and Monoids
17.1 Intro to composability?combining functions
17.2 Combining like types: Semigroups
17.3 Composing with identity: Monoids
Summary
Lesson 18 Parameterized types
18.1 Types that take arguments
18.2 Types with more than one parameter
Summary
Lesson 19 The Maybe type: dealing with missing values
19.1 Introducing Maybe: solving missing values with types
19.2 The problem with null
19.3 Computing with Maybe
19.4 Back to the lab! More-complex computation with Maybe
Summary
Lesson 20 Capstone: Time series
20.1 Your data and the TS data type
20.2 Stitching together TS data with Semigroup and Monoid
20.3 Performing calculations on your time series
20.4 Transforming time series
Summary
Unit 4 IO in Haskell
Lesson 21 Hello World!?introducing IO types
21.1 IO types?dealing with an impure world
21.2 Do-notation
21.3 An example: command-line pizza cost calculator
21.4 Summary
Lesson 22 Interacting with the command line and lazy I/O
22.1 Interacting with the command line the nonlazy way
22.2 Interacting with lazy I/O
Summary
Lesson 23 Working with text and Unicode
23.1 The Text type
23.2 Using Data.Text
23.3 Text and Unicode
23.4 Text I/O
Summary
Lesson 24 Working with files
24.1 Opening and closing files
24.2 Simple I/O tools
24.3 The trouble with lazy I/O
24.4 Strict I/O
Summary
Lesson 25 Working with binary data
25.1 Working with binary data by using ByteString
25.2 Glitching JPEGs
25.3 ByteStrings, Char8, and Unicode
Summary
Lesson 26 Capstone: Processing binary files and book data
26.1 Working with book data
26.2 Working with MARC records
26.3 Putting it all together
Summary
Unit 5 Working with type in a context
Lesson 27 The Functor type class
27.1 An example: computing in a Maybe
27.2 Using functions in context with the Functor type class
27.3 Functors are everywhere!
Summary
Lesson 28 A peek at the Applicative type class: using functions in a context
28.1 A command-line application for calculating the distance between cities
28.2 Using <*> for partial application in a context
28.3 Using <*> to create data in a context
Summary
Lesson 29 Lists as context: a deeper look at the Applicative type class
29.1 Introducing the Applicative type class
29.2 Containers vs. contexts
29.3 List as a context
Summary
Lesson 30 Introducing the Monad type class
30.1 The limitations of Applicative and Functor
30.2 The bind operator: >>=
30.3 The Monad type class
Summary
Lesson 31 Making Monads easier with do-notation
31.1 Do-notation revisited
31.2 Using do-notation to reuse the same code in different contexts
Summary
Lesson 32 The list monad and list comprehensions
32.1 Building lists with the list monad
32.2 List comprehensions
32.3 Monads: much more than just lists
Summary
Lesson 33 Capstone: SQL-like queries in Haskell
33.1 Getting started
33.2 Basic queries for your list: select and where
33.3 Joining Course and Teacher data types
33.4 Building your HINQ interface and example queries
33.5 Making a HINQ type for your queries
33.6 Running your HINQ queries
Summary
Unit 6 Organizing code and building projects
Lesson 34 Organizing Haskell code with modules
34.1 What happens when you write a function with the same name as one in Prelude?
34.2 Building a multifile program with modules
Summary
Lesson 35 Building projects with stack
35.1 Starting a new stack project
35.2 Understanding the project structure
35.3 Writing your code
35.4 Building and running your project!
Summary
Lesson 36 Property testing with QuickCheck
36.1 Starting a new project
36.2 Different types of testing
36.3 Property testing QuickCheck
Summary
Lesson 37 Capstone: Building a prime-number library
37.1 Starting your new project
37.2 Modifying the default files
37.3 Writing your core library functions
37.4 Writing tests for your code
37.5 Adding code to factor numbers
Summary
Unit 7 Practical Haskell
Lesson 38 Errors in Haskell and the Either type
38.1 Head, partial functions, and errors
38.2 Handling partial functions with Maybe
38.3 Introducing the Either type
Summary
Lesson 39 Making HTTP requests in Haskell
39.1 Getting your project set up
39.2 Using the HTTP.Simple module
39.3 Making an HTTP request
39.4 Putting it all together
Summary
Lesson 40 Working with JSON data by using Aeson
40.1 Getting set up
40.2 Using the Aeson library
40.3 Making your data types instances of FromJSON and ToJSON
40.4 Putting it all together: reading your NOAA data
Summary
Lesson 41 Using databases in Haskell
41.1 Setting up your project
41.2 Using SQLite and setting up your database
41.3 Creating data?inserting users and checking out tools
41.4 Reading data from the database and FromRow
41.5 Updating existing data
41.6 Deleting data from your database
41.7 Putting it all together
Summary
Lesson 42 Efficient, stateful arrays in Haskell
42.1 Creating efficient arrays in Haskell with the UArray type
42.2 Mutating state with STUArray
42.3 Taking values out of the ST context
42.4 Implementing a bubble sort
Summary
Afterword: What?s next?
A deeper dive into Haskell
More powerful type systems than Haskell?
Other functional programming languages
Appendix: Answers to end-of-lesson exercises
Unit 1
Unit 2
Unit 3
Unit 4
Unit 5
Unit 6
Unit 7
Index
Symbols
Numerics
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Z