typelevel / typelevel/cats-parse

Different way of combining Parser0 and Parser

Open
#203 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Scala
Stars
245
Forks
51
Avg merge
3h 20m
Merged PRs (30d)
1

Description

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)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the Parser0 and Parser definitions and the existing with1 method. Compare the proposed implicit-class approach with current parser-combination APIs, including the Parser0 ~ Parser0 and Parser0 ~ Parser cases. Done means a settled API design with matching behavior and tests, but the issue does not name files or tests to use.

Written by the indexing model from the issue text.

Assessment

Tech stack
scala
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.