From 976f7eaae72df33bd6c1db69fdb70adf9e9c2d5c Mon Sep 17 00:00:00 2001 From: James Koenig Date: Wed, 19 Nov 2025 19:12:55 -0800 Subject: [PATCH 1/2] correct 'previous chapter' references Chapters 4 & 5 were swapped so chapter 6's references to 'the previous chapter' are incorrect. --- text/chapter6.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/text/chapter6.md b/text/chapter6.md index 56cf6b81..670ca03c 100644 --- a/text/chapter6.md +++ b/text/chapter6.md @@ -167,7 +167,7 @@ Type class instances can be defined in one of two places: in the same module tha ## Exercises -1. (Easy) Define a `Show` instance for `Point`. Match the same output as the `showPoint` function from the previous chapter. _Note:_ Point is now a `newtype` (instead of a `type` synonym), which allows us to customize how to `show` it. Otherwise, we'd be stuck with the default `Show` instance for records. +1. (Easy) Define a `Show` instance for `Point`. Match the same output as the `showPoint` function from chapter 4. _Note:_ Point is now a `newtype` (instead of a `type` synonym), which allows us to customize how to `show` it. Otherwise, we'd be stuck with the default `Show` instance for records. ```haskell {{#include ../exercises/chapter6/test/no-peeking/Solutions.purs:Point}} @@ -372,13 +372,13 @@ The following newtype represents a complex number: 4. (Easy) Derive (via `newtype`) a `Ring` instance for `Complex`. _Note_: You may instead write this instance manually, but that's not as convenient. - Here's the `Shape` ADT from the previous chapter: + Here's the `Shape` ADT from chapter 4: ```haskell {{#include ../exercises/chapter6/test/no-peeking/Solutions.purs:Shape}} ``` -5. (Medium) Derive (via `Generic`) a `Show` instance for `Shape`. How does the amount of code written and `String` output compare to `showShape` from the previous chapter? _Hint_: See the [Deriving from `Generic`](https://github.com/purescript/documentation/blob/master/guides/Type-Class-Deriving.md#deriving-from-generic) section of the [Type Class Deriving](https://github.com/purescript/documentation/blob/master/guides/Type-Class-Deriving.md) guide. +5. (Medium) Derive (via `Generic`) a `Show` instance for `Shape`. How does the amount of code written and `String` output compare to `showShape` chapter 4? _Hint_: See the [Deriving from `Generic`](https://github.com/purescript/documentation/blob/master/guides/Type-Class-Deriving.md#deriving-from-generic) section of the [Type Class Deriving](https://github.com/purescript/documentation/blob/master/guides/Type-Class-Deriving.md) guide. ## Type Class Constraints From 425a55f5ba46f3e7ece30fb02cd2793b9eeb5236 Mon Sep 17 00:00:00 2001 From: James Koenig Date: Wed, 19 Nov 2025 21:41:49 -0800 Subject: [PATCH 2/2] fix over-deletion typo --- text/chapter6.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/text/chapter6.md b/text/chapter6.md index 670ca03c..30d47aa6 100644 --- a/text/chapter6.md +++ b/text/chapter6.md @@ -378,7 +378,7 @@ The following newtype represents a complex number: {{#include ../exercises/chapter6/test/no-peeking/Solutions.purs:Shape}} ``` -5. (Medium) Derive (via `Generic`) a `Show` instance for `Shape`. How does the amount of code written and `String` output compare to `showShape` chapter 4? _Hint_: See the [Deriving from `Generic`](https://github.com/purescript/documentation/blob/master/guides/Type-Class-Deriving.md#deriving-from-generic) section of the [Type Class Deriving](https://github.com/purescript/documentation/blob/master/guides/Type-Class-Deriving.md) guide. +5. (Medium) Derive (via `Generic`) a `Show` instance for `Shape`. How does the amount of code written and `String` output compare to `showShape` from chapter 4? _Hint_: See the [Deriving from `Generic`](https://github.com/purescript/documentation/blob/master/guides/Type-Class-Deriving.md#deriving-from-generic) section of the [Type Class Deriving](https://github.com/purescript/documentation/blob/master/guides/Type-Class-Deriving.md) guide. ## Type Class Constraints