Comments (7)
We can do this by decoding the Tokens to a Term and pretty printing the Term in CBOR syntax.
The testsuite already has a function diagnosticNotation :: Term -> String
that produces the CBOR syntax (though it's for a type from the reference impl so some changes would be needed).
So yes, this should be straightforward and indeed useful. Perhaps we should make that the show instance for Encoding
.
from cborg.
Something like: http://cbor.me/ ?
Which prints out these kind of useful messages:
a1 # map(1)
61 # text(1)
61 # "a"
83 # array(3)
01 # unsigned(1)
03 # unsigned(3)
04 # unsigned(4)
Or do you mean showing the json-like
representation of an encoding?
{"a": [1, 3, 4]}
from cborg.
Why not both! We could have a .Pretty
module with multiple functions! :)
from cborg.
I meant the latter form, which is informally specified in the CBOR spec, and which we already generate in the tests to compare to the reference test vectors.
from cborg.
I started implementing this, but got stuck when trying to use FlatTerm instead of Encoding directly. I'll give it another go this week if I find time. (Edit: Removed the useless code that was here to reduce noise)
from cborg.
Obviously this is missing the hex representation, which should be easier to produce with Encoding.
from cborg.
Closed by c1cafbe. We'll do future work in other tickets if necessary.
from cborg.
Related Issues (20)
- The version in repository is not the released 0.2.6.0 HOT 1
- Build failure on AArch64 HOT 3
- Allow text-2.0 in serialise HOT 3
- How about CBOR RFC(7049->8949) HOT 3
- `serialise` benchmarks fail to compile with GHC 9.0 or later
- cborg fails to compile on m1 darwin (aarch64-specific maybe?) HOT 2
- Build failures in cborg with primitive-0.7.4.0 HOT 2
- Support GHC 9.4 HOT 1
- cborg-0.2.6+ fails to build for 32bit: Couldn't match expected type βInt64#β with actual type βInt#β etc HOT 3
- Alternative tags have now been standardised
- Build error on ghc 9.2.2 HOT 2
- `serialise` `versus` benchmark fails to parse internal cabal libraries
- Allow vector-0.13 (in serialise) HOT 2
- Add instances for wide-word
- cborg-0.2.8.0 fails to build with 32bit ghc9 HOT 2
- Support base-4.18, strict-0.5, these-1.2, criterion-1.6 (i.e. GHC-9.6) HOT 2
- ghc-9.4 build error on M1 HOT 6
- Test `decodeValue` against `Reference.termToJson`.
- hPutSerialise should use hPutBuilder? HOT 1
- Encoding allocates too many blocks in old generation HOT 3
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 cborg.