Documentation examples for generic instances for `ToJSONKey` fail to compile
- Dominant language
- Haskell
- Stars
- 1.3k
- Forks
- 336
- Avg merge
- 3d 7h
- Merged PRs (30d)
- 4
Description
The documentation has an example for implementing `ToJSONKey` for a simple sum type:
```haskell
data Color = Red | Green | Blue
deriving (Show, Read, Eq, Ord)
instance ToJSONKey Color where
toJSONKey = genericToJSONKey defaultJSONKeyOptions
```
However, when trying this I get two errors:
- `No instance for ‘ToJSON Color’`
- `No instance for ‘Generic Color’`
It'd be nice to have the examples compile.
(I was surprised that `ToJSON` was needed. So I looked at the example to clarify whether I'm really supposed to have that instance or whether I'm just using the library wrong. But since the example doesn't have the `ToJSON` instance, but also doesn't compile, I'm still not 100% sure.)
Contributor guide
Assessment
This issue has not been assessed yet.