aeson
aeson copied to clipboard
Support roundtripping of numbers
Slightly related to #679
There are edge cases with Number where we don't roundtrip, e.g.
λ encode (decode "3.00e-3" :: Maybe Value)
"3.0e-3"
We've also had to add restrictions on parsing Scientific to prevent security issues.
I'm wondering if we should change Number to a type that essentially just stores the original text representation. This way we can properly roundtrip all numeric values, and we can disallow NaN/Infinity per the spec.
I have thinking about related issues, and for now I think that textual representation will make simple things (like get me list of Int
s) harder for a very minor gain elsewhere.
As numbers, 3.00e-3
and 3.0e3
are equal, and I really don't want make Eq Value
be able to tell the difference.