haskell / haskell/aeson

[Docs] Encourage manual To/FromJSON instances

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

Description

There's a convention that suggests avoiding Generic aeson instances because we more commonly (a) add JSON instances to Haskell types used in business logic, and less commonly (b) create a new type whose main job is to represent the encoding of some JSON that we don't control. In that more common case, generic instances lead to backward and forward compatibility issues as the types change with business needs. And we don't like to bloat business types with the `Maybe` fields needed to achieve compatibility.

Would you be open to a haddock PR that prioritizes the explanation of manual `ToJSON` and `FromJSON` instances - with a note about Generic implementations (how and when to use them)?

Contributor guide

Open the contributing guide

Research direction

Review the existing Haddock guidance for JSON instances and identify where the advice on Generic implementations is presented. Update the documentation to prioritize manual ToJSON and FromJSON instances, while explaining when Generic implementations are appropriate. Done means the guidance clearly covers both business types and externally controlled JSON encodings.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.