Skip to content

Commit

Permalink
Fix typos. (kowainik#214)
Browse files Browse the repository at this point in the history
  • Loading branch information
graceful-potato authored Oct 19, 2020
1 parent 46d1e8d commit 742b9e4
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/Chapter2.hs
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ values of variables you defined before.
Let's talk a bit about list implementation details. Lists in Haskell
are implemented as __linked lists__ (or cons-lists). And because
everything is Haskell is immutable, adding elements at the beginning
everything in Haskell is immutable, adding elements at the beginning
of the lists is cheap. Haskell doesn't need to allocate new memory and
copy the whole list there; it can just create a new list from a new
element and a pointer to an already existing list. In other words,
Expand Down Expand Up @@ -398,13 +398,14 @@ always matches (the same as a variable), but we don't use its value.
πŸ‘©β€πŸ”¬ Unlike 'switch' and 'case' in other languages, that try to go
through each switch and perform all actions in there until it reaches
the breakpoint, 'case' in Haskell always returns only a single
expression for a single branch. You can think of this process as
trying to match all patterns from the first one to the last one and
returning the expression on the right side of "=" only for the pattern
that matches first. This is a helpful thing to keep in mind,
especially when you have overlapping patterns. Also note that, if no
pattern matches the value, the function fails in runtime.
the breakpoint, pattern matching on function parameters in Haskell
always returns only a single expression for a single branch. You can
think of this process as trying to match all patterns from the first
one to the last one and returning the expression on the right side
of "=" only for the pattern that matches first. This is a helpful
thing to keep in mind, especially when you have overlapping patterns.
Also note that, if no pattern matches the value, the function fails
in runtime.
In addition to pattern matching in the function definition, you can
Expand Down

0 comments on commit 742b9e4

Please sign in to comment.