Skip to content

Commit

Permalink
restore white-space characters
Browse files Browse the repository at this point in the history
  • Loading branch information
dotnetCarpenter committed Feb 18, 2021
1 parent edc85cd commit 145f121
Showing 1 changed file with 48 additions and 48 deletions.
96 changes: 48 additions & 48 deletions ch11.md
Expand Up @@ -186,47 +186,47 @@ This continual and tedious sorting of types is the price we pay for having mater

## Exercises

{% exercise %}
{% exercise %}
Write a natural transformation that converts `Either b a` to `Maybe a`

{% initial src="./exercises/ch11/exercise_a.js#L3;" %}
```js
// eitherToMaybe :: Either b a -> Maybe a
const eitherToMaybe = undefined;
```


{% solution src="./exercises/ch11/solution_a.js" %}
{% validation src="./exercises/ch11/validation_a.js" %}
{% context src="./exercises/support.js" %}
{% endexercise %}


---
{% initial src="./exercises/ch11/exercise_a.js#L3;" %}
```js
// eitherToMaybe :: Either b a -> Maybe a
const eitherToMaybe = undefined;
```
{% solution src="./exercises/ch11/solution_a.js" %}
{% validation src="./exercises/ch11/validation_a.js" %}
{% context src="./exercises/support.js" %}
{% endexercise %}
---


```js
// eitherToTask :: Either a b -> Task a b
const eitherToTask = either(Task.rejected, Task.of);
```

{% exercise %}
{% exercise %}
Using `eitherToTask`, simplify `findNameById` to remove the nested `Either`.

{% initial src="./exercises/ch11/exercise_b.js#L6;" %}
```js
// findNameById :: Number -> Task Error (Either Error User)
const findNameById = compose(map(map(prop('name'))), findUserById);
```


{% solution src="./exercises/ch11/solution_b.js" %}
{% validation src="./exercises/ch11/validation_b.js" %}
{% context src="./exercises/support.js" %}
{% endexercise %}


---
{% initial src="./exercises/ch11/exercise_b.js#L6;" %}
```js
// findNameById :: Number -> Task Error (Either Error User)
const findNameById = compose(map(map(prop('name'))), findUserById);
```
{% solution src="./exercises/ch11/solution_b.js" %}
{% validation src="./exercises/ch11/validation_b.js" %}
{% context src="./exercises/support.js" %}
{% endexercise %}
---


As a reminder, the following functions are available in the exercise's context:
Expand All @@ -236,20 +236,20 @@ split :: String -> String -> [String]
intercalate :: String -> [String] -> String
```

{% exercise %}
{% exercise %}
Write the isomorphisms between String and [Char].

{% initial src="./exercises/ch11/exercise_c.js#L8;" %}
```js
// strToList :: String -> [Char]
const strToList = undefined;

// listToStr :: [Char] -> String
const listToStr = undefined;
```


{% solution src="./exercises/ch11/solution_c.js" %}
{% validation src="./exercises/ch11/validation_c.js" %}
{% context src="./exercises/support.js" %}
{% endexercise %}
{% initial src="./exercises/ch11/exercise_c.js#L8;" %}
```js
// strToList :: String -> [Char]
const strToList = undefined;
// listToStr :: [Char] -> String
const listToStr = undefined;
```
{% solution src="./exercises/ch11/solution_c.js" %}
{% validation src="./exercises/ch11/validation_c.js" %}
{% context src="./exercises/support.js" %}
{% endexercise %}

0 comments on commit 145f121

Please sign in to comment.