-
Notifications
You must be signed in to change notification settings - Fork 5
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
Add auto-derivation #27
Conversation
515e5e5
to
bdd4305
Compare
@@ -0,0 +1,3 @@ | |||
package difflicious | |||
|
|||
case class Derived[T](differ: Differ[T]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be also implemented as in circe - Derived[T](instance: T)
, this way it could support multiple typeclasses but it is not necessary in our case. Not sure if there are any other pros and cons.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is fine though I wonder whether something like
trait DerivedDiffer[T] extends Differ[T] {
def underlying: Differ[T]
}
Will be more ergonomic. Will try it out later
9c6d22d
to
e3ed246
Compare
@jatcwang before I move any further with this PR, could you provide some feedback? Is this the approach that you have in mind? |
Thanks for this. Feel free to merge this into core module instead of a separate module :) |
56e0e47
to
f9cb57c
Compare
|
||
for scala 3 | ||
```scala | ||
import difflicious.generic.auto.given |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ghostbuster91 You had import difflicious.generic.auto._
here before too but I think it's not needed? I removed it from the docs and tests. Let me know if it needs to be for any reason
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah indeed, it was redundant, good catch!
Thank you! |
The goal of this PR is to add support for auto-derivation in difficious.