question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Advent of cats-parse

See original GitHub issue

These files have parboiled imports that need to go. We are moving them to cats-parse. Some of these files are related. Some are enormous and can be broken down. They could be tasked better, but this is a start.

All work should target the series-0.22 branch, but all of this will get it closer.

Basic steps:

  1. We are putting parsers on the companion objects of the type they parse, as private[http4s]. By being on the companion, they can invoke private constructors with validated values. Commenting on the RFC rules each parser implements is nice, as it makes it easier to trace back to the spec.

  2. Replace the .fromString or .parse method on the companion with code like this.

  3. Delete any parboiled parsers left behind.

  4. Run core/mimaReportBinaryIssues and add MiMa exclusions. They were all private, so it’s safe.

  5. If you find common rules, we are putting some RFC objects in an internal package to share.

  6. Some of these are trivial and some are very hard. If you get in over your head, we’re on Gitter or we’re here.

If you’re interested in one, please comment:

  • ./core/src/main/scala/org/http4s/ContentCoding.scala (@novakov-alexey)
  • ./core/src/main/scala/org/http4s/MediaType.scala (@novakov-alexey)
  • ./core/src/main/scala/org/http4s/QValue.scala (@novakov-alexey)
  • ./core/src/main/scala/org/http4s/Query.scala (@rossabaker)
  • ./core/src/main/scala/org/http4s/TransferCoding.scala (#4023)
  • ./core/src/main/scala/org/http4s/Uri.scala (@rossabaker)
  • ./core/src/main/scala/org/http4s/parser/AcceptCharsetHeader.scala (@novakov-alexey)
  • ./core/src/main/scala/org/http4s/parser/AcceptEncodingHeader.scala (@novakov-alexey)
  • ./core/src/main/scala/org/http4s/parser/AcceptHeader.scala (@novakov-alexey)
  • ./core/src/main/scala/org/http4s/parser/AcceptLanguageHeader.scala (@novakov-alexey)
  • ./core/src/main/scala/org/http4s/parser/AdditionalRules.scala
  • ./core/src/main/scala/org/http4s/parser/AuthorizationHeader.scala (@hamnis)
  • ./core/src/main/scala/org/http4s/parser/CacheControlHeader.scala (@deniszo)
  • ./core/src/main/scala/org/http4s/parser/ChallengeParser.scala (@hamnis)
  • ./core/src/main/scala/org/http4s/parser/ContentTypeHeader.scala (@novakov-alexey)
  • ./core/src/main/scala/org/http4s/parser/CookieHeader.scala (@rossabaker)
  • ./core/src/main/scala/org/http4s/parser/ForwardedHeader.scala (@fredshonorio)
  • ./core/src/main/scala/org/http4s/parser/ForwardedModelParsing.scala (@fredshonorio)
  • ./core/src/main/scala/org/http4s/parser/Http4sHeaderParser.scala
  • ./core/src/main/scala/org/http4s/parser/Http4sParser.scala
  • ./core/src/main/scala/org/http4s/parser/IpParser.scala (#4004)
  • ./core/src/main/scala/org/http4s/parser/LinkHeader.scala (@novakov-alexey)
  • ./core/src/main/scala/org/http4s/parser/OriginHeader.scala (@lewisjkl)
  • ./core/src/main/scala/org/http4s/parser/ProxyAuthenticateHeader.scala (@hamnis)
  • ./core/src/main/scala/org/http4s/parser/RangeParser.scala (@fredshonorio)
  • ./core/src/main/scala/org/http4s/parser/RequestUriParser.scala (@rossabaker)
  • ./core/src/main/scala/org/http4s/parser/Rfc2616BasicRules.scala
  • ./core/src/main/scala/org/http4s/parser/Rfc3986Parser.scala (@rossabaker)
  • ./core/src/main/scala/org/http4s/parser/SimpleHeaders.scala
  • ./core/src/main/scala/org/http4s/parser/StrictTransportSecurityParser.scala
  • ./core/src/main/scala/org/http4s/parser/UriHeaderParser.scala
  • ./core/src/main/scala/org/http4s/parser/WwwAuthenticateHeader.scala (@hamnis)
  • ./core/src/main/scala/org/http4s/parser/ZipkinHeader.scala (@m-sp)
  • ./core/src/main/scala/org/http4s/util/UrlCoding.scala (@rossabaker)

Inspired by this Twitter thread.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:27 (26 by maintainers)

github_iconTop GitHub Comments

3reactions
rossabakercommented, Jan 24, 2021

🎉 This was a massive effort. Thanks to all who participated!

1reaction
fredshonoriocommented, Dec 28, 2020

I’ll also take ./core/src/main/scala/org/http4s/parser/ForwardedHeader.scala ./core/src/main/scala/org/http4s/parser/ForwardedModelParsing.scala

Read more comments on GitHub >

github_iconTop Results From Across the Web

typelevel/cats-parse: A parsing library for the cats ecosystem
A parsing library for the cats ecosystem. Contribute to typelevel/cats-parse development by creating an account on GitHub.
Read more >
typelevel/cats-parse - Gitter
I've tried using .with1, .backtrack & .soft but can't seem to get it right. Any help is appreciated. Thanks, Leo. 3 replies. _....
Read more >
[2022 Day 13] [Scala] My parser stack overflows : r/adventofcode
My parser stack overflows (going between `packetParser` and `listParser`)). I think this is because it is left-recursive. But I don't know why.
Read more >
Basic Parsers - atto - tpolecat
Basic Parsers. In this chapter we will learn the basics of using primitive parsers, and combining them to build larger parsers.
Read more >
تويتر \ Daniel Spiewak على تويتر: "@velvetbaldmime ... - Twitter
cats -parse is a delight. It's one of those libraries that steers you toward a better design. ... I've used it for solving...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found