diff --git a/docs/order-with-promo/Promo.re b/docs/order-with-promo/Promo.re index db58bc5..2327290 100644 --- a/docs/order-with-promo/Promo.re +++ b/docs/order-with-promo/Promo.re @@ -135,19 +135,3 @@ let _ = // #endregion missing-sandwich-types-wildcard ignore(buyWhat); }; - -let _ = - code => { - // #region show-missing-sandwich-types - let buyWhat = - switch (code) { - | `NeedOneBurger => "at least 1 more burger" - | `NeedTwoBurgers => "at least 2 burgers" - | `NeedMegaBurger => "a burger with every topping" - | `MissingSandwichTypes(missing) => - (missing |> Stdlib.Array.of_list |> Js.Array.join(~sep=", ")) - ++ " sandwiches" - }; - // #endregion show-missing-sandwich-types - ignore(buyWhat); - }; diff --git a/docs/order-with-promo/index.md b/docs/order-with-promo/index.md index ab1f516..5ae8e4d 100644 --- a/docs/order-with-promo/index.md +++ b/docs/order-with-promo/index.md @@ -163,8 +163,7 @@ Then set the `className` of the promo code row to `Style.promo`: Hot diggity! You've added the promo codes to your order confirmation widget, just in time for Madame Jellobutter's International Burger Day promotions. In -the next chapter, we'll start writing a completely new app. Before that, cap off -what you've learned by doing some exercises. +the next chapter, we'll learn how to test our components. ## Overview @@ -252,7 +251,8 @@ missing sandwich types when the discount can't be applied. Start by changing the Note that the `` `MissingSandwichTypes`` variant tag now contains an argument of `list(string)`. Make this test pass, and fix any incidental compilation errors. -(Don't worry about changing the render logic, that's the next exercise.) +(Don't worry about changing the render logic, that's a subject for the next +chapter.) ::: details Hint 1 @@ -316,7 +316,7 @@ let humanize = | [] => "" | [x] => x | [x, y] => x ++ " and " ++ y - | [first, ...rest] => { + | [first, ...rest] => // fill in this part ``` @@ -366,19 +366,6 @@ An alternate solution would have been to add the commas in the callback to ::: -5. Use `ListSafe.humanize` in `Promo.make` to make the `` -`MissingSandwichTypes`` error message more human-readable. - -Then change the render logic inside `Promo.make`'s `` `MissingSandwichTypes`` -branch to convert the list of missing sandwich types to a comma-delimited -string: - -<<< Promo.re#show-missing-sandwich-types{7-9} - -Recall that we have to use `Stdlib.Array.of_list` instead of `Array.of_list` -because our custom `Array` module takes precedence. - - ----- View [source diff --git a/docs/poly-to-normal-variant/index.md b/docs/poly-to-normal-variant/index.md index 85a33ca..3176180 100644 --- a/docs/poly-to-normal-variant/index.md +++ b/docs/poly-to-normal-variant/index.md @@ -158,7 +158,7 @@ feel free to leave out. --- -Phew! You refactored the `discount` reactive variable to use a normal variant +Phew! You refactored the `discount` derived variable to use a normal variant instead of a polymorphic variant. The code changes were fairly minimal, but to understand what was happening, it was necessary to learn the basics of type constructors and type variables. In the next sections, we'll set types and other