haskell / haskell/aeson

The `Solo` instance is incorrect

Open
#1,119 16 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

`Solo` is the canonical 1-element tuple type.
However, the implementation added in PR https://github.com/haskell/aeson/pull/891 treat it as any other normal 1-element type, which is incorrect.

This becomes problematic when you have code that wants to seriaize/deserialize generically over tuples of various arities:
- (10, 20, 30) <-> "[10, 20, 30]"
- (10, 20) <-> "[10, 20]"
- Solo 10 <-> "10" ❗❗❗
- () <-> "[]"

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.