+Infinity, -Infinity, NaN are representable by Json
Opened this issue · 3 comments
rightfold commented
The Json
type includes these values, however they are not allowed in JSON.
rightfold commented
Some possible solutions, with their downsides:
- Make
fromNumber
immediately returnnull
on such inputs. This is breaking without a type change. - Make
fromNumber
returnMaybe Json
, and addfromNumber'
which immediately returnsnull
. This may confuse people. - Make
stringify
returnMaybe String
. This is annoying.
rightfold commented
As @garyb pointed out on Slack, not just fromNumber
, but also jsonParser
may return infinities; when a number is outside of the range of Number
.
github-actions commented
This issue is stale because it has been open for 60 days with no activity. Remove the stale label or comment to keep this issue open. Otherwise, this issue will be closed in 14 days.