Add derive via Generic example, and point to latest docs#331
Add derive via Generic example, and point to latest docs#331hdgarrood merged 2 commits intopurescript:masterfrom
Conversation
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)
hdgarrood
left a comment
There was a problem hiding this comment.
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.
language/Type-Classes.md
Outdated
| @@ -147,11 +147,22 @@ derive instance ordPerson :: Ord Person | |||
| ``` | |||
| Currently, the following type classes can be derived: | |||
There was a problem hiding this comment.
Could you add "by the compiler" here please?
language/Type-Classes.md
Outdated
| - [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`: |
There was a problem hiding this comment.
To clarify the different senses in which we are using "derive" here, could you replace this with the following?
Note that
derive instanceis 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.
hdgarrood
left a comment
There was a problem hiding this comment.
Looks great, thank you
I often visit this page looking for a
genericShowexample.It was also frustrating to click on the
Data.Generic.Repand 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)