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

json-bigint based implementation #13

Merged

Conversation

kirill-havryliuk
Copy link
Contributor

@kirill-havryliuk kirill-havryliuk commented Nov 30, 2022

Closes #12, #11

Full rework of library. Breaking changes.

From now it is based on json-bigint (#11 ).

Internally, our json representation (Aeson) relies on BigNumber from bignumber.js, to represent numbers.
This allows us deserialize/serialize JSONs holding arbitrary size numbers, including numbers with floating point.

Full rework of library. As for now it is based on json-bigint,
internally, our json representation (Aeson) relies on BigNumber
from bignumber.js, to represent numbers.
This allows us deserialize/serialize JSONs
holding arbitrary size numbers, including numbers with floating point.
…to uhbi19-k.havryliuk/json-bigint

Drop AesonEncoder etirely
.gitignore Outdated Show resolved Hide resolved
src/Aeson.purs Outdated Show resolved Hide resolved
src/Aeson.purs Outdated Show resolved Hide resolved
src/Aeson.purs Outdated Show resolved Hide resolved
src/Aeson.purs Outdated Show resolved Hide resolved
src/Aeson.purs Outdated Show resolved Hide resolved
src/Aeson.purs Outdated Show resolved Hide resolved
src/Aeson.purs Outdated Show resolved Hide resolved
@uhbif19
Copy link
Contributor

uhbif19 commented Dec 1, 2022

#12 will be probably closed too by this PR.

@kirill-havryliuk kirill-havryliuk changed the title @cardanosolutions/json-bigint based implementation [WIP ]@cardanosolutions/json-bigint based implementation Dec 1, 2022
@kirill-havryliuk kirill-havryliuk changed the title [WIP ]@cardanosolutions/json-bigint based implementation [WIP] @cardanosolutions/json-bigint based implementation Dec 1, 2022
Use Argonaut errors. Better errors.
Export from* family of functions
Cleanups. Aeson Eq now performs deep structural equalty
of underlying entities.
src/Aeson.purs Outdated Show resolved Hide resolved
src/Aeson.purs Outdated Show resolved Hide resolved
@uhbif19
Copy link
Contributor

uhbif19 commented Dec 3, 2022

@klntsky @kirill-havryliuk Resolved already covered comments.

Copy link
Member

@klntsky klntsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same everywhere where applicable

src/Aeson.purs Outdated Show resolved Hide resolved
@kirill-havryliuk kirill-havryliuk changed the title [WIP] @cardanosolutions/json-bigint based implementation [WIP] son-bigint based implementation Dec 12, 2022
@kirill-havryliuk kirill-havryliuk changed the title [WIP] son-bigint based implementation [WIP] json-bigint based implementation Dec 12, 2022
@uhbif19
Copy link
Contributor

uhbif19 commented Dec 12, 2022

@klntsky @kirill-havryliuk Looks like all issues resolved, no? Merge it?

@kirill-havryliuk
Copy link
Contributor Author

@klntsky @kirill-havryliuk Looks like all issues resolved, no? Merge it?

@uhbif19 I would like to refactor CTL so it is based on this version first, so if we miss something we still can add it here, and not introduce new PR.

@kirill-havryliuk kirill-havryliuk changed the title [WIP] json-bigint based implementation json-bigint based implementation Dec 14, 2022
packages.dhall Outdated
@@ -137,51 +137,6 @@ let additions =
, repo = "https://github.com/garyb/purescript-mote"
, version = "v1.1.0"
}
-- , medea =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

src/Aeson.purs Outdated
@@ -406,8 +415,9 @@ caseAesonBigInt def f =
else Nothing
)

-- | The reson we return `Finite BigNumber` instead plain `BigNumber`
-- | is to simplify things like `caseAesonBigNumber _ fromFiniteBigNumber`
-- | The reson we return `Finite BigNumber` instead of a plain `BigNumber`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
-- | The reson we return `Finite BigNumber` instead of a plain `BigNumber`,
-- | The reason we return `Finite BigNumber` instead of a plain `BigNumber`,

src/Aeson.js Outdated Show resolved Hide resolved
test/Gen.purs Outdated
else map (i <> _) $ go (_size - lenI)

negSign <- arbitrary
-- forceSign <- arbitrary
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leftover?

test/Gen.purs Outdated
<> when withFractional ("." <> fracPart)
<> when withExp ("e" <> expSign <> expPart)
where
-- sign = if negSign then "-" else when forceSign "+"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leftover?

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

Successfully merging this pull request may close these issues.

Throw JsonDecode errors such that they make sense when being printed
3 participants