You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Just a small thing if you want, i'm pointing this out while approaching Parsec, before getting used to this.
Usually a parser's name refers to the current parser input. char 'a' will parse 'a' and so on.
If we read notFollowedBy with the same semantics, a parser like notFollowedBy '.' should correctly parse "." because "."is not followed by a dot. It should fail for "a.", instead.
In this sense a parser called notFollowedBy should probably get two parsers as arguments, like manyTill etcetera. I find that the current semantic of notFollowedBy is closer to a simple not.
The text was updated successfully, but these errors were encountered:
I think that you are right, but modifying it might cause a lot of problem and bugs in projects that use it because this new behavior would be different.
I am not sure that modifying notFollowedBy is a good idea.
Thanks for following up @barufa. First of all we can agree whether we like the interface or whether we think that there is room for improvement. Once we agree that we want to improve, we can find a way towards it. For example an alias of notFollowedBy could be introduced and, if we like the resulting semantic, notFollowedBy could be deprecated in a couple of years. Even if no change is going to happen, it can be helpful to discuss about the clearest semantic so that other function names can follow a schema and the parser can become more approachable. First of all let's wait for more people to chime in :)
int-index
pushed a commit
to int-index/parsec
that referenced
this issue
Sep 18, 2020
Just a small thing if you want, i'm pointing this out while approaching Parsec, before getting used to this.
Usually a parser's name refers to the current parser input.
char 'a'
will parse'a'
and so on.If we read
notFollowedBy
with the same semantics, a parser likenotFollowedBy '.'
should correctly parse"."
because"."
is not followed by a dot. It should fail for "a.", instead.In this sense a parser called
notFollowedBy
should probably get two parsers as arguments, likemanyTill
etcetera. I find that the current semantic ofnotFollowedBy
is closer to a simplenot
.The text was updated successfully, but these errors were encountered: