Skip to content

Commit c250ee2

Browse files
committed
inline code formatting
1 parent e42b3f8 commit c250ee2

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

source_md/higher-order-functions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ ghci> zipWith' (zipWith' (*)) [[1,2,3],[3,5,6],[2,3,4]] [[3,2,2],[3,4,5],[5,4,3]
235235
```
236236

237237
As you can see, a single higher order function can be used in very versatile ways.
238-
Imperative programming usually uses stuff like for loops, while loops, setting something to a variable, checking its state, etc. to achieve some behavior and then wrap it around an interface, like a function.
238+
Imperative programming usually uses stuff like `for` loops, `while` loops, setting something to a variable, checking its state, etc. to achieve some behavior and then wrap it around an interface, like a function.
239239
Functional programming uses higher order functions to abstract away common patterns, like examining two lists in pairs and doing something with those pairs or getting a set of solutions and eliminating the ones you don't need.
240240

241241
We'll implement another function that's already in the standard library, called `flip`.
@@ -649,7 +649,7 @@ It kind of makes sense that the right fold has the accumulator on the right, bec
649649

650650
The accumulator value (and hence, the result) of a fold can be of any type.
651651
It can be a number, a boolean or even a new list.
652-
We'll be implementing the map function with a right fold.
652+
We'll be implementing the `map` function with a right fold.
653653
The accumulator will be a list, we'll be accumulating the mapped list element by element.
654654
From that, it's obvious that the starting element will be an empty list.
655655

source_md/input-and-output.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2305,7 +2305,7 @@ main = do toTry `catch` handler1
23052305
Here, `toTry` uses `handler1` as the handler and `thenTryThis` uses `handler2`.
23062306
`launchRockets` isn't a parameter to `catch`, so whichever exceptions it might throw will likely crash our program, unless `launchRockets` uses `catch` internally to handle its own exceptions.
23072307
Of course `toTry`, `thenTryThis` and `launchRockets` are I/O actions that have been glued together using `do` syntax and hypothetically defined somewhere else.
2308-
This is kind of similar to *try-catch* blocks of other languages, where you can surround your whole program in a single *try-catch* or you can use a more fine-grained approach and use different ones in different parts of your code to control what kind of error handling happens where.
2308+
This is kind of similar to `try`--`catch` blocks of other languages, where you can surround your whole program in a single `try`--`catch` or you can use a more fine-grained approach and use different ones in different parts of your code to control what kind of error handling happens where.
23092309

23102310
Now you know how to deal with I/O exceptions!
23112311
Throwing exceptions from pure code and dealing with them hasn't been covered here, mainly because, like we said, Haskell offers much better ways to indicate errors than reverting to I/O to catch them.

0 commit comments

Comments
 (0)