Comments (7)
First question is what API should be used by Get
. I guess it's usual monadic parser combinators.
Second question is backtracking. No backtracking means better performance. Backtracking could be useful for complicated parsers. I'm not sure what are better tradeoffs
from cborg.
The main difference these days between attoparsec
and binary
is that binary
does not do backtracking, and this means it can release the input and be a bit faster. I think that's the same design tradeoff we would want to make.
from cborg.
I just checked and Alternative
instance of binary's Get
does backtrack. But as I said earlier I'm not sure whether it really needed. Parsec for example does just fine with optional backtracking with try
combinator.
from cborg.
binary
does backtracking since version 0.6, released Sept 2012. I doubt it's needed for most data formats, in retrospect it should probably not have been added.
I'm not a fan of optional backtracking, it's too easy to make a mistake, the parser should always backtrack.
I also think that use of many
is bug prone. I've used it mostly when I want to repeat as parser until the end of input, but it also stops decoding on decoder errors, which is rarely something you want when decoding binary data.
from cborg.
I also want to point out that isolate
-like combinator is invaluable in parsing existing data formats. Idiom here is size of data followed by data is ubiquitous and isolate
make paring it very convenient.
from cborg.
Imo, it doesn't make sense to include a generic binary parser in this package - the benefits it provides are that it meets the needs of anyone needing to serialise Haskell data structures, and has the bonus of giving people a CBOR decoder for use with other systems. To me these are orthogonal issues, a serialisation library and a binary parsing library (which we already have several good alternatives, such as the current binary and attoparsec)
from cborg.
I tend to agree that this package should stick to what it does well; binary
is already a perfectly fine tool for dealing with externally-specified binary formats.
from cborg.
Related Issues (20)
- 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
- Support ghc-9.8.1 HOT 4
- serialise: Usage without requiring `Serialise` instances HOT 3
- serialise: allow tar-0.6
- serialise: allow zlib-0.7
- Versions on master have fallen behind Hackage
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.