Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JNumber #51

Open
wallymathieu opened this issue Sep 25, 2018 · 1 comment
Open

JNumber #51

wallymathieu opened this issue Sep 25, 2018 · 1 comment

Comments

@wallymathieu
Copy link
Member

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.

@wallymathieu
Copy link
Member Author

wallymathieu commented Sep 25, 2018

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant