Comments (8)
Not sure if this helps you, but yoga-json is able to parse BigInt by passing a reviver function to JSON.parse.
Reviver functions don’t help here because it’s already a JSON Number. Reviver functions can’t recover the original JSON syntax in order to load a Number as a BigInt without losing precision.
from purescript.
It's not possible for tools like
purescript-backend-optimizer
to parse CoreFn JSON for backends which use unbounded integers with any of the stock JSON tooling available in the PureScript ecosystem as they all rely on builtinJSON.parse
.
Not sure if this helps you, but yoga-json
is able to parse BigInt
by passing a reviver function to JSON.parse
.
from purescript.
@natefaubion You may be interested in the Stage 3 proposal JSON.parse source text access which makes this possible through revivers. Stage 3 means recommended for implementation, and it is already available in Chrome stable.
from purescript.
Very cool!
from purescript.
@natefaubion You may be interested in the Stage 3 proposal JSON.parse source text access which makes this possible through revivers. Stage 3 means recommended for implementation, and it is already available in Chrome stable.
I still think it would be easier to just encode the value as a String.
from purescript.
@natefaubion While this issue is for an Integer value, should the same be done on a Number value, too?
from purescript.
I don't think so. Number values are Double
which are IEEE floats, same as JS, so there's no precision issue.
from purescript.
This might be a slightly different incarnation of this issue I just came across while compiling the integers
test suite using backend-optimizer
(thus using corefn as input). The PS literal -2147483648
gets compiled to (negate 2147483648)
. That positive number literal doesn't fit the 32-bit Integer once it's converted to int
with 2147483648|0
. Changing the JSON representation to a string wouldn't actually help if the negative literal gets compiled to negate x
, the damage is already done in the corefn.
from purescript.
Related Issues (20)
- Name collision with `top` HOT 8
- Improve error message for generic method implementation in point-free style for recursive type HOT 1
- LTS 21.7 for ghc-9.4.5
- Bad rejection of some instances of classes with fundeps. (Or misleading error message) HOT 1
- CI's Ubuntu build doesn't hit the cache
- Core dump for Linux Arm64 release with ArchlinuxARM HOT 5
- Improve accessibility for the generated docs HOT 7
- Parser accepts @ binders in class heads
- Have more information in DuplicateSelectiveImport
- Support `--source-globs FILE` argument due to Windows' `cmd.exe` character limitation
- Problem typing a let expression HOT 1
- Replace `npm-installer` usage with `purs-installer` HOT 1
- Pattern matching between identical let-bindings produce no shadowing errors HOT 4
- Type synonym impossible to fully apply in type application HOT 2
- Missing all metadata for custom error
- Using an infix type alias in a type application crashes the compiler.
- Document syntax for qualified operators HOT 1
- Record field access using raw strings breaks parser HOT 1
- Code doesn't typecheck when moving a type alias between modules
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from purescript.