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

WIP: migrate to Scala 3 #36

Open
wants to merge 31 commits into
base: main
Choose a base branch
from
Open

WIP: migrate to Scala 3 #36

wants to merge 31 commits into from

Conversation

lorandszakacs
Copy link
Contributor

@lorandszakacs lorandszakacs commented Mar 28, 2021

It was really easy to get everything to compile and work under -source:3.0-migration flag. We just had to upgrade circe, and comment out code that relied on semiauto derivation that no longer works... at all.

But this PR is even more ambitious, it replaced _all _ usages of old syntax/features with new ones. No more:

  • import phms._ w/ import phms.*
  • implicit class but extension
  • implicit F: MonadThrow[F], but using MonadThrow[F]
  • replace implicit0(...) usages from better-monadic-for w/ given
  • replace implicit def w/ given
  • replace implicit val w/ given

The tricks was not to migrate everything at once, because errors would be extremely unhelpful. For instance, once implicit was replaced with a given in a file, then the import had to change from the old import phms.http.* to import phms.http.{*, given} to also import "givens" (also applies to Scala 2 implicits from libraries), and so on.

A dotty bug was discovered trying to get this migration done, which prevents us from replacing all old type/val skunk.Codec[A] aliases with a single export skunk.Codec for instance.

Upgraded circe to 0.14.0-M4, dropped http4s-circe dependency, and decided to leave code commented, to be rewritten and inlined. And phms.json.derive.codec method is now unimplemented.

Things left to do:

  • rewrite the Http4sCirceInstances decoder w/ circe 0.14.0-M4,
  • figure out how to get circe Codec to work with other opaque types with minimal boilerplate and/or changes.
  • drop scalaScrapper entirely, and just use jsoup to implement same functionality. It currently crashes at compile time whenever we try to use anything from the DSL because it relies on old complex scalaz things and it's to be expected to run into some interop bug. Currently still depending on scala-scrapper with the .cross(CrossVersion.for3Use2_13) sbt method. Which allows us to use it as a dependency. But it's not worth the hassle, let's just use direct java wrappers instead.

This required circe upgrade and dropping of http4s-circe integration, which we're inlining
Pending implementation of decoder
It's due to Scala 2 interop w/ scalascrapper
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

1 participant