aeson icon indicating copy to clipboard operation
aeson copied to clipboard

Support roundtripping of numbers

Open bergmark opened this issue 4 years ago • 1 comments

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.

bergmark avatar Feb 20 '21 14:02 bergmark

I have thinking about related issues, and for now I think that textual representation will make simple things (like get me list of Ints) 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.

phadej avatar Feb 20 '21 17:02 phadej