Surprising behavior with Generic deriving
Open
- Dominant language
- Haskell
- Stars
- 1.3k
- Forks
- 336
- Avg merge
- 3d 7h
- Merged PRs (30d)
- 4
Description
I am building out a Servant api containing the following type:
```
data NotVerified = NotVerified
deriving stock (Generic)
deriving anyclass (ToJSON, FromJSON)
data NotVerifiedResponse = NotVerifiedResponse { errorCode :: NotVerified }
deriving stock (Generic)
deriving anyclass (ToJSON, FromJSON)
```
Strangely, if I JSON encode the NotVerifiedResponse I get
```
encode $ NotVerifiedResponse { errorCode = NotVerified }
"{\"errorCode\":[]}"
```
I'd expect to see
```
"{\"errorCode\":\"NotVerified\"}"
```
I am using GHC 9.10.3 and aeson 2.2.3.0
Contributor guide
Assessment
This issue has not been assessed yet.