You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Solo is the canonical 1-element tuple type.
However, the implementation added in PR #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" ❗❗❗
() <-> "[]"
The text was updated successfully, but these errors were encountered:
I think "incorrect" is a bit strong but the argument is reasonable. The problem is it would break 4+ years' behavior. I'd be curious to see
code that wants to seriaize/deserialize generically over tuples of various arities
because I suspect a custom datatype implementing a subset of HList functionality would better serve, or demonstrate that genericity isn't worth the trouble, depending on the genericity desired.
You're absolutely astute that this change would be backwards-incompatible and thus could only be introduced in a breaking PVP release. That of course shouldn't be done lightly, and this issue by itself by no means is enough to warrant such a breaking change in and of itself. But if there is another change that needs a breaking version release, this problem could be resolved at the same time.
What I ended up doing in the codebase where I first encountered this, is creating a separate datatype called Single that functions as Solo.
Solo
is the canonical 1-element tuple type.However, the implementation added in PR #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:
The text was updated successfully, but these errors were encountered: