Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Different way of combining Parser0 and Parser #203

Open
nightscape opened this issue Apr 23, 2021 · 1 comment
Open

Different way of combining Parser0 and Parser #203

nightscape opened this issue Apr 23, 2021 · 1 comment

Comments

@nightscape
Copy link

nightscape commented Apr 23, 2021

Hi all!
I'm just trying to port scala-uri from parboiled2 to cats-parse.
One thing I find rather confusing is the with1 method to make a Parser0 behave like a Parser.
I'm wondering if a different way to encode this could work, e.g.

trait LowPriorityImplicits {

  implicit class RichParser0(parser: Parser0) {
    def ~(other: Parser0): Parser0 = ???
  }
}

object Parser0 extends LowPriorityImplicits {
  implicit class EvenRicherParser(parser: Parser0) {
    def ~(other: Parser): Parser = ???
  }
}

val foo0: Parser0 = null
val foo: Parser = null
val concatted: Parser = (foo0 ~ foo)
@johnynek
Copy link
Collaborator

That could be nice. If you want to make a PR showing the changes, we could consider it.

I think we would want to be source code compatible with this change, but probably not binary compatible (since we don't want to bring using with1, but maybe make it deprecated or something).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants