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

Various updates and compatibility with Aeson #58

Open
wants to merge 47 commits into
base: master
Choose a base branch
from

Conversation

shmish111
Copy link

So sorry that this is all a bit of a mix but I want to get a PR open (in place of #52 which I am closing) with everything we have done in our fork to see if it's possible to get things upstreamed. I.e. which things here would you not be willing to upstream? Mostly this is around compatibility with Aeson and common data types.

  • Support for Integers using bignumber.js
  • option to unwrap records, as Aeson does
  • Encode/Decode instances for list, tuple, map, set and either
  • Tests to cover a lot of this

Other things:

  • use spago for CI build
  • add a nix-shell

shmish111 and others added 30 commits August 14, 2020 12:14
Sometimes Aeson encodes maps as objects with string keys, or as
`null`. We can now decode these cases.
Adding encoders/decoders for Either.
Adding a nix shell config, for repeatable dev envs.
It will now decode ints as well.

Note that this is just us being more tolerant of recieving something
like `1234`. If the number sent is actually in the "big" integer range
(>2^32) then it won't work and it's the sender's fault. The JSON spec
doesn't support numbers that big. They'd have to be sent as strings.
Instead of encoding them as strings, we use numbers.

'Improved' is somewhat subjective here. More likely to be successfully
read and written, perhaps less likely to be correct in all cases. Sadly
I don't see a good alternative short of forking all the consuming
libraries too.
Since we no longer care about introducing a dependency on test-unit,
let's tidy up the ad-hoc test framework.
The motivation for this is JSON parsing. In order to correctly parse big
integers from JSON, we need use a custom parser. The `JSON.parse`
builtin won't do.
shmish111 and others added 17 commits October 26, 2020 16:32
Sometimes Aeson encodes maps as objects with string keys, or as
`null`. We can now decode these cases.
It will now decode ints as well.

Note that this is just us being more tolerant of recieving something
like `1234`. If the number sent is actually in the "big" integer range
(>2^32) then it won't work and it's the sender's fault. The JSON spec
doesn't support numbers that big. They'd have to be sent as strings.
Instead of encoding them as strings, we use numbers.

'Improved' is somewhat subjective here. More likely to be successfully
read and written, perhaps less likely to be correct in all cases. Sadly
I don't see a good alternative short of forking all the consuming
libraries too.
Since we no longer care about introducing a dependency on test-unit,
let's tidy up the ad-hoc test framework.
The motivation for this is JSON parsing. In order to correctly parse big
integers from JSON, we need use a custom parser. The `JSON.parse`
builtin won't do.
@Swordlash
Copy link

Is anybody moving this forward?

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.

3 participants