Skip to content

Conversation

milesfrain
Copy link
Contributor

I often visit this page looking for a genericShow example.

It was also frustrating to click on the Data.Generic.Rep and be taken to an older package version that's missing lots of nice documentation. So ensuring links now go to the latest version. (related to purescript/pursuit#414)

I often visit this page looking for a `genericShow` example.

It was also frustrating to click on the `Data.Generic.Rep` and be taken to an older package version that's missing lots of nice documentation. So ensuring links now go to the latest version. (related to purescript/pursuit#414)
Copy link
Collaborator

@hdgarrood hdgarrood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks; I agree that it's a good idea to add this so that people don't get the impression that this an exhaustive list of classes for which you can avoid writing boilerplate instances. However, we're now using "derive" in a couple of different senses, so I think it would be best to differentiate them a bit more clearly.

derive instance eqPerson :: Eq Person
derive instance ordPerson :: Ord Person
```
Currently, the following type classes can be derived:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add "by the compiler" here please?

- [Data.Functor (class Functor)](https://pursuit.purescript.org/packages/purescript-prelude/docs/Data.Functor#t:Functor)
- [Data.Newtype (class Newtype)](https://pursuit.purescript.org/packages/purescript-newtype/docs/Data.Newtype#t:Newtype)

Other type classes may be derived via `Generic`:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To clarify the different senses in which we are using "derive" here, could you replace this with the following?

Note that derive instance is not the only mechanism for allowing you to avoid writing out boilerplate type class instance code. Many type classes not listed here can be derived through other means, such as via a Generic instance. More information on Generic deriving is available in the generics-rep library documentation.

Copy link
Collaborator

@hdgarrood hdgarrood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thank you

@hdgarrood hdgarrood merged commit 081ec82 into purescript:master Jul 11, 2020
@milesfrain milesfrain deleted the patch-5 branch November 5, 2020 03:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants