haskell / haskell/aeson

Generic encoding incorrect for some cases

Open
#1,016 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
1.3k
Forks
336
Avg merge
3d 7h
Merged PRs (30d)
4

Description

Consider a type like this:

```
data T = A { tag :: Int } | B
```

when using the default options for generic encoding and try to encode `A { tag = 2 }` the result is `{"tag":2}`, because the field `tag` overwrote the actual constructor tag `A`

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the generic encoding example for `data T = A { tag :: Int } | B` with the default options and inspect the generic encoding entry points. Done means the constructor tag `A` is not overwritten by the field named `tag`, with behavior confirmed by a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.