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

migrate cache control parser #4202

Merged
merged 1 commit into from Jan 13, 2021
Merged

Conversation

m-sp
Copy link
Member

@m-sp m-sp commented Jan 12, 2021

No description provided.

@@ -55,9 +55,12 @@ private[http4s] object Rfc7230 {
/* quoted-pair = "\" ( HTAB / SP / VCHAR / obs-text ) */
val quotedPair: Parser[Char] = char('\\') *> qdPairChar

private def surroundedBy[A](a: Parser0[A], b: Parser[Any]): Parser[A] =
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I needed a custom surroundedBy because as long as the quotes are required we actually do make progress and can get the Parser aka Parser1

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, is this an oversight in the cats-parse signature?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the return type of the original method is a Parser0, so it makes sense that every argument is a Parser0.
so if a or b is a Parser than the return type is a Parser. otherwise the return type is a Parser0. tbh not sure if simple overloading would allow that. but yeah maybe a surroundedBy0 would be nice

Copy link
Contributor

@hamnis hamnis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks right to me

@@ -55,9 +55,12 @@ private[http4s] object Rfc7230 {
/* quoted-pair = "\" ( HTAB / SP / VCHAR / obs-text ) */
val quotedPair: Parser[Char] = char('\\') *> qdPairChar

private def surroundedBy[A](a: Parser0[A], b: Parser[Any]): Parser[A] =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, is this an oversight in the cats-parse signature?

@rossabaker rossabaker merged commit 999444f into http4s:series/0.22 Jan 13, 2021
@m-sp m-sp deleted the port-cache-control branch January 13, 2021 19:45
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

Successfully merging this pull request may close these issues.

None yet

3 participants