GithubHelp home page GithubHelp logo

Comments (3)

abooij avatar abooij commented on June 9, 2024

[minor issue]
In that case, that would be a good opportunity to rename it, to avoid confusion with parsec's label. Additionally, is "label" the name that makes the biggest amount of sense for this function? Since it's more of an error report... "label" suggests that you always see this information, whereas it really is a bit of feedback that you only receive in the "negative" case... Maybe "feedback" or "reporting":

yearP :: Parser Integer
yearP = reporting "year" $ do
  s <- some digit
  return $ if length s < 4 then 2000 + read s else read s

read as "reporting {error message} [in case of failure, rather than the default message somewhere deep down in this parser], do ..."
Just my $0.02 though, "label" is perfectly acceptable, and I am probably bikeshedding here.
[/minor issue]

from megaparsec.

neongreen avatar neongreen commented on June 9, 2024

 that would be a good opportunity to rename it, to avoid confusion with parsec's label

Well, this depends on just how much @mrkkrp values compatibility with Parsec. (Even if “not much”, given how small this issue is, the exact amount of “not much” starts to matter here.) Another thing to keep in mind is that (I think) label isn't used often and thus changing its type won't cause practically any harm.

 Since it's more of an error report...

Hm. At least in my mental model, it's not “an error report”, but “how is this parser called” (a datapoint: before I looked at the docs, I was pretty sure it was called name and not label). Yeah, parser names are only used in error reports, but I still think of them as of names internally. reporting sounds more like “in case of parsing failure, report this error: ...”.

from megaparsec.

mrkkrp avatar mrkkrp commented on June 9, 2024

@neongreen, I actually had this in my mind when I wanted to write hidden = label "". I think it's indeed may make writing of some long parsers easier, I see your point. I'll commit necessary changes soon.

@tulcod, I don't value compatibility with Parsec in this project. After all, it already has many functions that are called differently and even a couple of them that have the same names but do different things (yes count, I'm looking at you). However, I just think that label is simple and intuitive name for this combinator.

It's obvious even from this little discussion that different people have different associations and would like to call it differently (name, reporting). I think there is no real reason for renaming, let it be label, after all <?> form is used more often afaik.

from megaparsec.

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.