Skip to content

Commit f7a9ed9

Browse files
committed
typos
1 parent ca0b369 commit f7a9ed9

4 files changed

Lines changed: 13 additions & 12 deletions

File tree

source_md/for-a-few-monads-more.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1221,7 +1221,7 @@ So it's kind of like `fmap`, only the function itself is in a context.
12211221
We have to somehow extract it from the context and map it over the `f a` value and then assemble the context back together.
12221222
Because all functions are curried in Haskell by default, we can use the combination of `<$>` and `<*>` to apply functions that take several parameters between applicative values.
12231223

1224-
Anyway, it turns out that just like `fmap`, `<*>` can also be implemented by using only what the `Monad` type class give us.
1224+
Anyway, it turns out that just like `fmap`, `<*>` can also be implemented by using only what the `Monad` type class gives us.
12251225
The `ap` function is basically `<*>`, only it has a `Monad` constraint instead of an `Applicative` one.
12261226
Here's its definition:
12271227

source_md/higher-order-functions.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ The second parameter is something of that type also and the return value is also
165165
We could read this type declaration in the curried way, but to save ourselves a headache, we'll just say that this function takes two parameters and returns one thing.
166166
The first parameter is a function (of type `a -> a`) and the second is that same `a`.
167167
The function can also be `Int -> Int` or `String -> String` or whatever.
168-
But then, the second parameter to also has to be of that type.
168+
But then, the second parameter has to also be of that type.
169169

170170
::: {.hintbox}
171171
**Note:** From now on, we'll say that functions take several parameters despite each function actually taking only one parameter and returning partially applied functions until we reach a function that returns a solid value.
@@ -248,7 +248,7 @@ flip' f = g
248248
where g x y = f y x
249249
```
250250

251-
Reading the type declaration, we say that it takes a function that takes an `a` and a `b` and returns a function that takes a `b` and an `a`.
251+
Reading the type declaration, we see that it takes a function that takes an `a` and a `b` and returns a function that takes a `b` and an `a`.
252252
But because functions are curried by default, the second pair of parentheses is really unnecessary, because `->` is right associative by default.
253253
`(a -> b -> c) -> (b -> a -> c)` is the same as `(a -> b -> c) -> (b -> (a -> c))`, which is the same as `(a -> b -> c) -> b -> a -> c`.
254254
We wrote that `g x y = f y x`.
@@ -336,7 +336,7 @@ ghci> filter (`elem` ['A'..'Z']) "i Laugh At you Because u R All The Same"
336336
```
337337

338338
All of this could also be achieved with list comprehensions by the use of predicates.
339-
There's no set rule for when to use `map` and `filter` versus using list comprehension, you just have to decide what's more readable depending on the code and the context.
339+
There's no set rule for when to use `map` and `filter` versus using a list comprehension, you just have to decide what's more readable depending on the code and the context.
340340
The `filter` equivalent of applying several predicates in a list comprehension is either filtering something several times or joining the predicates with the logical `&&` function.
341341

342342
Remember our quicksort function from the [previous chapter](recursion.html)?

source_md/making-our-own-types-and-typeclasses.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,8 @@ Value constructors are functions, so we can map them and partially apply them an
119119
If we want a list of concentric circles with different radii, we can do this.
120120

121121
```{.haskell:hs}
122-
ghci> map (Circle 10 20) [4,5,6,6]
123-
[Circle 10.0 20.0 4.0,Circle 10.0 20.0 5.0,Circle 10.0 20.0 6.0,Circle 10.0 20.0 6.0]
122+
ghci> map (Circle 10 20) [4,5,6,7]
123+
[Circle 10.0 20.0 4.0,Circle 10.0 20.0 5.0,Circle 10.0 20.0 6.0,Circle 10.0 20.0 7.0]
124124
```
125125

126126
Our data type is good, although it could be better.
@@ -1871,7 +1871,8 @@ data Frank a b = Frank {frankField :: b a} deriving (Show)
18711871
How do we know this type has a kind of `k -> (k -> *) - > *`?
18721872
Well, fields in ADTs are made to hold values, so they must be of kind `*`, obviously.
18731873
We assume `k` for `a`, and `b` takes it as its argument so its kind is `k -> *`.
1874-
Now we know the kinds of both `a` and `b` and because they're parameters for `Frank`, we see that `Frank` has a kind of `k -> (k -> *) -> *` The first `k` represents `a` and the `(k -> *)` represents `b`.
1874+
Now we know the kinds of both `a` and `b` and because they're parameters for `Frank`, we see that `Frank` has a kind of `k -> (k -> *) -> *`.
1875+
The first `k` represents `a` and the `(k -> *)` represents `b`.
18751876
Let's make some `Frank` values and check out their types.
18761877

18771878
```{.haskell:hs}

source_md/modules.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ find :: (a -> Bool) -> [a] -> Maybe a
408408

409409
Notice the type of `find`.
410410
Its result is `Maybe a`.
411-
That's kind of like having the type of `[a]`, only a value of the type `Maybe` can contain either no elements or one element, whereas a list can contain no elements, one element or several elements.
411+
That's kind of like having the type of `[a]`, only a value of the type `Maybe a` can contain either no elements or one element, whereas a list can contain no elements, one element or several elements.
412412

413413
Remember when we were searching for the first time our stock went over $1000.
414414
We did `head (dropWhile (\(val,y,m,d) -> val < 1000) stock)`.
@@ -559,7 +559,7 @@ ghci> [1..7] `intersect` [5..10]
559559
```
560560

561561
`insert`{.label .function} takes an element and a list of elements that can be sorted and inserts it into the last position where it's still less than or equal to the next element.
562-
In other words, `insert` will start at the beginning of the list and then keep going until it finds an element that's equal to or greater than the element that we're inserting and it will insert it just before the element.
562+
In other words, `insert` will start at the beginning of the list and then keep going until it finds an element that's equal to or greater than the element that we're inserting and it will insert it just before that element.
563563

564564
```{.haskell:ghci}
565565
ghci> insert 4 [3,5,1,2,8,2]
@@ -743,7 +743,7 @@ ghci> filter (not . any isSpace) . groupBy ((==) `on` isSpace) $ "hey folks its
743743

744744
Ah.
745745

746-
The `Data.Char` also exports a datatype that's kind of like `Ordering`.
746+
The `Data.Char` module also exports a datatype that's kind of like `Ordering`.
747747
The `Ordering` type can have a value of `LT`, `EQ` or `GT`.
748748
It's a sort of enumeration.
749749
It describes a few possible results that can arise from comparing two elements.
@@ -798,7 +798,7 @@ ghci> intToDigit 5
798798
'5'
799799
```
800800

801-
The `ord`{.label .function} and `chr` functions convert characters to their corresponding numbers and vice versa:
801+
The `ord`{.label .function} and `chr`{.label .function} functions convert characters to their corresponding numbers and vice versa:
802802

803803
```{.haskell:ghci}
804804
ghci> ord 'a'
@@ -960,7 +960,7 @@ fromList [(1,2),(3,2),(5,5)]
960960
```
961961

962962
If there are duplicate keys in the original association list, the duplicates are just discarded.
963-
This is the type signature of `fromList`
963+
This is the type signature of `fromList`:
964964

965965
```{.haskell:hs}
966966
Map.fromList :: (Ord k) => [(k, v)] -> Map.Map k v

0 commit comments

Comments
 (0)