Skip to content

Commit 402d5af

Browse files
authored
Fix minor issues (#454)
[Chapter 3] Minor fix [Chapter 7] Fix emphasis inline code markups [Chapter 11] Use '->' instead of '→' [Chapter 12] Fix field `radius` and updated width/height sentence Fixed capitalization of PureScript name
1 parent e418ab4 commit 402d5af

File tree

7 files changed

+10
-10
lines changed

7 files changed

+10
-10
lines changed

text/chapter1.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ This book aims to provide an introduction to the PureScript language for beginne
138138
If you get stuck at any point, there are a number of resources available online for learning PureScript:
139139

140140
- The [PureScript Discord server](https://discord.gg/vKn9up84bp) is a great place to chat about issues you may be having. The server is dedicated to chatting about PureScript
141-
- The [Purescript Discourse Forum](https://discourse.purescript.org/) is another good place to search for solutions to common problems.
141+
- The [PureScript Discourse Forum](https://discourse.purescript.org/) is another good place to search for solutions to common problems.
142142
- [PureScript: Jordan's Reference](https://github.com/jordanmartinez/purescript-jordans-reference) is an alternative learning resource that goes into great depth. If a concept in this book is difficult to understand, consider reading the corresponding section in that reference.
143143
- [Pursuit](https://pursuit.purescript.org) is a searchable database of PureScript types and functions. Read Pursuit's help page to [learn what kinds of searches you can do](https://pursuit.purescript.org/help/users).
144144
- The unofficial [PureScript Cookbook](https://github.com/JordanMartinez/purescript-cookbook) provides answers via code to "How do I do X?"-type questions.

text/chapter10.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,14 @@ We can assign this type to the function with the following foreign import declar
5757
{{#include ../exercises/chapter10/test/URI.purs}}
5858
```
5959

60-
We also need to write a foreign JavaScript module to import it from. A corresponding foreign JavaScript module is one of the same name but the extension changed from `.purs` to `.js`. If the Purescript module above is saved as `URI.purs`, then the foreign JavaScript module is saved as `URI.js`.
60+
We also need to write a foreign JavaScript module to import it from. A corresponding foreign JavaScript module is one of the same name but the extension changed from `.purs` to `.js`. If the PureScript module above is saved as `URI.purs`, then the foreign JavaScript module is saved as `URI.js`.
6161
Since `encodeURIComponent` is already defined, we have to export it as `_encodeURIComponent`:
6262

6363
```javascript
6464
{{#include ../exercises/chapter10/test/URI.js}}
6565
```
6666

67-
Since version 0.15, Purescript uses the ES module system when interoperating with JavaScript. In ES modules, functions and values are exported from a module by providing the `export` keyword on an object.
67+
Since version 0.15, PureScript uses the ES module system when interoperating with JavaScript. In ES modules, functions and values are exported from a module by providing the `export` keyword on an object.
6868

6969
With these two pieces in place, we can now use the `_encodeURIComponent` function from PureScript like any function written in PureScript. For example, in PSCi, we can reproduce the calculation above:
7070

text/chapter11.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -925,7 +925,7 @@ The final piece of the application is responsible for parsing command line optio
925925
`optparse` is an example of _applicative command line option parsing_. Recall that an applicative functor allows us to lift functions of arbitrary arity over a type constructor representing some type of side-effect. In the case of the `optparse` package, the functor we are interested in is the `Parser` functor (imported from the optparse module `Options.Applicative`, not to be confused with our `Parser` that we defined in the `Split` module), which adds the side-effect of reading from command line options. It provides the following handler:
926926

927927
```haskell
928-
customExecParser :: forall a. ParserPrefs ParserInfo a Effect a
928+
customExecParser :: forall a. ParserPrefs -> ParserInfo a -> Effect a
929929
```
930930

931931
This is best illustrated by example. The application's `main` function is defined using `customExecParser` as follows:

text/chapter12.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ type Rectangle =
8686
}
8787
```
8888

89-
The `x` and `y` properties represent the location of the top-left corner, while the `w` and `h` properties represent the width and height, respectively.
89+
The `x` and `y` properties represent the location of the top-left corner, while the `width` and `height` properties represent the lengths of the rectangle, respectively.
9090

9191
To render an arc segment, we can use the `arc` function, passing a record with the following type:
9292

@@ -100,7 +100,7 @@ type Arc =
100100
}
101101
```
102102

103-
Here, the `x` and `y` properties represent the center point, `r` is the radius, `start` and `end` represent the endpoints of the arc in radians.
103+
Here, the `x` and `y` properties represent the center point, `radius` is the radius, `start` and `end` represent the endpoints of the arc in radians.
104104

105105
For example, this code fills an arc segment centered at `(300, 300)` with radius `50`. The arc completes 2/3rds of a rotation. Note that the unit circle is flipped vertically since the y-axis increases towards the bottom of the canvas:
106106

text/chapter3.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ For illustration purposes, let's define a primitive function that takes any two
275275
276276
The keyword `forall` indicates that `constantlyFirst` has a _universally quantified type_. It means we can substitute any types for `a` and `b` – `constantlyFirst` will work with these types.
277277
278-
For example, we might choose the type `a` to be `Int` and `b` `String`. In that case, we can _specialize_ the type of `constantlyFirst` to
278+
For example, we might choose the type `a` to be `Int` and `b` to be `String`. In that case, we can _specialize_ the type of `constantlyFirst` to
279279
280280
```text
281281
Int -> String -> Int

text/chapter6.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,7 @@ Another reason to define a superclass relationship is when there is a clear "is-
641641

642642
Remember, your instance must satisfy the laws listed above.
643643

644-
1. (Difficult) There are multiple ways to implement an instance of `Action Multiply Int`. How many can you think of? Purescript does not allow multiple implementations of the same instance, so you will have to replace your original implementation. _Note_: the tests cover 4 implementations.
644+
1. (Difficult) There are multiple ways to implement an instance of `Action Multiply Int`. How many can you think of? PureScript does not allow multiple implementations of the same instance, so you will have to replace your original implementation. _Note_: the tests cover 4 implementations.
645645

646646
1. (Medium) Write an `Action` instance that repeats an input string some number of times:
647647

text/chapter7.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ Or with _applicative do_:
303303
Maybe String -> Maybe String -> Maybe String -> Either String String
304304
```
305305

306-
Now our function takes three optional arguments using `Maybe, and returns either a`String` error message or a `String` result.
306+
Now our function takes three optional arguments using `Maybe`, and returns either a `String` error message or a `String` result.
307307

308308
We can try out the function with different inputs:
309309

@@ -696,6 +696,6 @@ In this chapter, we covered a lot of new ideas:
696696
- We saw how applicative functors solved the problem of validating data structures and how by switching the applicative functor, we could change from reporting a single error to reporting all errors across a data structure.
697697
- We met the `Traversable` type class, which encapsulates the idea of a _traversable functor_, or a container whose elements can be used to combine values with side-effects.
698698

699-
Applicative functors are an interesting abstraction that provides neat solutions to a number of problems. We will see them a few more times throughout the book. In this case, the validation applicative functor provided a way to write validators in a declarative style, allowing us to define _what_ our validators should validate and not _how_ they should perform that validation. In general, we will see that applicative functors are a useful tool for the design of _domain specific languages.
699+
Applicative functors are an interesting abstraction that provides neat solutions to a number of problems. We will see them a few more times throughout the book. In this case, the validation applicative functor provided a way to write validators in a declarative style, allowing us to define _what_ our validators should validate and not _how_ they should perform that validation. In general, we will see that applicative functors are a useful tool for the design of _domain specific languages_.
700700

701701
In the next chapter, we will see a related idea, the class of _monads_, and extend our address book example to run in the browser!

0 commit comments

Comments
 (0)