-
Notifications
You must be signed in to change notification settings - Fork 64
/
key-point-summaries.txt
102 lines (81 loc) · 3.38 KB
/
key-point-summaries.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# Summary of the key concepts covered in this activity
# Week 1: Haskell First Steps
### Haskell Basics: Expressions and Equations
Summary (three key points)
* Expressions in Haskell are similar to those in other languages.
* But there are only expressions, no statements in Haskell.
* Assignments are not updates of values but equations.
### Haskell Basics: Reduction, Functions and Lists
Summary (three key points)
* Haskell programs compute by _reduction_.
- i.e. gradually replacing expressions by their values.
* A function takes one or more _arguments_
and computes a _result_.
- Given the same arguments, the result will always be the same.
- In Haskell there are no side-effects.
* The list is the key datastructure.
- It is quite similar to lists in other languages but immutable.
# Week 3: Data Structures and Types
### Functions on Lists
Summary (three key points)
* The basic mechanism for computing on
any datastructure in Haskell is recursion.
- Recursion always has a _base_ case and an _induction_ case.
* For lists, the base case is the empty list [],
the induction case is adding an element to the list _x:xs_.
* For list operations, it is usually easier
to use higher-order functions
- like map (performing an operation on every element of a list)
- and foldl/foldr (reducing a list to a single value).
# Week 4: When programs get bigger
### Parsing Text
Summary (three key points)
* Parsing text is a very common and important operation.
* Monadic parser combinators are a convenient mechanism
to build parsers by combining building blocks,
- and a good illustration of the practical use of a monad.
* Each parser is a higher-order function
that returns a function.
- The parser combinators combine these functions into the final parser.
# Week 5: Hardcore Haskell
### More about Types
Summary (three key points)
* Function types describe the types of
arguments and return value of a function.
- The type of an argument can be a type variable,
- in which case we call the function polymorphic.
* Currying means rewriting a function
of more than one argument to a
sequence of functions of a single argument.
* Type classes allow to impose restrictions
on polymorphic type variables.
- Type classes express that e.g. a type represents
- a number, or something that can be ordered.
* Type inference is the analysis of code
in order to infer its type.
- It works using type inference rules that
generate typings based on the program text.
# Week 6: Think like a functional programmer
### Type classes
Summary (three key points)
* Type classes provide a set of function type signatures
* Haskell provides special keywords to create type classes
* To create an instance, we create functions
for a given type that match the signature of the type class
### Geek Greek
Summary (three key points)
* The lambda calculus is a formal model
for computation using only lambda functions.
* Haskell, as other functional languages,
is based on the lambda calculus
* The reduction rules from the lambda calculus
are used to reduce expressions in Haskell.
### The M-word
Summary (three key points)
* A monad is a mechanism for combining computations
* It is a typeclass providing the _bind_ and _return_ operations
* To be an actual monadic type, the implementations of
`bind` and `return` must conform to the three monad laws
* The `Maybe` monad illustrates how to create
a simple monad and its benefits.
#