Comments (5)
For an none wondering, the url is https://gist.github.com/ondrap/a0791fafcce466966699 somehow all the '.'s were removed.
Definitely looks like a strange big to me - is a list of n+1 elements the canonical way to represent sum types? Been a while since i've read the docs. Also is there no need for something to close the list?
from cborg.
It's one of the possible ways to do it - see https://github.com/well-typed/binary-serialise-cbor/blob/master/Data/Binary/Serialise/CBOR/Class.hs for the default instances. However what's fishy is that deserialise . serialise
doesn't work, while deserialise . (force the list) . serialise
works. I looked into the cbor sources and it seems to me that while quite dense with all those unsafe functions, it's still not as unsafe as to cause such behaviour.
BTW: it seems that the triggering point is serialising Integer
with Text
- what deserialised badly is the Integer
. The Text
value is probably causing the Integer
to fall on some chunk boundary. My quickcheck tests didn't find any problem with other datatypes (might be harder to find).
from cborg.
I have updated the gist with another test case - it seems there is still some error as it incorrectly parses forced ByteString
if the bytestring consist of 1-byte chunks. This testcase shows an error in binary-serialise-cbor
though.
- the
deserialise . tokenize . serialise
fails even when run inghci
;deserialise . serialise
works correctly when run in ghci
from cborg.
Ok, so both of this is either a GHC bug or some bug inside binary-serialize-cbor touching something it shouldn't touch. When loaded in GHCi, this produces different results when run repeatedly:
filter (\(a,b) -> not b) (map (\i -> (i,chunkProp [VNum (-41), VTerms [T.pack (replicate i 'a')]])) [0..800])
from cborg.
I have fixed the problem, it seems to have no impact on performance. However, the accursedUnutterablePerformIO
is available only in bytestring-0.10.6.0, the previous version had unsafeDupableIO
. Does it make sense to build-depend on bytestring-0.10.6 and higher? I will try to add some test before doing a pull request.
from cborg.
Related Issues (20)
- 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
- Remove dependency on `aeson-pretty`
- fromFlatTerm impl of PeekTokenType is insufficently precise
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.