Fleece
Fleece copied to clipboard
JNumber
Fleece.fs#L117-L118 (Newtonsoft.Json):
| JTokenType.Integer -> JNumber o
| JTokenType.Float -> JNumber o
Where o is JsonValue
Fleece.fs#L223-L224 (FSharp.Data):
| JsonValue.Number _ as x -> JNumber x
| JsonValue.Float _ as x -> JNumber x
Where x is JsonValue
While for System Json there doesn't seem to be such a distinction.
The function JNumber takes a decimal as parameter. It would make sense to be able to use float as well.
To get better type safety for Newtonsoft.Json and FSharp.Data perhaps it would help to add a structure:
[<Struct>]
type FleeceNumeric =
| Long of long:int64
| Decimal of decimal:decimal
| Float of float:float
in order to be able to retain the information of the active pattern?