mirror of
https://github.com/sdiehl/write-you-a-haskell.git
synced 2024-08-16 23:20:54 +03:00
Merge pull request #66 from yupferris/master
Small fixes in the Introduction chapter
This commit is contained in:
commit
169b738671
@ -109,13 +109,13 @@ one element of a set to each element in another set. If a function $f(x) = a$
|
||||
then the function evaluated at $x$ will always have the value $a$. Central to
|
||||
the notion of all mathematics is the notion of *equational reasoning*, where
|
||||
if $a= f(x)$ then for an expression $g(f(x), f(x))$, this is always equivalent
|
||||
to $g(a, a)$. In other words the values computed by functions can always be
|
||||
to $g(a, a)$. In other words, the values computed by functions can always be
|
||||
substituted freely at all occurrences.
|
||||
|
||||
The central idea of *functional programming* is to structure our programs in
|
||||
such a way that we can reason about them as a system of equations just like
|
||||
we can in mathematics. The evaluation of a pure function is one in which *side
|
||||
effects* are prohibited, a function may only return a result without altering
|
||||
effects* are prohibited; a function may only return a result without altering
|
||||
the world in any *observable* way.
|
||||
|
||||
The implementation may perform effects, but central to this definition is the
|
||||
@ -245,7 +245,7 @@ Parsing
|
||||
|
||||
The source code is simply the raw sequence of text that specifies the program.
|
||||
Lexing splits the text stream into a sequence of *tokens*. Only the presence of
|
||||
invalid symbols is checked, programs that are meaningless in other ways are
|
||||
invalid symbols is checked; programs that are meaningless in other ways are
|
||||
accepted.
|
||||
Whitespace is either ignored or represented as a unique token in the stream.
|
||||
|
||||
@ -268,9 +268,9 @@ following:
|
||||
]
|
||||
```
|
||||
|
||||
We can then scan the token stream via and dispatch on predefined patterns of
|
||||
tokens called *productions* and recursively builds up the syntax datatype for
|
||||
the *abstract syntax tree* (AST) by traversal of the input stream.
|
||||
We can then scan the token stream via dispatch on predefined patterns of
|
||||
tokens called *productions*, and recursively build up the syntax datatype for
|
||||
the *abstract syntax tree* (AST).
|
||||
|
||||
```haskell
|
||||
type Name = String
|
||||
|
@ -14,3 +14,4 @@ Contributors
|
||||
* Dmitry Ivanov
|
||||
* Christian Sievers
|
||||
* Franklin Chen
|
||||
* Jake Taylor
|
||||
|
Loading…
Reference in New Issue
Block a user