Giter Site home page Giter Site logo

Comments (7)

Shimuuar avatar Shimuuar commented on August 16, 2024

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.

dcoutts avatar dcoutts commented on August 16, 2024

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.

Shimuuar avatar Shimuuar commented on August 16, 2024

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.

kolmodin avatar kolmodin commented on August 16, 2024

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.

Shimuuar avatar Shimuuar commented on August 16, 2024

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.

axman6 avatar axman6 commented on August 16, 2024

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.

bgamari avatar bgamari commented on August 16, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.