Comments (3)
[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.
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.
@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)
- [proposed labels: question, feature request] best practices for stateful matching of simple patterns HOT 4
- Question: mergeError HOT 2
- Greedy combinators HOT 11
- Problematic `IsString` instance HOT 4
- Processing input prior to parsing while retaining source positions HOT 1
- Mention in documentation that `parse` is an alias for `runParser` HOT 1
- MonadAccum instance for ParsecT HOT 5
- Tabs are not handled correctly when errors are rendered HOT 4
- Indentation error lost in alternative HOT 3
- `local` clears all hints HOT 5
- 9.4 migration: getSourcePos now requires `Monad m =>` HOT 6
- Remove/upgrade version bounds of executable `test-debug` from megaparsec-tests HOT 2
- Add `drop` to `Text.Megaparsec` HOT 3
- Wrong source locations on `unexpected end of input` with custom tokens HOT 2
- get col, row (as Int's) and error message of the first TrivialError HOT 2
- deepseq-1.5? HOT 1
- Error context with additional source positions HOT 4
- Parsing hexadecimal floats HOT 1
- Rewrite rules for parser primitives HOT 2
- How to use `Operator` from tutorial HOT 2
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 megaparsec.