Add NotGiven compatibility module#180
Conversation
fee9115 to
537e147
Compare
|
I used Jetbrains Junie in IntelliJ to add some motivating examples / tests that don't compile on Scala 2 without the new module. Hopefully that's helpful. I'm not sure we needed to wait for that, but now that it's there, I think this is ready to be reviewed @satorg @armanbilge. |
|
@bpholt , thank you for the PR! It looks great overall, but I'd vote for naming consistency here. For the new module I'd personally prefer to have something like Moreover, for now we only get |
Makes sense! I updated this in a05e47e. |
|
@armanbilge did you want to take another look, or shall we go ahead and merge? |
armanbilge
left a comment
There was a problem hiding this comment.
thanks for seeing this through!
Scala 3 introduced
scala.util.NotGiven: a special class used to implement negation in implicit search.While techniques existed to implement this functionality in some cases in Scala 2, the
NotGiventrait was not backported to Scala 2. This makes cross-compilation more frustrating than it needs to be, so this module was created to make a singleorg.typelevel.scalaccompat.scala.util.NotGivenavailable to Scala 2.12, 2.13, and 3.This is based on prior work by Shapeless and fs2.
This was initially proposed as typelevel/tsc#171, but I agree that this repo is a better home for this code.